Skip to content

Support dynamically changing local JSON in styleURL - #1399

Merged
ferdicus merged 2 commits into
masterfrom
fix/support-dynamic-json-style-url
Jun 14, 2021
Merged

Support dynamically changing local JSON in styleURL#1399
ferdicus merged 2 commits into
masterfrom
fix/support-dynamic-json-style-url

Conversation

@ferdicus

@ferdicus ferdicus commented Jun 10, 2021

Copy link
Copy Markdown
Member

When dynamically changing a MapViews styleURL prop that is a locally defined style.json setReactStyleURL will call MapboxMaps setStyle.
Without a passed in Builder, it'll use the default one - which assumes that the style stings is an URI (which it is not).

To prevent a Mapbox error [HTTP] Unable to parse resourceUrl error we need to pass in our own Builder that uses fromJSON instead fromUri

Note:

  • this is not an issue on initial load - only on prop changes
  • this is not an issue on iOS

@mattijsf, I've added you as a reviewer, because this is relevant to the changes we implemented

Checklist

  • I have tested this on a device/simulator for each compatible OS
  • I mentioned this change in CHANGELOG.md
    * [ ] I updated the documentation yarn generate
    * [ ] I updated the typings files (index.d.ts)
    * [ ] I added/ updated a sample (/example)

When dynamically changing a `MapView`s `styleURL` prop that is a locally defined style.json `setReactStyleURL` will call `MapboxMap`s `setStyle`.  
Without a passed in Builder, it'll use the default one - which assumes that the style stings is an URI (which it is not). 

To prevent a `Mapbox error [HTTP] Unable to parse resourceUrl` error  we need to pass in our own Builder that uses `fromJSON` instead `fromUri`
@ferdicus
ferdicus requested review from mattijsf and mfazekas June 10, 2021 14:02
@ferdicus ferdicus self-assigned this Jun 10, 2021
@ferdicus ferdicus changed the title support dynamically changing local JSON in styleURL Support dynamically changing local JSON in styleURL Jun 10, 2021
@ferdicus
ferdicus merged commit fd48db6 into master Jun 14, 2021
@ferdicus
ferdicus deleted the fix/support-dynamic-json-style-url branch June 14, 2021 07:19
mikalaiulasevich pushed a commit to OneSoil-Platform/maps that referenced this pull request Sep 23, 2021
* support dynamically changing local JSON in styleURL

When dynamically changing a `MapView`s `styleURL` prop that is a locally defined style.json `setReactStyleURL` will call `MapboxMap`s `setStyle`.  
Without a passed in Builder, it'll use the default one - which assumes that the style stings is an URI (which it is not). 

To prevent a `Mapbox error [HTTP] Unable to parse resourceUrl` error  we need to pass in our own Builder that uses `fromJSON` instead `fromUri`

* docs: add changes to changelog
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants