File tree 1 file changed +14
-1
lines changed
packages/maps/src/components
1 file changed +14
-1
lines changed Original file line number Diff line number Diff line change 5
5
View ,
6
6
StyleSheet ,
7
7
Text ,
8
+ Platform ,
8
9
} from "react-native" ;
9
10
import { Marker as MapMarkerComponent } from "./react-native-maps" ;
10
11
import type {
@@ -20,6 +21,7 @@ export interface MapMarkerProps
20
21
longitude : number ;
21
22
pinImage ?: string | ImageSourcePropType ;
22
23
pinImageSize ?: number ;
24
+ androidUseDefaultIconImplementation ?: boolean ;
23
25
onPress ?: ( latitude : number , longitude : number ) => void ;
24
26
}
25
27
@@ -40,6 +42,7 @@ export function renderMarker(
40
42
longitude,
41
43
pinImage,
42
44
pinImageSize = 50 ,
45
+ androidUseDefaultIconImplementation = false ,
43
46
onPress,
44
47
children,
45
48
title,
@@ -76,6 +79,9 @@ export function renderMarker(
76
79
) ;
77
80
}
78
81
82
+ const shouldUseDefaultIconImplemnation =
83
+ Platform . OS !== "android" || ! androidUseDefaultIconImplementation ;
84
+
79
85
return (
80
86
< MapMarkerComponent
81
87
ref = { ref }
@@ -89,11 +95,18 @@ export function renderMarker(
89
95
const coordinate = event . nativeEvent . coordinate ;
90
96
onPress ?.( coordinate . latitude , coordinate . longitude ) ;
91
97
} }
98
+ icon = {
99
+ shouldUseDefaultIconImplemnation
100
+ ? typeof pinImage === "string"
101
+ ? { uri : pinImage }
102
+ : ( pinImage as any )
103
+ : undefined
104
+ }
92
105
{ ...rest }
93
106
>
94
107
{ nonCalloutChildren }
95
108
96
- { pinImage && (
109
+ { pinImage && ! shouldUseDefaultIconImplemnation && (
97
110
< Image
98
111
testID = "map-marker-pin-image"
99
112
source = { typeof pinImage === "string" ? { uri : pinImage } : pinImage }
You can’t perform that action at this time.
0 commit comments