question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

setStyle not working properly

See original GitHub issue

Your 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:closed
  • Created 6 years ago
  • Comments:8 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
alex3165commented, Nov 21, 2017

Look like this issue: https://github.com/mapbox/mapbox-gl-js/issues/5714 fix released with version 0.42.2 of mapbox-gl

0reactions
Wykkscommented, Nov 25, 2017

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.

Read more comments on GitHub >

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

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found