Skip to content

Conversation

@kevinherdez
Copy link
Collaborator

This refactors the map views that show the polygons for the zone to use Mapbox.

Where to start

  • ZoneMap.tsx and AvalancheForecastZonePolygon.tsx
    • These two files contain the bulk of the changes that relate to Mapbox. The rest of the files that were changed are mainly a result of these two

Differences between @rnmapbox and react-native-maps

  • Mapbox has the idea of a Camera component that controls what the user is looking at. The Camera is used to programmatically change what the user is seeing on the map. In react-native-maps this is done directly on the MapView
  • Mapbox uses layers to create the polygons that are shown on the map. They can directly receive GeoJSON data so a lot of the preprocessing that we were doing is not longer needed
  • The z-index of the layers is determined by the order in which they are rendered in. The last layer has the highest z-index
    • This is why there's a conditional render for the SelectedAvalancheForecastZonePolygon component so that it's always the last one rendered
  • Mapbox does not have the concept of Region that is used heavily with react-native-maps. This code will need to be refactored more. For now, the Region is being used to translate in the Mapbox equivalent of CameraBounds
  • A lot of the onPresses that were passed to the MapView to handle different events are no longer required

What's next

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.

1 participant