Refactor to use mapbox and remove react-native-maps#1080
Conversation
nice! ❤️ looked through everything, left a few questions - will take another look tomorrow morning/early afternoon on more fresh brain. Thanks for working on this, nothing jumped out at me as not making sense thus far! Excited! |
| useFocusEffect(recordAnalytics); | ||
|
|
||
| const nePosition: Position = [(observation.location_point.lng ?? 0) + 0.075 / 2, (observation.location_point.lat ?? 0) + 0.075 / 2]; | ||
| const swPosition: Position = [(observation.location_point.lng ?? 0) - 0.075 / 2, (observation.location_point.lat ?? 0) - 0.075 / 2]; |
There was a problem hiding this comment.
Did we previously accept null/undefined, or why ?? 0 now but not before? Naively seems like not showing a map is better than showing whatever lat/long 0/0 is, but the obs should always have the data - maybe schema for NWAC obs compatibility (which we no longer use) is why this is possibly null? Maybe good follow-up.
There was a problem hiding this comment.
Showing the ZoneMap in this view is dependent on whether observation.location_point has a value or not. In the old code, the initial region object is created and directly passed into the ZoneMap after the null check. I moved this up here because there's a little more that goes into creating the CameraBounds
There was a problem hiding this comment.
I have no problem moving this down into the ZoneMap directly so that we don't have to null check anymore
1350bc9 to
6ed9daa
Compare
Refactor WeatherStationMap to use mapbox Remove react-native-maps Added AvyPosition type to better work with GeoJSONs Position and addressed other feedback Addressed PR Feedback
6ed9daa to
5993071
Compare
This PR brings in mapbox, refactors the views that heavily used the old
<MapView/>, and removesreact-native-mapsWhere to start
ZoneMap.tsxandAvalancheForecastZonePolygon.tsxDifferences between
@rnmapboxandreact-native-mapsCameracomponent that controls what the user is looking at. TheCamerais used to programmatically change what the user is seeing on the map. Inreact-native-mapsthis is done directly on theMapViewz-indexof the layers is determined by the order in which they are rendered in. The last layer has the highestz-indexSelectedAvalancheForecastZonePolygoncomponent so that it's always the last one renderedRegionthat is used heavily withreact-native-maps.Regionis refactored to beAvalancheCenterRegion. This allows a lot of the old calculations to remain the same and includesCameraBoundsso that the view can be correctly positionedPositionwhich is just anumber[]where the first index is the longitude and the second is the latitudeonPressesthat were passed to theMapViewto handle different events are no longer requiredWhat's next