Skip to content

Commit

Permalink
Merge pull request #33234 from shubham1206agra/fix-mapbox-zoom
Browse files Browse the repository at this point in the history
Fixed mapbox zoom for single waypoint
  • Loading branch information
luacmartins authored Jan 8, 2024
2 parents 57c6c2f + cc8c5ed commit f4432ec
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 2 deletions.
1 change: 1 addition & 0 deletions src/CONST.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2954,6 +2954,7 @@ const CONST = {
MAPBOX: {
PADDING: 50,
DEFAULT_ZOOM: 10,
SINGLE_MARKER_ZOOM: 15,
DEFAULT_COORDINATE: [-122.4021, 37.7911],
STYLE_URL: 'mapbox://styles/expensify/cllcoiqds00cs01r80kp34tmq',
},
Expand Down
2 changes: 1 addition & 1 deletion src/components/MapView/MapView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ const MapView = forwardRef<MapViewHandle, ComponentProps>(

if (waypoints.length === 1) {
cameraRef.current?.setCamera({
zoomLevel: 15,
zoomLevel: CONST.MAPBOX.SINGLE_MARKER_ZOOM,
animationDuration: 1500,
centerCoordinate: waypoints[0].coordinate,
});
Expand Down
2 changes: 1 addition & 1 deletion src/components/MapView/MapView.website.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ const MapView = forwardRef<MapViewHandle, ComponentProps>(
if (waypoints.length === 1) {
mapRef.flyTo({
center: waypoints[0].coordinate,
zoom: CONST.MAPBOX.DEFAULT_ZOOM,
zoom: CONST.MAPBOX.SINGLE_MARKER_ZOOM,
});
return;
}
Expand Down

0 comments on commit f4432ec

Please sign in to comment.