-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Question about localFileSource platform suport #7644
Comments
This should work if you use |
As @kkaefer notes, you can use an absolute file: URL to access a file in the documents directory. However, it sounds like you may find it more convenient to use the offline maps API ( |
Thanks for the help @1ec5 and @kkaefer! Just as reference for anyone else: currently react-native-mapbox-gl would need to be forked to build against mapbox-gl-native >= 3.4. There is a pre-build script specified in package.json that downloads the compiled native library for iOS (currently set to 3.3.1). Not sure yet whether RNMBGL would build against that without further changes. |
@kkaefer This is working for me on Android but not on iOS. On iOS, for example, this does not work in my JSON style file(have confirmed the folders exist):
|
Your application is sandboxed, so it has no access to your home directory on your Mac. Within the sandbox, the root directory |
Without knowing exactly what you’re trying to do, I think the offline map API would probably be a better way to do it. 😄 (Unfortunately, RNMBGL doesn’t do a great job of exposing this API to React Native on iOS.) If you really do need to manage tile downloads yourself, rather than relying on the offline map API to download the tiles as part of the style, then eventually #7471 (comment) in conjunction with the runtime styling API (nitaliano/react-native-mapbox-gl#416) would make it possible for you to specify these on-disk tiles without having to modify a JSON file. |
@SeanChristopherConway |
I thought I would try asking about this here before taking the time to fork react-native-mapbox-gl to include the change...
Is it possible on both iOS and android to load files (
style.json
and the tiles themselves) from the App documents directory using the recently addedlocalFileSource
? We have apps with custom raster map tiles that we currently have to include with the app and access using theassets://
protocol. It would be great to be able to download them on first launch and usefile://
.Thanks, any pointers in the right direction would be appreciated!
The text was updated successfully, but these errors were encountered: