Platform: iOS 26.6, iPhone 17 Pro
App version number: 1.0.26
Browser: n/a
URLs (aka web addresses) of any relevant observations or pages: n/a
Screenshots of what you are seeing: n/a
Description of problem:
After searching a map area in Explore, switching to Species and back to Observations zooms the map out to the whole world, centered at lat/lng 0,0.
Step 1: Open Explore tab. Pan the map and tap “Redo Search in Map Area”.
Step 2: Switch to Species (view button, bottom right), then back to Observations.
Step 3: Map is zoomed out to the whole world and centered on 0,0.
Potential fix:
(I noticed there is a V1 and V2 of Explore, maybe this is a known issue fixed in V2?)
Switching views remounts the map, so it rebuilds its camera from initialRegion, and that only knows how to handle a nearby search or a named place, so it falls back to 0,0. The area you searched is still in explore state, so this fix restores the camera from that instead of falling back.
diff --git a/src/components/Explore/MapView.tsx b/src/components/Explore/MapView.tsx
index a43992489..42719ffd4 100644
--- a/src/components/Explore/MapView.tsx
+++ b/src/components/Explore/MapView.tsx
@@ -89,6 +89,29 @@ const MapView = ( {
longitudeDelta: NEARBY_DELTA,
} ), [exploreState.lat, exploreState.lng] );
+ const {
+ swlat, swlng, nelat, nelng,
+ } = exploreState;
+
+ const mapAreaRegion = useMemo( ( ) => {
+ if (
+ swlat === undefined
+ || swlng === undefined
+ || nelat === undefined
+ || nelng === undefined
+ ) {
+ return null;
+ }
+ const latitudeDelta = Math.abs( nelat - swlat );
+ const longitudeDelta = Math.abs( nelng - swlng );
+ return {
+ latitude: ( nelat + swlat ) / 2,
+ longitude: ( nelng + swlng ) / 2,
+ latitudeDelta,
+ longitudeDelta,
+ };
+ }, [swlat, swlng, nelat, nelng] );
+
const regionFromCoordinates = useMemo( ( ) => {
if ( exploreState.place?.point_geojson?.coordinates ) {
const [longitude, latitude] = exploreState.place.point_geojson.coordinates;
@@ -189,8 +212,14 @@ const MapView = ( {
}
}
+ if ( exploreState.placeMode === PLACE_MODE.MAP_AREA ) {
+ if ( mapAreaRegion ) {
+ return mapAreaRegion;
+ }
+ }
+
return worldwideRegion;
- }, [exploreState.placeMode, nearbyRegion, regionFromCoordinates] );
+ }, [exploreState.placeMode, mapAreaRegion, nearbyRegion, regionFromCoordinates] );
const handlePanDrag = ( ) => setShowRedoSearchButton( true );