react-native-maps 1.28.2 → 1.29.1
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.
- package/android/src/main/java/com/rnmaps/maps/MapGradientPolyline.java +4 -0
- package/android/src/main/java/com/rnmaps/maps/MapHeatmap.java +4 -0
- package/android/src/main/java/com/rnmaps/maps/MapLocalTile.java +4 -0
- package/android/src/main/java/com/rnmaps/maps/MapUrlTile.java +4 -0
- package/android/src/main/jni/react/renderer/components/RNMapsSpecs/ComponentDescriptors.cpp +2 -0
- package/android/src/main/jni/react/renderer/components/RNMapsSpecs/ComponentDescriptors.h +2 -0
- package/android/src/main/jni/react/renderer/components/RNMapsSpecs/EventEmitters.cpp +175 -0
- package/android/src/main/jni/react/renderer/components/RNMapsSpecs/EventEmitters.h +157 -0
- package/android/src/main/jni/react/renderer/components/RNMapsSpecs/Props.cpp +183 -0
- package/android/src/main/jni/react/renderer/components/RNMapsSpecs/Props.h +431 -0
- package/android/src/main/jni/react/renderer/components/RNMapsSpecs/ShadowNodes.cpp +2 -0
- package/android/src/main/jni/react/renderer/components/RNMapsSpecs/ShadowNodes.h +22 -0
- package/android/src/main/jni/react/renderer/components/RNMapsSpecs/States.h +4 -0
- package/dist/src/specs/NativeComponentGoogleMarker.d.ts +250 -0
- package/dist/src/specs/NativeComponentPolygon.d.ts +108 -0
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/ios/AirGoogleMaps/AIRGoogleMapMarker.h +3 -0
- package/ios/AirGoogleMaps/AIRGoogleMapMarker.m +6 -2
- package/ios/AirGoogleMaps/RNMapsGoogleMapView.mm +8 -0
- package/ios/AirGoogleMaps/RNMapsGoogleMarkerView.h +28 -0
- package/ios/AirGoogleMaps/RNMapsGoogleMarkerView.mm +357 -0
- package/ios/AirMaps/FabricPlaceholders/PlaceHolderGoogleMarkerView.h +24 -0
- package/ios/AirMaps/FabricPlaceholders/PlaceHolderGoogleMarkerView.mm +64 -0
- package/ios/AirMaps/RNMapsMapView.mm +8 -0
- package/ios/AirMaps/RNMapsPolygonView.h +26 -0
- package/ios/AirMaps/RNMapsPolygonView.mm +240 -0
- package/ios/generated/RCTThirdPartyComponentsProvider.mm +2 -0
- package/ios/generated/RNMapsSpecs/ComponentDescriptors.cpp +2 -0
- package/ios/generated/RNMapsSpecs/ComponentDescriptors.h +2 -0
- package/ios/generated/RNMapsSpecs/EventEmitters.cpp +175 -0
- package/ios/generated/RNMapsSpecs/EventEmitters.h +157 -0
- package/ios/generated/RNMapsSpecs/Props.cpp +178 -0
- package/ios/generated/RNMapsSpecs/Props.h +379 -0
- package/ios/generated/RNMapsSpecs/RCTComponentViewHelpers.h +143 -0
- package/ios/generated/RNMapsSpecs/ShadowNodes.cpp +2 -0
- package/ios/generated/RNMapsSpecs/ShadowNodes.h +22 -0
- package/ios/generated/RNMapsSpecs/States.h +4 -0
- package/package.json +4 -2
- package/src/MapMarker.tsx +4 -3
- package/src/decorateMapComponent.ts +29 -15
- package/src/specs/NativeComponentGoogleMarker.ts +327 -0
- package/src/specs/NativeComponentPolygon.ts +137 -0
|
@@ -229,6 +229,145 @@ if ([commandName isEqualToString:@"setIndoorActiveLevelIndex"]) {
|
|
|
229
229
|
#endif
|
|
230
230
|
}
|
|
231
231
|
|
|
232
|
+
@protocol RCTRNMapsGoogleMarkerViewProtocol <NSObject>
|
|
233
|
+
- (void)animateToCoordinates:(double)latitude longitude:(double)longitude duration:(NSInteger)duration;
|
|
234
|
+
- (void)setCoordinates:(double)latitude longitude:(double)longitude;
|
|
235
|
+
- (void)showCallout;
|
|
236
|
+
- (void)hideCallout;
|
|
237
|
+
- (void)redrawCallout;
|
|
238
|
+
- (void)redraw;
|
|
239
|
+
@end
|
|
240
|
+
|
|
241
|
+
RCT_EXTERN inline void RCTRNMapsGoogleMarkerHandleCommand(
|
|
242
|
+
id<RCTRNMapsGoogleMarkerViewProtocol> componentView,
|
|
243
|
+
NSString const *commandName,
|
|
244
|
+
NSArray const *args)
|
|
245
|
+
{
|
|
246
|
+
if ([commandName isEqualToString:@"animateToCoordinates"]) {
|
|
247
|
+
#if RCT_DEBUG
|
|
248
|
+
if ([args count] != 3) {
|
|
249
|
+
RCTLogError(@"%@ command %@ received %d arguments, expected %d.", @"RNMapsGoogleMarker", commandName, (int)[args count], 3);
|
|
250
|
+
return;
|
|
251
|
+
}
|
|
252
|
+
#endif
|
|
253
|
+
|
|
254
|
+
NSObject *arg0 = args[0];
|
|
255
|
+
#if RCT_DEBUG
|
|
256
|
+
if (!RCTValidateTypeOfViewCommandArgument(arg0, [NSNumber class], @"double", @"RNMapsGoogleMarker", commandName, @"1st")) {
|
|
257
|
+
return;
|
|
258
|
+
}
|
|
259
|
+
#endif
|
|
260
|
+
double latitude = [(NSNumber *)arg0 doubleValue];
|
|
261
|
+
|
|
262
|
+
NSObject *arg1 = args[1];
|
|
263
|
+
#if RCT_DEBUG
|
|
264
|
+
if (!RCTValidateTypeOfViewCommandArgument(arg1, [NSNumber class], @"double", @"RNMapsGoogleMarker", commandName, @"2nd")) {
|
|
265
|
+
return;
|
|
266
|
+
}
|
|
267
|
+
#endif
|
|
268
|
+
double longitude = [(NSNumber *)arg1 doubleValue];
|
|
269
|
+
|
|
270
|
+
NSObject *arg2 = args[2];
|
|
271
|
+
#if RCT_DEBUG
|
|
272
|
+
if (!RCTValidateTypeOfViewCommandArgument(arg2, [NSNumber class], @"number", @"RNMapsGoogleMarker", commandName, @"3rd")) {
|
|
273
|
+
return;
|
|
274
|
+
}
|
|
275
|
+
#endif
|
|
276
|
+
NSInteger duration = [(NSNumber *)arg2 intValue];
|
|
277
|
+
|
|
278
|
+
[componentView animateToCoordinates:latitude longitude:longitude duration:duration];
|
|
279
|
+
return;
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
if ([commandName isEqualToString:@"setCoordinates"]) {
|
|
283
|
+
#if RCT_DEBUG
|
|
284
|
+
if ([args count] != 2) {
|
|
285
|
+
RCTLogError(@"%@ command %@ received %d arguments, expected %d.", @"RNMapsGoogleMarker", commandName, (int)[args count], 2);
|
|
286
|
+
return;
|
|
287
|
+
}
|
|
288
|
+
#endif
|
|
289
|
+
|
|
290
|
+
NSObject *arg0 = args[0];
|
|
291
|
+
#if RCT_DEBUG
|
|
292
|
+
if (!RCTValidateTypeOfViewCommandArgument(arg0, [NSNumber class], @"double", @"RNMapsGoogleMarker", commandName, @"1st")) {
|
|
293
|
+
return;
|
|
294
|
+
}
|
|
295
|
+
#endif
|
|
296
|
+
double latitude = [(NSNumber *)arg0 doubleValue];
|
|
297
|
+
|
|
298
|
+
NSObject *arg1 = args[1];
|
|
299
|
+
#if RCT_DEBUG
|
|
300
|
+
if (!RCTValidateTypeOfViewCommandArgument(arg1, [NSNumber class], @"double", @"RNMapsGoogleMarker", commandName, @"2nd")) {
|
|
301
|
+
return;
|
|
302
|
+
}
|
|
303
|
+
#endif
|
|
304
|
+
double longitude = [(NSNumber *)arg1 doubleValue];
|
|
305
|
+
|
|
306
|
+
[componentView setCoordinates:latitude longitude:longitude];
|
|
307
|
+
return;
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
if ([commandName isEqualToString:@"showCallout"]) {
|
|
311
|
+
#if RCT_DEBUG
|
|
312
|
+
if ([args count] != 0) {
|
|
313
|
+
RCTLogError(@"%@ command %@ received %d arguments, expected %d.", @"RNMapsGoogleMarker", commandName, (int)[args count], 0);
|
|
314
|
+
return;
|
|
315
|
+
}
|
|
316
|
+
#endif
|
|
317
|
+
|
|
318
|
+
|
|
319
|
+
|
|
320
|
+
[componentView showCallout];
|
|
321
|
+
return;
|
|
322
|
+
}
|
|
323
|
+
|
|
324
|
+
if ([commandName isEqualToString:@"hideCallout"]) {
|
|
325
|
+
#if RCT_DEBUG
|
|
326
|
+
if ([args count] != 0) {
|
|
327
|
+
RCTLogError(@"%@ command %@ received %d arguments, expected %d.", @"RNMapsGoogleMarker", commandName, (int)[args count], 0);
|
|
328
|
+
return;
|
|
329
|
+
}
|
|
330
|
+
#endif
|
|
331
|
+
|
|
332
|
+
|
|
333
|
+
|
|
334
|
+
[componentView hideCallout];
|
|
335
|
+
return;
|
|
336
|
+
}
|
|
337
|
+
|
|
338
|
+
if ([commandName isEqualToString:@"redrawCallout"]) {
|
|
339
|
+
#if RCT_DEBUG
|
|
340
|
+
if ([args count] != 0) {
|
|
341
|
+
RCTLogError(@"%@ command %@ received %d arguments, expected %d.", @"RNMapsGoogleMarker", commandName, (int)[args count], 0);
|
|
342
|
+
return;
|
|
343
|
+
}
|
|
344
|
+
#endif
|
|
345
|
+
|
|
346
|
+
|
|
347
|
+
|
|
348
|
+
[componentView redrawCallout];
|
|
349
|
+
return;
|
|
350
|
+
}
|
|
351
|
+
|
|
352
|
+
if ([commandName isEqualToString:@"redraw"]) {
|
|
353
|
+
#if RCT_DEBUG
|
|
354
|
+
if ([args count] != 0) {
|
|
355
|
+
RCTLogError(@"%@ command %@ received %d arguments, expected %d.", @"RNMapsGoogleMarker", commandName, (int)[args count], 0);
|
|
356
|
+
return;
|
|
357
|
+
}
|
|
358
|
+
#endif
|
|
359
|
+
|
|
360
|
+
|
|
361
|
+
|
|
362
|
+
[componentView redraw];
|
|
363
|
+
return;
|
|
364
|
+
}
|
|
365
|
+
|
|
366
|
+
#if RCT_DEBUG
|
|
367
|
+
RCTLogError(@"%@ received command %@, which is not a supported command.", @"RNMapsGoogleMarker", commandName);
|
|
368
|
+
#endif
|
|
369
|
+
}
|
|
370
|
+
|
|
232
371
|
@protocol RCTRNMapsGooglePolygonViewProtocol <NSObject>
|
|
233
372
|
|
|
234
373
|
@end
|
|
@@ -588,4 +727,8 @@ if ([commandName isEqualToString:@"redraw"]) {
|
|
|
588
727
|
#endif
|
|
589
728
|
}
|
|
590
729
|
|
|
730
|
+
@protocol RCTRNMapsPolygonViewProtocol <NSObject>
|
|
731
|
+
|
|
732
|
+
@end
|
|
733
|
+
|
|
591
734
|
NS_ASSUME_NONNULL_END
|
|
@@ -15,10 +15,12 @@ namespace facebook::react {
|
|
|
15
15
|
extern const char RNMapsCalloutComponentName[] = "RNMapsCallout";
|
|
16
16
|
extern const char RNMapsCircleComponentName[] = "RNMapsCircle";
|
|
17
17
|
extern const char RNMapsGoogleMapViewComponentName[] = "RNMapsGoogleMapView";
|
|
18
|
+
extern const char RNMapsGoogleMarkerComponentName[] = "RNMapsGoogleMarker";
|
|
18
19
|
extern const char RNMapsGooglePolygonComponentName[] = "RNMapsGooglePolygon";
|
|
19
20
|
extern const char RNMapsMapViewComponentName[] = "RNMapsMapView";
|
|
20
21
|
extern const char RNMapsMarkerComponentName[] = "RNMapsMarker";
|
|
21
22
|
extern const char RNMapsOverlayComponentName[] = "RNMapsOverlay";
|
|
23
|
+
extern const char RNMapsPolygonComponentName[] = "RNMapsPolygon";
|
|
22
24
|
extern const char RNMapsPolylineComponentName[] = "RNMapsPolyline";
|
|
23
25
|
extern const char RNMapsUrlTileComponentName[] = "RNMapsUrlTile";
|
|
24
26
|
extern const char RNMapsWMSTileComponentName[] = "RNMapsWMSTile";
|
|
@@ -51,6 +51,17 @@ using RNMapsGoogleMapViewShadowNode = ConcreteViewShadowNode<
|
|
|
51
51
|
RNMapsGoogleMapViewEventEmitter,
|
|
52
52
|
RNMapsGoogleMapViewState>;
|
|
53
53
|
|
|
54
|
+
JSI_EXPORT extern const char RNMapsGoogleMarkerComponentName[];
|
|
55
|
+
|
|
56
|
+
/*
|
|
57
|
+
* `ShadowNode` for <RNMapsGoogleMarker> component.
|
|
58
|
+
*/
|
|
59
|
+
using RNMapsGoogleMarkerShadowNode = ConcreteViewShadowNode<
|
|
60
|
+
RNMapsGoogleMarkerComponentName,
|
|
61
|
+
RNMapsGoogleMarkerProps,
|
|
62
|
+
RNMapsGoogleMarkerEventEmitter,
|
|
63
|
+
RNMapsGoogleMarkerState>;
|
|
64
|
+
|
|
54
65
|
JSI_EXPORT extern const char RNMapsGooglePolygonComponentName[];
|
|
55
66
|
|
|
56
67
|
/*
|
|
@@ -95,6 +106,17 @@ using RNMapsOverlayShadowNode = ConcreteViewShadowNode<
|
|
|
95
106
|
RNMapsOverlayEventEmitter,
|
|
96
107
|
RNMapsOverlayState>;
|
|
97
108
|
|
|
109
|
+
JSI_EXPORT extern const char RNMapsPolygonComponentName[];
|
|
110
|
+
|
|
111
|
+
/*
|
|
112
|
+
* `ShadowNode` for <RNMapsPolygon> component.
|
|
113
|
+
*/
|
|
114
|
+
using RNMapsPolygonShadowNode = ConcreteViewShadowNode<
|
|
115
|
+
RNMapsPolygonComponentName,
|
|
116
|
+
RNMapsPolygonProps,
|
|
117
|
+
RNMapsPolygonEventEmitter,
|
|
118
|
+
RNMapsPolygonState>;
|
|
119
|
+
|
|
98
120
|
JSI_EXPORT extern const char RNMapsPolylineComponentName[];
|
|
99
121
|
|
|
100
122
|
/*
|
|
@@ -21,6 +21,8 @@ using RNMapsCircleState = StateData;
|
|
|
21
21
|
|
|
22
22
|
using RNMapsGoogleMapViewState = StateData;
|
|
23
23
|
|
|
24
|
+
using RNMapsGoogleMarkerState = StateData;
|
|
25
|
+
|
|
24
26
|
using RNMapsGooglePolygonState = StateData;
|
|
25
27
|
|
|
26
28
|
using RNMapsMapViewState = StateData;
|
|
@@ -29,6 +31,8 @@ using RNMapsMarkerState = StateData;
|
|
|
29
31
|
|
|
30
32
|
using RNMapsOverlayState = StateData;
|
|
31
33
|
|
|
34
|
+
using RNMapsPolygonState = StateData;
|
|
35
|
+
|
|
32
36
|
using RNMapsPolylineState = StateData;
|
|
33
37
|
|
|
34
38
|
using RNMapsUrlTileState = StateData;
|
package/package.json
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
"types": "dist/src/index.d.ts",
|
|
8
8
|
"author": "Leland Richardson <leland.m.richardson@gmail.com>",
|
|
9
9
|
"homepage": "https://github.com/react-native-maps/react-native-maps#readme",
|
|
10
|
-
"version": "1.
|
|
10
|
+
"version": "1.29.1",
|
|
11
11
|
"license": "MIT",
|
|
12
12
|
"scripts": {
|
|
13
13
|
"lint": "eslint . --max-warnings 0",
|
|
@@ -117,8 +117,10 @@
|
|
|
117
117
|
"componentProvider": {
|
|
118
118
|
"RNMapsGoogleMapView": "RNMapsGoogleMapView",
|
|
119
119
|
"RNMapsGooglePolygon": "RNMapsGooglePolygonView",
|
|
120
|
+
"RNMapsGoogleMarker": "RNMapsGoogleMarkerView",
|
|
120
121
|
"RNMapsMapView": "RNMapsMapView",
|
|
121
|
-
"RNMapsMarker": "RNMapsMarkerView"
|
|
122
|
+
"RNMapsMarker": "RNMapsMarkerView",
|
|
123
|
+
"RNMapsPolygon": "RNMapsPolygonView"
|
|
122
124
|
}
|
|
123
125
|
}
|
|
124
126
|
},
|
package/src/MapMarker.tsx
CHANGED
|
@@ -12,6 +12,7 @@ import decorateMapComponent, {
|
|
|
12
12
|
ProviderContext,
|
|
13
13
|
SUPPORTED,
|
|
14
14
|
USES_DEFAULT_IMPLEMENTATION,
|
|
15
|
+
googleMapIsInstalled,
|
|
15
16
|
type MapManagerCommand,
|
|
16
17
|
type NativeComponent,
|
|
17
18
|
type UIManagerCommand,
|
|
@@ -481,9 +482,9 @@ export class MapMarker extends React.Component<MapMarkerProps> {
|
|
|
481
482
|
const {stopPropagation = false} = this.props;
|
|
482
483
|
if (this.fabricMarker === undefined) {
|
|
483
484
|
const provider = this.context;
|
|
484
|
-
this.fabricMarker =
|
|
485
|
-
Platform.OS === 'ios' && provider === PROVIDER_GOOGLE
|
|
486
|
-
|
|
485
|
+
this.fabricMarker =
|
|
486
|
+
!(Platform.OS === 'ios' && provider === PROVIDER_GOOGLE) ||
|
|
487
|
+
googleMapIsInstalled;
|
|
487
488
|
}
|
|
488
489
|
|
|
489
490
|
let icon: any = this.props.icon;
|
|
@@ -21,7 +21,9 @@ import {MapUrlTile} from './MapUrlTile';
|
|
|
21
21
|
import {MapWMSTile} from './MapWMSTile';
|
|
22
22
|
import {Commands} from './MapViewNativeComponent';
|
|
23
23
|
import GooglePolygon from './specs/NativeComponentGooglePolygon';
|
|
24
|
+
import ApplePolygon from './specs/NativeComponentPolygon';
|
|
24
25
|
import FabricMarker from './specs/NativeComponentMarker';
|
|
26
|
+
import FabricGoogleMarker from './specs/NativeComponentGoogleMarker';
|
|
25
27
|
import FabricUrlTile from './specs/NativeComponentUrlTile';
|
|
26
28
|
import FabricWMSTile from './specs/NativeComponentWMSTile';
|
|
27
29
|
import FabricCallout from './specs/NativeComponentCallout';
|
|
@@ -79,22 +81,34 @@ export default function decorateMapComponent<Type extends Component>(
|
|
|
79
81
|
Component.prototype.getNativeComponent =
|
|
80
82
|
function getNativeComponent(): NativeComponent {
|
|
81
83
|
const provider = this.context;
|
|
82
|
-
if (
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
84
|
+
if (componentName === 'Marker') {
|
|
85
|
+
if (Platform.OS === 'ios' && provider === PROVIDER_GOOGLE) {
|
|
86
|
+
if (googleMapIsInstalled) {
|
|
87
|
+
// @ts-ignore
|
|
88
|
+
return FabricGoogleMarker;
|
|
89
|
+
}
|
|
90
|
+
} else {
|
|
91
|
+
// @ts-ignore
|
|
92
|
+
return FabricMarker;
|
|
93
|
+
}
|
|
88
94
|
}
|
|
89
|
-
if (
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
95
|
+
if (componentName === 'Polygon') {
|
|
96
|
+
if (Platform.OS === 'android') {
|
|
97
|
+
// @ts-ignore
|
|
98
|
+
return GooglePolygon;
|
|
99
|
+
}
|
|
100
|
+
if (Platform.OS === 'ios') {
|
|
101
|
+
if (provider === PROVIDER_GOOGLE) {
|
|
102
|
+
if (googleMapIsInstalled) {
|
|
103
|
+
// @ts-ignore
|
|
104
|
+
return GooglePolygon;
|
|
105
|
+
}
|
|
106
|
+
// Google Maps not installed: fall through to provider resolution below.
|
|
107
|
+
} else {
|
|
108
|
+
// @ts-ignore
|
|
109
|
+
return ApplePolygon;
|
|
110
|
+
}
|
|
111
|
+
}
|
|
98
112
|
}
|
|
99
113
|
if (Platform.OS === 'android') {
|
|
100
114
|
if (componentName === 'Callout') {
|
|
@@ -0,0 +1,327 @@
|
|
|
1
|
+
// @ts-nocheck
|
|
2
|
+
import type {HostComponent} from 'react-native';
|
|
3
|
+
import type {
|
|
4
|
+
ViewProps,
|
|
5
|
+
ColorValue,
|
|
6
|
+
ImageSourcePropType as ImageSource,
|
|
7
|
+
} from 'react-native';
|
|
8
|
+
|
|
9
|
+
import {codegenNativeComponent, codegenNativeCommands} from 'react-native';
|
|
10
|
+
import type {
|
|
11
|
+
Int32,
|
|
12
|
+
Double,
|
|
13
|
+
Float,
|
|
14
|
+
BubblingEventHandler,
|
|
15
|
+
DirectEventHandler,
|
|
16
|
+
WithDefault,
|
|
17
|
+
} from 'react-native/Libraries/Types/CodegenTypes';
|
|
18
|
+
|
|
19
|
+
export type LatLng = Readonly<{
|
|
20
|
+
latitude: Double; // Non-nullable Double for latitude
|
|
21
|
+
longitude: Double; // Non-nullable Double for longitude
|
|
22
|
+
}>;
|
|
23
|
+
|
|
24
|
+
export type MarkerPressEventHandler = BubblingEventHandler<
|
|
25
|
+
Readonly<{
|
|
26
|
+
action: string;
|
|
27
|
+
id?: string;
|
|
28
|
+
coordinate?: {
|
|
29
|
+
latitude: Double; // Inlined LatLng
|
|
30
|
+
longitude: Double;
|
|
31
|
+
};
|
|
32
|
+
position?: {
|
|
33
|
+
x: Double;
|
|
34
|
+
y: Double;
|
|
35
|
+
};
|
|
36
|
+
}>
|
|
37
|
+
>;
|
|
38
|
+
|
|
39
|
+
export type MarkerDragEventHandler = DirectEventHandler<
|
|
40
|
+
Readonly<{
|
|
41
|
+
id?: string;
|
|
42
|
+
coordinate?: {
|
|
43
|
+
latitude: Double; // Inlined LatLng
|
|
44
|
+
longitude: Double;
|
|
45
|
+
};
|
|
46
|
+
position?: {
|
|
47
|
+
x: Double;
|
|
48
|
+
y: Double;
|
|
49
|
+
};
|
|
50
|
+
}>
|
|
51
|
+
>;
|
|
52
|
+
|
|
53
|
+
export type MarkerSelectEventHandler = DirectEventHandler<
|
|
54
|
+
Readonly<{
|
|
55
|
+
action?: string;
|
|
56
|
+
id?: string;
|
|
57
|
+
coordinate?: {
|
|
58
|
+
latitude: Double; // Inlined LatLng
|
|
59
|
+
longitude: Double;
|
|
60
|
+
};
|
|
61
|
+
position?: {
|
|
62
|
+
x: Double;
|
|
63
|
+
y: Double;
|
|
64
|
+
};
|
|
65
|
+
}>
|
|
66
|
+
>;
|
|
67
|
+
|
|
68
|
+
export type CalloutPressEventHandler = BubblingEventHandler<
|
|
69
|
+
Readonly<{
|
|
70
|
+
action: string;
|
|
71
|
+
id?: string;
|
|
72
|
+
frame?: {
|
|
73
|
+
x: Double; // Inlined LatLng
|
|
74
|
+
y: Double;
|
|
75
|
+
width: Double; // Inlined LatLng
|
|
76
|
+
height: Double;
|
|
77
|
+
};
|
|
78
|
+
point?: {
|
|
79
|
+
x: Double;
|
|
80
|
+
y: Double;
|
|
81
|
+
};
|
|
82
|
+
}>
|
|
83
|
+
>;
|
|
84
|
+
|
|
85
|
+
export type Point = Readonly<{
|
|
86
|
+
x: Double; // Non-nullable Double for x
|
|
87
|
+
y: Double; // Non-nullable Double for y
|
|
88
|
+
}>;
|
|
89
|
+
|
|
90
|
+
export interface GoogleMarkerFabricNativeProps extends ViewProps {
|
|
91
|
+
/**
|
|
92
|
+
* Sets the anchor point for the marker.
|
|
93
|
+
* The anchor specifies the point in the icon image that is anchored to the
|
|
94
|
+
* marker's position on the Earth's surface.
|
|
95
|
+
*
|
|
96
|
+
* @default {x: 0.5, y: 1.0}
|
|
97
|
+
* @platform iOS: Google Maps only
|
|
98
|
+
* @platform Android: Supported
|
|
99
|
+
*/
|
|
100
|
+
anchor?: Point;
|
|
101
|
+
|
|
102
|
+
/**
|
|
103
|
+
* Specifies the point in the marker image at which to anchor the callout when
|
|
104
|
+
* it is displayed.
|
|
105
|
+
*
|
|
106
|
+
* @default {x: 0.5, y: 0.0}
|
|
107
|
+
* @platform iOS: Google Maps only
|
|
108
|
+
* @platform Android: Supported
|
|
109
|
+
*/
|
|
110
|
+
calloutAnchor?: Point;
|
|
111
|
+
|
|
112
|
+
/**
|
|
113
|
+
* A custom image to be used as the marker's icon. Only local image resources
|
|
114
|
+
* are allowed to be used.
|
|
115
|
+
*
|
|
116
|
+
* @platform iOS: Supported
|
|
117
|
+
* @platform Android: Supported
|
|
118
|
+
*/
|
|
119
|
+
image?: ImageSource | null;
|
|
120
|
+
|
|
121
|
+
/**
|
|
122
|
+
* A custom image to be used as the marker's icon (Google Maps icon source).
|
|
123
|
+
*
|
|
124
|
+
* @platform iOS: Google Maps only
|
|
125
|
+
* @platform Android: Supported
|
|
126
|
+
*/
|
|
127
|
+
icon?: ImageSource | null;
|
|
128
|
+
|
|
129
|
+
/**
|
|
130
|
+
* The coordinate for the marker.
|
|
131
|
+
*
|
|
132
|
+
* @platform iOS: Supported
|
|
133
|
+
* @platform Android: Supported
|
|
134
|
+
*/
|
|
135
|
+
coordinate: LatLng;
|
|
136
|
+
|
|
137
|
+
/**
|
|
138
|
+
* The description of the marker, shown in the default callout.
|
|
139
|
+
*
|
|
140
|
+
* @platform iOS: Supported
|
|
141
|
+
* @platform Android: Supported
|
|
142
|
+
*/
|
|
143
|
+
description?: string;
|
|
144
|
+
|
|
145
|
+
/**
|
|
146
|
+
* if `true` allows the marker to be draggable (re-positioned).
|
|
147
|
+
*
|
|
148
|
+
* @default false
|
|
149
|
+
* @platform iOS: Supported
|
|
150
|
+
* @platform Android: Supported
|
|
151
|
+
*/
|
|
152
|
+
draggable?: boolean;
|
|
153
|
+
|
|
154
|
+
/**
|
|
155
|
+
* The title of the marker, shown in the default callout.
|
|
156
|
+
*
|
|
157
|
+
* @platform iOS: Supported
|
|
158
|
+
* @platform Android: Supported
|
|
159
|
+
*/
|
|
160
|
+
title?: string;
|
|
161
|
+
|
|
162
|
+
/**
|
|
163
|
+
* Sets whether this marker should track view changes.
|
|
164
|
+
* Turn it off whenever possible to improve custom marker performance.
|
|
165
|
+
*
|
|
166
|
+
* @default true
|
|
167
|
+
* @platform iOS: Google Maps only
|
|
168
|
+
* @platform Android: Supported
|
|
169
|
+
*/
|
|
170
|
+
tracksViewChanges?: WithDefault<boolean, true>;
|
|
171
|
+
|
|
172
|
+
/**
|
|
173
|
+
* Sets whether this marker's info window should track view changes.
|
|
174
|
+
*
|
|
175
|
+
* @default false
|
|
176
|
+
* @platform iOS: Google Maps only
|
|
177
|
+
* @platform Android: Not supported
|
|
178
|
+
*/
|
|
179
|
+
tracksInfoWindowChanges?: WithDefault<boolean, false>;
|
|
180
|
+
|
|
181
|
+
/**
|
|
182
|
+
* Sets whether this marker should be flat against the map (true) or a
|
|
183
|
+
* billboard facing the camera (false).
|
|
184
|
+
*
|
|
185
|
+
* @default false
|
|
186
|
+
* @platform iOS: Google Maps only
|
|
187
|
+
* @platform Android: Supported
|
|
188
|
+
*/
|
|
189
|
+
flat?: WithDefault<boolean, false>;
|
|
190
|
+
|
|
191
|
+
/**
|
|
192
|
+
* The rotation of the marker in degrees clockwise from the default position.
|
|
193
|
+
*
|
|
194
|
+
* @default 0
|
|
195
|
+
* @platform iOS: Google Maps only
|
|
196
|
+
* @platform Android: Supported
|
|
197
|
+
*/
|
|
198
|
+
rotation?: WithDefault<Float, 0>;
|
|
199
|
+
|
|
200
|
+
/**
|
|
201
|
+
* A string that can be used to identify this marker.
|
|
202
|
+
*
|
|
203
|
+
* @platform iOS: Supported
|
|
204
|
+
* @platform Android: Supported
|
|
205
|
+
*/
|
|
206
|
+
identifier?: string;
|
|
207
|
+
|
|
208
|
+
/**
|
|
209
|
+
* Whether the marker is tappable.
|
|
210
|
+
*
|
|
211
|
+
* @default true
|
|
212
|
+
* @platform iOS: Google Maps only
|
|
213
|
+
* @platform Android: Supported
|
|
214
|
+
*/
|
|
215
|
+
tappable?: WithDefault<boolean, true>;
|
|
216
|
+
|
|
217
|
+
/**
|
|
218
|
+
* Callback that is called when the user taps the callout view.
|
|
219
|
+
*
|
|
220
|
+
* @platform iOS: Google Maps only
|
|
221
|
+
* @platform Android: Supported
|
|
222
|
+
*/
|
|
223
|
+
onCalloutPress?: CalloutPressEventHandler;
|
|
224
|
+
|
|
225
|
+
/**
|
|
226
|
+
* Callback called continuously as the marker is dragged.
|
|
227
|
+
*
|
|
228
|
+
* @platform iOS: Google Maps only
|
|
229
|
+
* @platform Android: Supported
|
|
230
|
+
*/
|
|
231
|
+
onDrag?: MarkerDragEventHandler;
|
|
232
|
+
|
|
233
|
+
/**
|
|
234
|
+
* Callback that is called when a drag on the marker finishes.
|
|
235
|
+
*
|
|
236
|
+
* @platform iOS: Google Maps only
|
|
237
|
+
* @platform Android: Supported
|
|
238
|
+
*/
|
|
239
|
+
onDragEnd?: MarkerDragEventHandler;
|
|
240
|
+
|
|
241
|
+
/**
|
|
242
|
+
* Callback that is called when the user initiates a drag on the marker.
|
|
243
|
+
*
|
|
244
|
+
* @platform iOS: Google Maps only
|
|
245
|
+
* @platform Android: Supported
|
|
246
|
+
*/
|
|
247
|
+
onDragStart?: MarkerDragEventHandler;
|
|
248
|
+
|
|
249
|
+
/**
|
|
250
|
+
* Callback that is called when the marker is tapped by the user.
|
|
251
|
+
*
|
|
252
|
+
* @platform iOS: Supported
|
|
253
|
+
* @platform Android: Supported
|
|
254
|
+
*/
|
|
255
|
+
onPress?: MarkerPressEventHandler;
|
|
256
|
+
|
|
257
|
+
/**
|
|
258
|
+
* Callback that is called when the marker becomes selected.
|
|
259
|
+
*
|
|
260
|
+
* @platform iOS: Google Maps only
|
|
261
|
+
* @platform Android: Supported
|
|
262
|
+
*/
|
|
263
|
+
onSelect?: MarkerSelectEventHandler;
|
|
264
|
+
|
|
265
|
+
/**
|
|
266
|
+
* Callback that is called when the marker is deselected.
|
|
267
|
+
*
|
|
268
|
+
* @platform iOS: Google Maps only
|
|
269
|
+
* @platform Android: Supported
|
|
270
|
+
*/
|
|
271
|
+
onDeselect?: MarkerSelectEventHandler;
|
|
272
|
+
|
|
273
|
+
/**
|
|
274
|
+
* The marker's opacity between 0.0 and 1.0.
|
|
275
|
+
*
|
|
276
|
+
* @default 1.0
|
|
277
|
+
* @platform iOS: Supported
|
|
278
|
+
* @platform Android: Supported
|
|
279
|
+
*/
|
|
280
|
+
opacity?: WithDefault<Double, 1.0>;
|
|
281
|
+
|
|
282
|
+
/**
|
|
283
|
+
* If no custom marker view or custom image is provided, the platform default
|
|
284
|
+
* pin will be used, which can be customized by this color.
|
|
285
|
+
*
|
|
286
|
+
* @platform iOS: Supported
|
|
287
|
+
* @platform Android: Supported
|
|
288
|
+
*/
|
|
289
|
+
pinColor?: ColorValue;
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
export interface NativeCommands {
|
|
293
|
+
animateToCoordinates: (
|
|
294
|
+
viewRef: React.ElementRef<React.ComponentType>,
|
|
295
|
+
latitude: Double,
|
|
296
|
+
longitude: Double,
|
|
297
|
+
duration: Int32,
|
|
298
|
+
) => void;
|
|
299
|
+
setCoordinates: (
|
|
300
|
+
viewRef: React.ElementRef<React.ComponentType>,
|
|
301
|
+
latitude: Double,
|
|
302
|
+
longitude: Double,
|
|
303
|
+
) => void;
|
|
304
|
+
showCallout: (viewRef: React.ElementRef<React.ComponentType>) => void;
|
|
305
|
+
hideCallout: (viewRef: React.ElementRef<React.ComponentType>) => void;
|
|
306
|
+
redrawCallout: (viewRef: React.ElementRef<React.ComponentType>) => void;
|
|
307
|
+
redraw: (viewRef: React.ElementRef<React.ComponentType>) => void;
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
export const Commands: NativeCommands = codegenNativeCommands<NativeCommands>({
|
|
311
|
+
supportedCommands: [
|
|
312
|
+
'setCoordinates',
|
|
313
|
+
'animateToCoordinates',
|
|
314
|
+
'showCallout',
|
|
315
|
+
'hideCallout',
|
|
316
|
+
'redrawCallout',
|
|
317
|
+
'redraw',
|
|
318
|
+
],
|
|
319
|
+
});
|
|
320
|
+
|
|
321
|
+
export default codegenNativeComponent<GoogleMarkerFabricNativeProps>(
|
|
322
|
+
'RNMapsGoogleMarker',
|
|
323
|
+
{
|
|
324
|
+
// iOS-only: on Android, markers use the shared `RNMapsMarker` component.
|
|
325
|
+
excludedPlatforms: ['android'],
|
|
326
|
+
},
|
|
327
|
+
) as HostComponent<GoogleMarkerFabricNativeProps>;
|