Skip to content

Commit 7ca6890

Browse files
authored
Prevent mutedStandard mapType on android (#949)
* Prevent `mutedStandard` mapType on android * Don't mutate prop directly
1 parent d5556d7 commit 7ca6890

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

packages/maps/src/components/MapView.tsx

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ const MapViewF = <T extends object>({
6868
style,
6969
animateToLocation,
7070
mapRef,
71+
mapType: mapTypeProp = "standard",
7172
...rest
7273
}: MapViewProps<T> & {
7374
animateToLocation: (location: ZoomLocation) => void;
@@ -77,6 +78,14 @@ const MapViewF = <T extends object>({
7778
const delayedRegionValue = useDebounce(currentRegion, 300);
7879
const contextDelayedRegionValue = useDebounce(currentRegion, 50);
7980

81+
let mapType = mapTypeProp;
82+
if (mapType === "mutedStandard" && Platform.OS === "android") {
83+
console.warn(
84+
"Map type 'mutedStandard' is not supported on Android. Defaulting to 'standard'"
85+
);
86+
mapType = "standard";
87+
}
88+
8089
const markerRefs = React.useMemo<
8190
Map<string, React.RefObject<MapMarkerRefType>>
8291
>(() => new Map(), []);
@@ -316,6 +325,7 @@ const MapViewF = <T extends object>({
316325
onPress?.(coordinate.latitude, coordinate.longitude);
317326
}}
318327
style={[styles.map, style]}
328+
mapType={mapType}
319329
{...rest}
320330
>
321331
{unClusteredMarkers.map((marker, index) =>

0 commit comments

Comments
 (0)