Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support dynamically changing local JSON in styleURL #1399

Merged
merged 2 commits into from
Jun 14, 2021

Conversation

ferdicus
Copy link
Member

@ferdicus ferdicus commented Jun 10, 2021

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 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