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

The navigation route disappears if you toggle the mapView's styleURL several times. #2008

Closed
joshpuente opened this issue Mar 6, 2019 · 1 comment

Comments

@joshpuente
Copy link

Mapbox Navigation SDK version: v0.28.0

During the turn-by-turn navigation mode we give our users the ability to toggle the mapView's styleURL. We've noticed that after doing this a few times, the blue polyline of the route disappears. However, if you continue toggling the mapView's styleUrl then eventually the blue polyline will reappear.

Steps to reproduce:

  1. Start the turn-by-turn navigation mode with a particular route.
  2. Change the mapView's styleURL several times during navigation
  3. Notice that the route's polyline disappears
@1ec5
Copy link
Contributor

1ec5 commented Mar 8, 2019

We recommend specifying one or more instances of Style subclasses when initializing a NavigationViewController rather than setting styleURL directly. You can set its mapStyleURL property to the map style you want when that Style is active. The sources and style layers added by NavigationMapView.showRoutes(_:legIndex:) get blown away whenever the style URL changes, due to mapbox/mapbox-gl-native#6180, so you’d need to call NavigationMapView.showRoutes(_:legIndex:) after setting the style URL. But the Style mechanism is preferable because StyleManager already knows how to do that.

@1ec5 1ec5 closed this as completed Mar 8, 2019
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

No branches or pull requests

2 participants