setStyle not working properly
See original GitHub issueYour code makes 100% sense. You check for a change in style prop and call map.setStyle acordingly.
However: when I change the style prop, it does not react properly. It goes back to the original zoom when loaded and after changing the style several times I get this:
Uncaught TypeError: Cannot read property 'hasTransition' of undefined
at t.hasTransitions (mapbox-gl.js:374)
at e._render (mapbox-gl.js:484)
but that issue does not exist for mapbox-gl docs: https://www.mapbox.com/mapbox-gl-js/example/setstyle/
Issue Analytics
- State:
- Created 6 years ago
- Comments:8 (6 by maintainers)
Top Results From Across the Web
JavaFX .setStyle(...) isn't not working when `-fx-background ...
As for the File path i am sure it is well , i am using the code below : //Maou is the File...
Read more >setStyle with a problem - openlayers - GIS Stack Exchange
I need to set up a style in time of creating a feature in OpenLayers. But besides my style var works, I know...
Read more >setStyle() - Studio Code.org
This advanced function allows assigning CSS styles to HTML design elements in an app. Examples. Fancy Button. Apply several different styles to a...
Read more >Data Referenced Corridor Code Set Style not working properly
The problem is that the corridors do not appear the same in the model files(dref host) and the output(dref client) files. Same code...
Read more >How to SetStyle back to "normal" without default style
If I understand the documentation correctly, It would work, ... We are using 3.1.4.. not sure about the port, the application itself runs...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Look like this issue: https://github.com/mapbox/mapbox-gl-js/issues/5714 fix released with version 0.42.2 of mapbox-gl
If you pass center and zoom like that, you’re creating a new ref of center and zoom for each render. To fix that, you can put center and zoom inside the component state for example.