react-native-maps 1.21.0-alpha.96 → 1.21.0-alpha.98

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,326 @@
1
+ import {HostComponent} from 'react-native';
2
+ import type {
3
+ ViewProps,
4
+ ColorValue,
5
+ ImageSourcePropType as ImageSource,
6
+ } from 'react-native';
7
+
8
+ import codegenNativeComponent from 'react-native/Libraries/Utilities/codegenNativeComponent';
9
+ import codegenNativeCommands from 'react-native/Libraries/Utilities/codegenNativeCommands';
10
+ import {
11
+ Int32,
12
+ Double,
13
+ BubblingEventHandler,
14
+ DirectEventHandler,
15
+ WithDefault,
16
+ } from 'react-native/Libraries/Types/CodegenTypes';
17
+
18
+ export type LatLng = Readonly<{
19
+ latitude: Double; // Non-nullable Double for latitude
20
+ longitude: Double; // Non-nullable Double for longitude
21
+ }>;
22
+
23
+ export type MarkerPressEventHandler = BubblingEventHandler<
24
+ Readonly<{
25
+ action: string;
26
+ id?: string;
27
+ coordinate?: {
28
+ latitude: Double; // Inlined LatLng
29
+ longitude: Double;
30
+ };
31
+ position?: {
32
+ x: Double;
33
+ y: Double;
34
+ };
35
+ }>
36
+ >;
37
+
38
+ export type MarkerDragEventHandler = DirectEventHandler<
39
+ Readonly<{
40
+ id?: string;
41
+ coordinate?: {
42
+ latitude: Double; // Inlined LatLng
43
+ longitude: Double;
44
+ };
45
+ }>
46
+ >;
47
+
48
+ export type CalloutPressEventHandler = BubblingEventHandler<
49
+ Readonly<{
50
+ action: string;
51
+ id?: string;
52
+ frame?: {
53
+ x: Double; // Inlined LatLng
54
+ y: Double;
55
+ width: Double; // Inlined LatLng
56
+ height: Double;
57
+ };
58
+ point?: {
59
+ x: Double;
60
+ y: Double;
61
+ };
62
+ }>
63
+ >;
64
+
65
+ type AppleMarkerVisibility = 'hidden' | 'adaptive' | 'visible';
66
+
67
+ export type AppleMarkerPriority = 'required' | 'high' | 'low';
68
+
69
+ export type Point = Readonly<{
70
+ x: Double; // Non-nullable Double for x
71
+ y: Double; // Non-nullable Double for y
72
+ }>;
73
+
74
+ export interface MarkerFabricNativeProps extends ViewProps {
75
+ /**
76
+ * Sets the anchor point for the marker.
77
+ * The anchor specifies the point in the icon image that is anchored to the marker's position on the Earth's surface.
78
+ *
79
+ * The anchor point is specified in the continuous space [0.0, 1.0] x [0.0, 1.0],
80
+ * where (0, 0) is the top-left corner of the image, and (1, 1) is the bottom-right corner.
81
+ *
82
+ * The anchoring point in a W x H image is the nearest discrete grid point in a (W + 1) x (H + 1) grid, obtained by scaling the then rounding.
83
+ * For example, in a 4 x 2 image, the anchor point (0.7, 0.6) resolves to the grid point at (3, 1).
84
+ *
85
+ * @default {x: 0.5, y: 1.0}
86
+ * @platform iOS: Google Maps only. For Apple Maps, see the `centerOffset` prop
87
+ * @platform Android: Supported
88
+ */
89
+ anchor?: Point;
90
+ /**
91
+ * Specifies the point in the marker image at which to anchor the callout when it is displayed.
92
+ * This is specified in the same coordinate system as the anchor.
93
+ *
94
+ * See the `anchor` prop for more details.
95
+ *
96
+ * @default {x: 0.5, y: 0.0}
97
+ * @platform iOS: Google Maps only. For Apple Maps, see the `calloutOffset` prop
98
+ * @platform Android: Supported
99
+ */
100
+ calloutAnchor?: Point;
101
+
102
+ /**
103
+ * A custom image to be used as the marker's icon. Only local image resources are allowed to be used.
104
+ *
105
+ * @platform iOS: Supported
106
+ * @platform Android: Supported
107
+ */
108
+ image?: ImageSource | null;
109
+
110
+ /**
111
+ * The offset (in points) at which to place the callout bubble.
112
+ * When this property is set to (0, 0),
113
+ * the anchor point of the callout bubble is placed on the top-center point of the marker view’s frame.
114
+ *
115
+ * Specifying positive offset values moves the callout bubble down and to the right,
116
+ * while specifying negative values moves it up and to the left
117
+ *
118
+ * @default {x: 0.0, y: 0.0}
119
+ * @platform iOS: Apple Maps only. For Google Maps, see the `calloutAnchor` prop
120
+ * @platform Android: Not supported. See the `calloutAnchor` prop
121
+ */
122
+ calloutOffset?: Point;
123
+ /**
124
+ Constants that indicates the display priority for annotations.
125
+ @default required
126
+ @platform iOS: Apple Maps only.
127
+ @platform Android: Not supported
128
+
129
+ Required: A constant indicating that the item is required.
130
+ High: A constant indicating that the item’s display priority is high.
131
+ Low: A constant indicating that the item’s display priority is Low.
132
+ */
133
+ displayPriority?: WithDefault<AppleMarkerPriority, 'required'>;
134
+
135
+ /**
136
+ * The coordinate for the marker.
137
+ *
138
+ * @platform iOS: Supported
139
+ * @platform Android: Supported
140
+ */
141
+ coordinate: LatLng;
142
+
143
+ /**
144
+ * The description of the marker.
145
+ *
146
+ * This is only used if the <Marker /> component has no children that are a `<Callout />`,
147
+ * in which case the default callout behavior will be used,
148
+ * which will show both the `title` and the `description`, if provided.
149
+ *
150
+ * @platform iOS: Supported
151
+ * @platform Android: Supported
152
+ */
153
+ description?: string;
154
+
155
+ /**
156
+ * if `true` allows the marker to be draggable (re-positioned).
157
+ *
158
+ * @default false
159
+ * @platform iOS: Supported
160
+ * @platform Android: Supported
161
+ */
162
+ draggable?: boolean;
163
+
164
+ /**
165
+ * The title of the marker.
166
+ * This is only used if the <Marker /> component has no `<Callout />` children.
167
+ *
168
+ * If the marker has <Callout /> children, default callout behavior will be used,
169
+ * which will show both the `title` and the `description`, if provided.
170
+ *
171
+ * @platform iOS: Supported
172
+ * @platform Android: Supported
173
+ */
174
+ title?: string;
175
+
176
+ /**
177
+ * A string that can be used to identify this marker.
178
+ *
179
+ * @platform iOS: Supported
180
+ * @platform Android: Supported
181
+ */
182
+ identifier?: string;
183
+
184
+ /**
185
+ * When true, the marker will be pre-selected.
186
+ * Setting this to true allows the user to drag the marker without needing to tap on it first to focus it.
187
+ *
188
+ * @default false
189
+ * @platform iOS: Apple Maps only
190
+ * @platform Android: Not supported
191
+ */
192
+ isPreselected?: boolean;
193
+
194
+ /**
195
+ * Callback that is called when the user taps the callout view.
196
+ *
197
+ * @platform iOS: Apple Maps only
198
+ * @platform Android: Supported
199
+ */
200
+ onCalloutPress?: CalloutPressEventHandler;
201
+
202
+ /**
203
+ * Callback that is called when the marker is deselected, before the callout is hidden.
204
+ *
205
+ * @platform iOS: Apple Maps only
206
+ * @platform Android: supported
207
+ */
208
+ onDeselect?: MarkerPressEventHandler;
209
+
210
+ /**
211
+ * Callback called continuously as the marker is dragged
212
+ *
213
+ * @platform iOS: Apple Maps only
214
+ * @platform Android: Supported
215
+ */
216
+ onDrag?: MarkerDragEventHandler;
217
+
218
+ /**
219
+ * Callback that is called when a drag on the marker finishes.
220
+ * This is usually the point you will want to setState on the marker's coordinate again
221
+ *
222
+ * @platform iOS: Apple Maps only
223
+ * @platform Android: Supported
224
+ */
225
+ onDragEnd?: MarkerDragEventHandler;
226
+
227
+ /**
228
+ * Callback that is called when the user initiates a drag on the marker (if it is draggable)
229
+ *
230
+ * @platform iOS: Apple Maps only
231
+ * @platform Android: Supported
232
+ */
233
+ onDragStart?: MarkerDragEventHandler;
234
+
235
+ /**
236
+ * Callback that is called when the marker is tapped by the user.
237
+ *
238
+ * @platform iOS: Supported
239
+ * @platform Android: Supported
240
+ */
241
+ onPress?: MarkerPressEventHandler;
242
+
243
+ /**
244
+ * Callback that is called when the marker becomes selected.
245
+ * This will be called when the callout for that marker is about to be shown.
246
+ *
247
+ * @platform iOS: Supported.
248
+ * @platform Android: Supported
249
+ */
250
+ onSelect?: MarkerPressEventHandler;
251
+
252
+ /**
253
+ * The marker's opacity between 0.0 and 1.0.
254
+ *
255
+ * @default 1.0
256
+ * @platform iOS: Supported
257
+ * @platform Android: Supported
258
+ */
259
+ opacity?: WithDefault<Double, 1.0>;
260
+
261
+ /**
262
+ * If no custom marker view or custom image is provided, the platform default pin will be used, which can be customized by this color.
263
+ * Ignored if a custom marker is being used.<br/><br/>
264
+ * For Android, the set of available colors is limited. Unsupported colors will fall back to red.
265
+ * See [#887](https://github.com/react-community/react-native-maps/issues/887) for more information.
266
+ *
267
+ * @platform iOS: Supported
268
+ * @platform Android: Supported
269
+ */
270
+ pinColor?: ColorValue;
271
+
272
+ /**
273
+ * Visibility of the title text rendered beneath Marker balloon
274
+ * @platform iOS: Apple Maps only
275
+ * @platform Android: Not supported
276
+ */
277
+ titleVisibility?: WithDefault<AppleMarkerVisibility, 'visible'>;
278
+
279
+ /**
280
+ * Visibility of the subtitle text rendered beneath Marker balloon
281
+ * @platform iOS: Apple Maps only
282
+ * @platform Android: Not supported
283
+ */
284
+ subtitleVisibility?: WithDefault<AppleMarkerVisibility, 'adaptive'>;
285
+
286
+ /**
287
+ * Indicate type of default markers if it's true MKPinAnnotationView will be used and MKMarkerAnnotationView if it's false
288
+ * It doesn't change anything if you are using custom Markers
289
+ * @platform iOS: Apple Maps only
290
+ * @platform Android: Not supported
291
+ */
292
+ useLegacyPinView?: boolean;
293
+ }
294
+ export interface NativeCommands {
295
+ animateToCoordinates: (
296
+ viewRef: React.ElementRef<React.ComponentType>,
297
+ latitude: Double,
298
+ longitude: Double,
299
+ duration: Int32,
300
+ ) => void;
301
+ setCoordinates: (
302
+ viewRef: React.ElementRef<React.ComponentType>,
303
+ latitude: Double,
304
+ longitude: Double,
305
+ ) => void;
306
+ showCallout: (viewRef: React.ElementRef<React.ComponentType>) => void;
307
+ hideCallout: (viewRef: React.ElementRef<React.ComponentType>) => void;
308
+ redrawCallout: (viewRef: React.ElementRef<React.ComponentType>) => void;
309
+ redraw: (viewRef: React.ElementRef<React.ComponentType>) => void;
310
+ }
311
+
312
+ export const Commands: NativeCommands = codegenNativeCommands<NativeCommands>({
313
+ supportedCommands: [
314
+ 'setCoordinates',
315
+ 'animateToCoordinates',
316
+ 'showCallout',
317
+ 'hideCallout',
318
+ 'redrawCallout',
319
+ 'redraw',
320
+ ],
321
+ });
322
+
323
+ export default codegenNativeComponent<MarkerFabricNativeProps>(
324
+ 'RNMapsMarker',
325
+ {},
326
+ ) as HostComponent<MarkerFabricNativeProps>;
@@ -0,0 +1,89 @@
1
+ import codegenNativeComponent from 'react-native/Libraries/Utilities/codegenNativeComponent';
2
+ import {
3
+ Double,
4
+ Float,
5
+ BubblingEventHandler,
6
+ WithDefault,
7
+ } from 'react-native/Libraries/Types/CodegenTypes';
8
+ import type {
9
+ ViewProps,
10
+ HostComponent,
11
+ ImageSourcePropType as ImageSource,
12
+ } from 'react-native';
13
+ export type LatLng = Readonly<{
14
+ latitude: Double; // Non-nullable Double for latitude
15
+ longitude: Double; // Non-nullable Double for longitude
16
+ }>;
17
+
18
+ export type OverlayPressEventHandler = BubblingEventHandler<
19
+ Readonly<{
20
+ action?: string;
21
+ id: string;
22
+ coordinate: {
23
+ latitude: Double; // Inlined LatLng
24
+ longitude: Double;
25
+ };
26
+ position?: {
27
+ x: Double; // Inlined Point
28
+ y: Double;
29
+ }; // Optional position for Android
30
+ }>
31
+ >;
32
+
33
+ export interface OverlayFabricNativeProps extends ViewProps {
34
+ /**
35
+ * The bearing in degrees clockwise from north. Values outside the range [0, 360) will be normalized.
36
+ *
37
+ * @default 0
38
+ * @platform iOS: Google Maps only
39
+ * @platform Android: Supported
40
+ */
41
+ bearing?: Float;
42
+
43
+ /**
44
+ * The coordinates for the image (left-top corner, right-bottom corner). ie.```[[lat, long], [lat, long]]```
45
+ *
46
+ * @platform iOS: Supported
47
+ * @platform Android: Supported
48
+ */
49
+ bounds: ReadonlyArray<LatLng>;
50
+
51
+ /**
52
+ * A custom image to be used as the overlay.
53
+ * Only required local image resources and uri (as for images located in the net) are allowed to be used.
54
+ *
55
+ * @platform iOS: Supported
56
+ * @platform Android: Supported
57
+ */
58
+ image?: ImageSource | null;
59
+
60
+ /**
61
+ * Callback that is called when user taps on the map.
62
+ *
63
+ * @platform iOS: Supported
64
+ * @platform Android: Supported
65
+ */
66
+ onPress?: OverlayPressEventHandler;
67
+
68
+ /**
69
+ * The overlay's opacity between 0.0 and 1.0.
70
+ *
71
+ * @default 1.0
72
+ * @platform iOS: Supported
73
+ * @platform Android: Supported
74
+ */
75
+ opacity?: WithDefault<Float, 1.0>;
76
+
77
+ /**
78
+ * Boolean to allow a polygon to be tappable and use the onPress function.
79
+ *
80
+ * @platform iOS: Google Maps only
81
+ * @platform Android: Supported
82
+ */
83
+ tappable?: boolean;
84
+ }
85
+
86
+ export default codegenNativeComponent<OverlayFabricNativeProps>(
87
+ 'RNMapsOverlay',
88
+ {},
89
+ ) as HostComponent<OverlayFabricNativeProps>;
@@ -0,0 +1,124 @@
1
+ import type {HostComponent, ViewProps, ColorValue} from 'react-native';
2
+
3
+ import codegenNativeComponent from 'react-native/Libraries/Utilities/codegenNativeComponent';
4
+ import {
5
+ Double,
6
+ Float,
7
+ BubblingEventHandler,
8
+ WithDefault,
9
+ } from 'react-native/Libraries/Types/CodegenTypes';
10
+
11
+ export type LatLng = Readonly<{
12
+ latitude: Double; // Non-nullable Double for latitude
13
+ longitude: Double; // Non-nullable Double for longitude
14
+ }>;
15
+
16
+ export type PolylinePressEventHandler = BubblingEventHandler<
17
+ Readonly<{
18
+ action?: string;
19
+ id: string;
20
+ coordinate: {
21
+ latitude: Double; // Inlined LatLng
22
+ longitude: Double;
23
+ };
24
+ position?: {
25
+ x: Double; // Inlined Point
26
+ y: Double;
27
+ }; // Optional position for Android
28
+ }>
29
+ >;
30
+
31
+ export interface PolylineFabricNativeProps extends ViewProps {
32
+ /**
33
+ * An array of coordinates to describe the polygon
34
+ *
35
+ * @platform iOS: Supported
36
+ * @platform Android: Supported
37
+ */
38
+ coordinates: ReadonlyArray<LatLng>;
39
+
40
+ /**
41
+ * Boolean to indicate whether to draw each segment of the line as a geodesic as opposed to straight lines on the Mercator projection.
42
+ * A geodesic is the shortest path between two points on the Earth's surface.
43
+ * The geodesic curve is constructed assuming the Earth is a sphere.
44
+ *
45
+ * @platform iOS: Google Maps only
46
+ * @platform Android: Supported
47
+ */
48
+ geodesic?: boolean;
49
+
50
+ /**
51
+ * The line cap style to apply to the open ends of the path
52
+ *
53
+ * @default `round`
54
+ * @platform iOS: Apple Maps only
55
+ * @platform Android: supported
56
+ * */
57
+ lineCap?: WithDefault<'butt' | 'round' | 'square', 'butt'>;
58
+
59
+ /**
60
+ * An array of numbers specifying the dash pattern to use for the path.
61
+ * The array contains one or more numbers that indicate the lengths (measured in points)
62
+ * of the line segments and gaps in the pattern.
63
+ * The values in the array alternate, starting with the first line segment length,
64
+ * followed by the first gap length, followed by the second line segment length, and so on.
65
+ *
66
+ * @platform iOS: Apple Maps only
67
+ * @platform Android: supported
68
+ */
69
+ lineDashPattern?: ReadonlyArray<Double>;
70
+
71
+ /**
72
+ * The line join style to apply to corners of the path.
73
+ *
74
+ * @platform iOS: Apple Maps only
75
+ * @platform Android: supported
76
+ */
77
+ lineJoin?: WithDefault<'miter' | 'round' | 'bevel', 'miter'>;
78
+
79
+ /**
80
+ * Callback that is called when user taps on the map.
81
+ *
82
+ * @platform iOS: Supported
83
+ * @platform Android: Supported
84
+ */
85
+ onPress?: PolylinePressEventHandler;
86
+
87
+ /**
88
+ * The stroke color to use for the path.
89
+ *
90
+ * @default `#000`, `rgba(r,g,b,0.5)`
91
+ * @platform iOS: Supported
92
+ * @platform Android: Supported
93
+ */
94
+ strokeColor?: ColorValue;
95
+
96
+ /**
97
+ * The stroke colors to use for the path.
98
+ * @default `#000`, `rgba(r,g,b,0.5)`
99
+ * @platform iOS: Supported
100
+ * @platform Android: Supported
101
+ */
102
+ strokeColors?: ReadonlyArray<ColorValue>;
103
+ /**
104
+ * The stroke width to use for the path.
105
+ *
106
+ * @default 1
107
+ * @platform iOS: Supported
108
+ * @platform Android: Supported
109
+ */
110
+ strokeWidth?: Float;
111
+
112
+ /**
113
+ * Boolean to allow a polygon to be tappable and use the onPress function.
114
+ *
115
+ * @platform iOS: Google Maps only
116
+ * @platform Android: Supported
117
+ */
118
+ tappable?: boolean;
119
+ }
120
+
121
+ export default codegenNativeComponent<PolylineFabricNativeProps>(
122
+ 'RNMapsPolyline',
123
+ {},
124
+ ) as HostComponent<PolylineFabricNativeProps>;