react-native-maps 1.21.0-alpha.99 → 1.21.0
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/README.md +9 -4
- package/android/build.gradle +65 -72
- package/android/gradle/wrapper/gradle-wrapper.properties +1 -1
- package/android/src/main/RCTAppDependencyProvider.h +25 -0
- package/android/src/main/RCTAppDependencyProvider.mm +55 -0
- package/android/src/main/RCTModulesConformingToProtocolsProvider.h +18 -0
- package/android/src/main/RCTModulesConformingToProtocolsProvider.mm +33 -0
- package/android/src/main/RCTThirdPartyComponentsProvider.h +16 -0
- package/android/src/main/RCTThirdPartyComponentsProvider.mm +28 -0
- package/android/src/main/ReactAppDependencyProvider.podspec +34 -0
- package/android/src/main/java/com/facebook/fbreact/specs/NativeAirMapsModuleSpec.java +63 -0
- package/android/src/main/java/com/facebook/react/viewmanagers/RNMapsCalloutManagerDelegate.java +35 -0
- package/android/src/main/java/com/facebook/react/viewmanagers/RNMapsCalloutManagerInterface.java +17 -0
- package/android/src/main/java/com/facebook/react/viewmanagers/RNMapsCircleManagerDelegate.java +49 -0
- package/android/src/main/java/com/facebook/react/viewmanagers/RNMapsCircleManagerInterface.java +23 -0
- package/android/src/main/java/com/facebook/react/viewmanagers/RNMapsGooglePolygonManagerDelegate.java +49 -0
- package/android/src/main/java/com/facebook/react/viewmanagers/RNMapsGooglePolygonManagerInterface.java +23 -0
- package/android/src/main/java/com/facebook/react/viewmanagers/RNMapsMapViewManagerDelegate.java +209 -0
- package/android/src/main/java/com/facebook/react/viewmanagers/RNMapsMapViewManagerInterface.java +74 -0
- package/android/src/main/java/com/facebook/react/viewmanagers/RNMapsMarkerManagerDelegate.java +104 -0
- package/android/src/main/java/com/facebook/react/viewmanagers/RNMapsMarkerManagerInterface.java +39 -0
- package/android/src/main/java/com/facebook/react/viewmanagers/RNMapsOverlayManagerDelegate.java +45 -0
- package/android/src/main/java/com/facebook/react/viewmanagers/RNMapsOverlayManagerInterface.java +22 -0
- package/android/src/main/java/com/facebook/react/viewmanagers/RNMapsPolylineManagerDelegate.java +58 -0
- package/android/src/main/java/com/facebook/react/viewmanagers/RNMapsPolylineManagerInterface.java +26 -0
- package/android/src/main/java/com/facebook/react/viewmanagers/RNMapsUrlTileManagerDelegate.java +62 -0
- package/android/src/main/java/com/facebook/react/viewmanagers/RNMapsUrlTileManagerInterface.java +27 -0
- package/android/src/main/java/com/facebook/react/viewmanagers/RNMapsWMSTileManagerDelegate.java +56 -0
- package/android/src/main/java/com/facebook/react/viewmanagers/RNMapsWMSTileManagerInterface.java +25 -0
- package/android/src/main/java/com/rnmaps/fabric/MapViewManager.java +5 -1
- package/android/src/main/java/com/rnmaps/fabric/NativeAirMapsModule.java +1 -1
- package/android/src/main/java/com/rnmaps/fabric/OverlayManager.java +9 -3
- package/android/src/main/java/com/rnmaps/fabric/UrlTileManager.java +124 -0
- package/android/src/main/java/com/rnmaps/fabric/WMSTileManager.java +114 -0
- package/android/src/main/java/com/rnmaps/maps/MapAirModulePackage.java +19 -3
- package/android/src/main/java/com/rnmaps/maps/MapMarker.java +608 -603
- package/android/src/main/java/com/rnmaps/maps/MapMarkerManager.java +3 -3
- package/android/src/main/java/com/rnmaps/maps/MapOverlay.java +2 -22
- package/android/src/main/java/com/rnmaps/maps/MapOverlayManager.java +23 -1
- package/android/src/main/java/com/rnmaps/maps/MapUrlTile.java +18 -18
- package/android/src/main/java/com/rnmaps/maps/MapUrlTileManager.java +10 -14
- package/android/src/main/java/com/rnmaps/maps/MapView.java +58 -49
- package/android/src/main/java/com/rnmaps/maps/MapWMSTile.java +3 -3
- package/android/src/main/java/com/rnmaps/maps/MapWMSTileManager.java +10 -10
- package/android/src/main/jni/CMakeLists.txt +36 -0
- package/android/src/main/jni/RNMapsSpecs-generated.cpp +68 -0
- package/android/src/main/jni/RNMapsSpecs.h +31 -0
- package/android/src/main/jni/react/renderer/components/RNMapsSpecs/ComponentDescriptors.cpp +31 -0
- package/android/src/main/jni/react/renderer/components/RNMapsSpecs/ComponentDescriptors.h +33 -0
- package/android/src/main/jni/react/renderer/components/RNMapsSpecs/EventEmitters.cpp +979 -0
- package/android/src/main/jni/react/renderer/components/RNMapsSpecs/EventEmitters.h +860 -0
- package/android/src/main/jni/react/renderer/components/RNMapsSpecs/Props.cpp +227 -0
- package/android/src/main/jni/react/renderer/components/RNMapsSpecs/Props.h +1297 -0
- package/android/src/main/jni/react/renderer/components/RNMapsSpecs/RNMapsSpecsJSI-generated.cpp +74 -0
- package/android/src/main/jni/react/renderer/components/RNMapsSpecs/RNMapsSpecsJSI.h +268 -0
- package/android/src/main/jni/react/renderer/components/RNMapsSpecs/ShadowNodes.cpp +26 -0
- package/android/src/main/jni/react/renderer/components/RNMapsSpecs/ShadowNodes.h +131 -0
- package/android/src/main/jni/react/renderer/components/RNMapsSpecs/States.cpp +16 -0
- package/android/src/main/jni/react/renderer/components/RNMapsSpecs/States.h +137 -0
- package/ios/AirGoogleMaps/AIRGoogleMap.h +13 -13
- package/ios/AirGoogleMaps/{AIRGoogleMap.m → AIRGoogleMap.mm} +32 -34
- package/ios/AirGoogleMaps/AIRGoogleMapManager.h +1 -0
- package/ios/AirGoogleMaps/AIRGoogleMapManager.mm +543 -0
- package/ios/AirGoogleMaps/AIRGoogleMapMarker.m +3 -3
- package/ios/AirGoogleMaps/AIRGoogleMapMarkerManager.m +1 -1
- package/ios/AirGoogleMaps/AIRGoogleMapUrlTile.m +2 -2
- package/ios/AirGoogleMaps/AIRGoogleMapWMSTile.m +2 -2
- package/ios/AirGoogleMaps/RNMapsGoogleMapView.h +5 -2
- package/ios/AirGoogleMaps/RNMapsGoogleMapView.mm +41 -33
- package/ios/AirGoogleMaps/RNMapsGoogleMapViewManager.mm +16 -1
- package/ios/AirGoogleMaps/RNMapsGooglePolygonView.mm +23 -14
- package/ios/AirGoogleMaps/RNMapsGooglePolygonViewManager.mm +1 -0
- package/ios/AirMaps/AIRMap.h +8 -9
- package/ios/AirMaps/{AIRMap.m → AIRMap.mm} +18 -14
- package/ios/AirMaps/AIRMapManager.m +8 -19
- package/ios/AirMaps/AIRMapMarker.m +57 -44
- package/ios/AirMaps/AIRMapOverlay.m +2 -2
- package/ios/AirMaps/AIRMapWMSTile.m +8 -8
- package/ios/AirMaps/FabricPlaceholders/PlaceHolderGoogleMapView.h +25 -0
- package/ios/AirMaps/FabricPlaceholders/PlaceHolderGoogleMapView.mm +77 -0
- package/ios/AirMaps/FabricPlaceholders/PlaceHolderPolygonView.h +25 -0
- package/ios/AirMaps/FabricPlaceholders/PlaceHolderPolygonView.mm +51 -0
- package/ios/AirMaps/RNMapsAirModule.h +2 -3
- package/ios/AirMaps/RNMapsAirModule.mm +14 -0
- package/ios/AirMaps/RNMapsDefines.h +1 -0
- package/ios/AirMaps/RNMapsMapView.h +5 -2
- package/ios/AirMaps/RNMapsMapView.mm +16 -6
- package/ios/AirMaps/RNMapsMapViewManager.mm +19 -1
- package/ios/AirMaps/RNMapsMarkerView.mm +12 -4
- package/ios/AirMaps/RNMapsMarkerViewManager.mm +7 -0
- package/ios/AirMaps/module.modulemap +6 -0
- package/ios/AirMaps.xcodeproj/project.pbxproj +15 -55
- package/ios/generated/RCTAppDependencyProvider.h +25 -0
- package/ios/generated/RCTAppDependencyProvider.mm +55 -0
- package/ios/generated/RCTModulesConformingToProtocolsProvider.h +18 -0
- package/ios/generated/RCTModulesConformingToProtocolsProvider.mm +33 -0
- package/ios/generated/RCTThirdPartyComponentsProvider.h +16 -0
- package/ios/generated/RCTThirdPartyComponentsProvider.mm +26 -0
- package/ios/{AirMaps → generated}/RNMapsAirModuleDelegate.h +1 -1
- package/ios/generated/RNMapsSpecs/ComponentDescriptors.cpp +29 -0
- package/ios/generated/RNMapsSpecs/ComponentDescriptors.h +31 -0
- package/ios/generated/RNMapsSpecs/EventEmitters.cpp +977 -0
- package/ios/generated/RNMapsSpecs/EventEmitters.h +846 -0
- package/ios/generated/RNMapsSpecs/Props.cpp +194 -0
- package/ios/generated/RNMapsSpecs/Props.h +1224 -0
- package/ios/generated/RNMapsSpecs/RCTComponentViewHelpers.h +591 -0
- package/ios/generated/RNMapsSpecs/RNMapsSpecs-generated.mm +92 -0
- package/ios/generated/RNMapsSpecs/RNMapsSpecs.h +137 -0
- package/ios/generated/RNMapsSpecs/ShadowNodes.cpp +24 -0
- package/ios/generated/RNMapsSpecs/ShadowNodes.h +109 -0
- package/ios/generated/RNMapsSpecs/States.cpp +16 -0
- package/ios/generated/RNMapsSpecs/States.h +113 -0
- package/ios/generated/RNMapsSpecsJSI-generated.cpp +74 -0
- package/ios/generated/RNMapsSpecsJSI.h +268 -0
- package/ios/generated/ReactAppDependencyProvider.podspec +34 -0
- package/ios/generated/module.modulemap +15 -0
- package/package.json +30 -26
- package/react-native-google-maps.podspec +27 -0
- package/react-native-maps-generated.podspec +31 -0
- package/react-native-maps.podspec +52 -46
- package/react-native.config.js +16 -0
- package/src/AnimatedRegion.ts +169 -0
- package/src/Geojson.tsx +541 -0
- package/src/MapCallout.tsx +77 -0
- package/src/MapCalloutSubview.tsx +64 -0
- package/src/MapCircle.tsx +162 -0
- package/src/MapHeatmap.tsx +125 -0
- package/src/MapLocalTile.tsx +60 -0
- package/src/MapMarker.tsx +531 -0
- package/src/MapMarkerNativeComponent.ts +51 -0
- package/src/MapOverlay.tsx +178 -0
- package/src/MapPolygon.tsx +188 -0
- package/src/MapPolygon.types.ts +25 -0
- package/src/MapPolyline.tsx +215 -0
- package/src/MapUrlTile.tsx +169 -0
- package/src/MapView.tsx +1230 -0
- package/src/MapView.types.ts +212 -0
- package/src/MapView.web.ts +2 -0
- package/src/MapViewNativeComponent.ts +86 -0
- package/src/MapWMSTile.tsx +148 -0
- package/src/ProviderConstants.ts +2 -0
- package/src/createFabricMap.tsx +253 -0
- package/src/decorateMapComponent.ts +227 -0
- package/src/fixImageProp.ts +17 -0
- package/src/index.ts +52 -0
- package/src/sharedTypes.ts +101 -0
- package/{specs → src/specs}/NativeComponentCircle.ts +3 -4
- package/{specs → src/specs}/NativeComponentGoogleMapView.ts +15 -9
- package/{specs → src/specs}/NativeComponentMapView.ts +61 -32
- package/{specs → src/specs}/NativeComponentOverlay.ts +11 -2
- package/{specs → src/specs}/NativeComponentPolyline.ts +1 -1
- package/src/specs/NativeComponentUrlTile.ts +128 -0
- package/src/specs/NativeComponentWMSTile.ts +107 -0
- package/ios/AirGoogleMaps/AIRGoogleMapManager.m +0 -533
- package/lib/AnimatedRegion.d.ts +0 -19
- package/lib/AnimatedRegion.js +0 -134
- package/lib/Geojson.d.ts +0 -204
- package/lib/Geojson.js +0 -166
- package/lib/MapCallout.d.ts +0 -40
- package/lib/MapCallout.js +0 -51
- package/lib/MapCalloutSubview.d.ts +0 -34
- package/lib/MapCalloutSubview.js +0 -48
- package/lib/MapCircle.d.ts +0 -117
- package/lib/MapCircle.js +0 -53
- package/lib/MapHeatmap.d.ts +0 -78
- package/lib/MapHeatmap.js +0 -59
- package/lib/MapLocalTile.d.ts +0 -35
- package/lib/MapLocalTile.js +0 -44
- package/lib/MapMarker.d.ts +0 -322
- package/lib/MapMarker.js +0 -158
- package/lib/MapMarkerNativeComponent.d.ts +0 -15
- package/lib/MapMarkerNativeComponent.js +0 -15
- package/lib/MapOverlay.d.ts +0 -88
- package/lib/MapOverlay.js +0 -65
- package/lib/MapPolygon.d.ts +0 -140
- package/lib/MapPolygon.js +0 -53
- package/lib/MapPolygon.types.d.ts +0 -18
- package/lib/MapPolygon.types.js +0 -2
- package/lib/MapPolyline.d.ts +0 -156
- package/lib/MapPolyline.js +0 -53
- package/lib/MapUrlTile.d.ts +0 -134
- package/lib/MapUrlTile.js +0 -44
- package/lib/MapView.d.ts +0 -703
- package/lib/MapView.js +0 -427
- package/lib/MapView.types.d.ts +0 -161
- package/lib/MapView.types.js +0 -2
- package/lib/MapView.web.d.ts +0 -1
- package/lib/MapView.web.js +0 -9
- package/lib/MapViewNativeComponent.d.ts +0 -18
- package/lib/MapViewNativeComponent.js +0 -19
- package/lib/MapWMSTile.d.ts +0 -116
- package/lib/MapWMSTile.js +0 -44
- package/lib/ProviderConstants.d.ts +0 -2
- package/lib/ProviderConstants.js +0 -5
- package/lib/createFabricMap.d.ts +0 -24
- package/lib/createFabricMap.js +0 -188
- package/lib/decorateMapComponent.d.ts +0 -36
- package/lib/decorateMapComponent.js +0 -120
- package/lib/fixImageProp.d.ts +0 -4
- package/lib/fixImageProp.js +0 -16
- package/lib/index.d.ts +0 -38
- package/lib/index.js +0 -81
- package/lib/sharedTypes.d.ts +0 -81
- package/lib/sharedTypes.js +0 -2
- package/lib/sharedTypesInternal.js +0 -2
- package/lib/specs/NativeAirMapsModule.d.ts +0 -31
- package/lib/specs/NativeAirMapsModule.js +0 -4
- package/lib/specs/NativeComponentCallout.d.ts +0 -46
- package/lib/specs/NativeComponentCallout.js +0 -9
- package/lib/specs/NativeComponentCircle.d.ts +0 -74
- package/lib/specs/NativeComponentCircle.js +0 -7
- package/lib/specs/NativeComponentGoogleMapView.d.ts +0 -713
- package/lib/specs/NativeComponentGoogleMapView.js +0 -22
- package/lib/specs/NativeComponentGooglePolygon.d.ts +0 -75
- package/lib/specs/NativeComponentGooglePolygon.js +0 -7
- package/lib/specs/NativeComponentMapView.d.ts +0 -847
- package/lib/specs/NativeComponentMapView.js +0 -20
- package/lib/specs/NativeComponentMarker.d.ts +0 -258
- package/lib/specs/NativeComponentMarker.js +0 -19
- package/lib/specs/NativeComponentOverlay.d.ts +0 -67
- package/lib/specs/NativeComponentOverlay.js +0 -7
- package/lib/specs/NativeComponentPolyline.d.ts +0 -101
- package/lib/specs/NativeComponentPolyline.js +0 -7
- /package/ios/AirMaps/{UIView +AirMap.m → UIView+AirMap.m} +0 -0
- /package/ios/{AirMaps → generated}/RNMapsHostVewDelegate.h +0 -0
- /package/{lib/sharedTypesInternal.d.ts → src/sharedTypesInternal.ts} +0 -0
- /package/{specs → src/specs}/NativeAirMapsModule.ts +0 -0
- /package/{specs → src/specs}/NativeComponentCallout.ts +0 -0
- /package/{specs → src/specs}/NativeComponentGooglePolygon.ts +0 -0
- /package/{specs → src/specs}/NativeComponentMarker.ts +0 -0
|
@@ -0,0 +1,531 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import {
|
|
3
|
+
StyleSheet,
|
|
4
|
+
Animated,
|
|
5
|
+
ViewProps,
|
|
6
|
+
ImageURISource,
|
|
7
|
+
ImageRequireSource,
|
|
8
|
+
Platform,
|
|
9
|
+
} from 'react-native';
|
|
10
|
+
|
|
11
|
+
import decorateMapComponent, {
|
|
12
|
+
MapManagerCommand,
|
|
13
|
+
NativeComponent,
|
|
14
|
+
ProviderContext,
|
|
15
|
+
SUPPORTED,
|
|
16
|
+
UIManagerCommand,
|
|
17
|
+
USES_DEFAULT_IMPLEMENTATION,
|
|
18
|
+
} from './decorateMapComponent';
|
|
19
|
+
import {
|
|
20
|
+
Commands,
|
|
21
|
+
MapMarkerNativeComponentType,
|
|
22
|
+
} from './MapMarkerNativeComponent';
|
|
23
|
+
|
|
24
|
+
import {Commands as FabricCommands} from './specs/NativeComponentMarker';
|
|
25
|
+
import type {AppleMarkerPriority} from './specs/NativeComponentMarker';
|
|
26
|
+
|
|
27
|
+
import {
|
|
28
|
+
CalloutPressEvent,
|
|
29
|
+
LatLng,
|
|
30
|
+
MarkerDeselectEvent,
|
|
31
|
+
MarkerDragEvent,
|
|
32
|
+
MarkerDragStartEndEvent,
|
|
33
|
+
MarkerPressEvent,
|
|
34
|
+
MarkerSelectEvent,
|
|
35
|
+
Point,
|
|
36
|
+
} from './sharedTypes';
|
|
37
|
+
import {Modify} from './sharedTypesInternal';
|
|
38
|
+
|
|
39
|
+
import {PROVIDER_GOOGLE} from './ProviderConstants';
|
|
40
|
+
import {fixImageProp} from './fixImageProp';
|
|
41
|
+
|
|
42
|
+
type AppleMarkerVisibility = 'hidden' | 'adaptive' | 'visible';
|
|
43
|
+
|
|
44
|
+
export type MapMarkerProps = ViewProps & {
|
|
45
|
+
/**
|
|
46
|
+
* Sets the anchor point for the marker.
|
|
47
|
+
* The anchor specifies the point in the icon image that is anchored to the marker's position on the Earth's surface.
|
|
48
|
+
*
|
|
49
|
+
* The anchor point is specified in the continuous space [0.0, 1.0] x [0.0, 1.0],
|
|
50
|
+
* where (0, 0) is the top-left corner of the image, and (1, 1) is the bottom-right corner.
|
|
51
|
+
*
|
|
52
|
+
* 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.
|
|
53
|
+
* For example, in a 4 x 2 image, the anchor point (0.7, 0.6) resolves to the grid point at (3, 1).
|
|
54
|
+
*
|
|
55
|
+
* @default {x: 0.5, y: 1.0}
|
|
56
|
+
* @platform iOS: Google Maps only. For Apple Maps, see the `centerOffset` prop
|
|
57
|
+
* @platform Android: Supported
|
|
58
|
+
*/
|
|
59
|
+
anchor?: Point;
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* Specifies the point in the marker image at which to anchor the callout when it is displayed.
|
|
63
|
+
* This is specified in the same coordinate system as the anchor.
|
|
64
|
+
*
|
|
65
|
+
* See the `anchor` prop for more details.
|
|
66
|
+
*
|
|
67
|
+
* @default {x: 0.5, y: 0.0}
|
|
68
|
+
* @platform iOS: Google Maps only. For Apple Maps, see the `calloutOffset` prop
|
|
69
|
+
* @platform Android: Supported
|
|
70
|
+
*/
|
|
71
|
+
calloutAnchor?: Point;
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* The offset (in points) at which to place the callout bubble.
|
|
75
|
+
* When this property is set to (0, 0),
|
|
76
|
+
* the anchor point of the callout bubble is placed on the top-center point of the marker view’s frame.
|
|
77
|
+
*
|
|
78
|
+
* Specifying positive offset values moves the callout bubble down and to the right,
|
|
79
|
+
* while specifying negative values moves it up and to the left
|
|
80
|
+
*
|
|
81
|
+
* @default {x: 0.0, y: 0.0}
|
|
82
|
+
* @platform iOS: Apple Maps only. For Google Maps, see the `calloutAnchor` prop
|
|
83
|
+
* @platform Android: Not supported. see the `calloutAnchor` prop
|
|
84
|
+
*/
|
|
85
|
+
calloutOffset?: Point;
|
|
86
|
+
|
|
87
|
+
/**
|
|
88
|
+
* The offset (in points) at which to display the annotation view.
|
|
89
|
+
*
|
|
90
|
+
* By default, the center point of an annotation view is placed at the coordinate point of the associated annotation.
|
|
91
|
+
*
|
|
92
|
+
* Positive offset values move the annotation view down and to the right, while negative values move it up and to the left.
|
|
93
|
+
*
|
|
94
|
+
* @default {x: 0.0, y: 0.0}
|
|
95
|
+
* @platform iOS: Apple Maps only. For Google Maps, see the `anchor` prop
|
|
96
|
+
* @platform Android: Not supported. see the `anchor` prop
|
|
97
|
+
*/
|
|
98
|
+
centerOffset?: Point;
|
|
99
|
+
|
|
100
|
+
/**
|
|
101
|
+
* The coordinate for the marker.
|
|
102
|
+
*
|
|
103
|
+
* @platform iOS: Supported
|
|
104
|
+
* @platform Android: Supported
|
|
105
|
+
*/
|
|
106
|
+
coordinate: LatLng;
|
|
107
|
+
|
|
108
|
+
/**
|
|
109
|
+
* The description of the marker.
|
|
110
|
+
*
|
|
111
|
+
* This is only used if the <Marker /> component has no children that are a `<Callout />`,
|
|
112
|
+
* in which case the default callout behavior will be used,
|
|
113
|
+
* which will show both the `title` and the `description`, if provided.
|
|
114
|
+
*
|
|
115
|
+
* @platform iOS: Supported
|
|
116
|
+
* @platform Android: Supported
|
|
117
|
+
*/
|
|
118
|
+
description?: string;
|
|
119
|
+
|
|
120
|
+
/**
|
|
121
|
+
* if `true` allows the marker to be draggable (re-positioned).
|
|
122
|
+
*
|
|
123
|
+
* @default false
|
|
124
|
+
* @platform iOS: Supported
|
|
125
|
+
* @platform Android: Supported
|
|
126
|
+
*/
|
|
127
|
+
draggable?: boolean;
|
|
128
|
+
|
|
129
|
+
/**
|
|
130
|
+
* Sets whether this marker should be flat against the map true or a billboard facing the camera.
|
|
131
|
+
*
|
|
132
|
+
* @default false
|
|
133
|
+
* @platform iOS: Google Maps only
|
|
134
|
+
* @platform Android: Supported
|
|
135
|
+
*/
|
|
136
|
+
flat?: boolean;
|
|
137
|
+
|
|
138
|
+
/**
|
|
139
|
+
* Marker icon to render (equivalent to `icon` property of GMSMarker Class).
|
|
140
|
+
* Only local image resources are allowed to be used.
|
|
141
|
+
*
|
|
142
|
+
* @platform iOS: Google Maps only
|
|
143
|
+
* @platform Android: Supported
|
|
144
|
+
*/
|
|
145
|
+
icon?: ImageURISource | ImageRequireSource;
|
|
146
|
+
|
|
147
|
+
/**
|
|
148
|
+
* A string that can be used to identify this marker.
|
|
149
|
+
*
|
|
150
|
+
* @platform iOS: Supported
|
|
151
|
+
* @platform Android: Supported
|
|
152
|
+
*/
|
|
153
|
+
identifier?: string;
|
|
154
|
+
|
|
155
|
+
/**
|
|
156
|
+
* A custom image to be used as the marker's icon. Only local image resources are allowed to be used.
|
|
157
|
+
*
|
|
158
|
+
* @platform iOS: Supported
|
|
159
|
+
* @platform Android: Supported
|
|
160
|
+
*/
|
|
161
|
+
image?: ImageURISource | ImageRequireSource;
|
|
162
|
+
|
|
163
|
+
/**
|
|
164
|
+
* When true, the marker will be pre-selected.
|
|
165
|
+
* Setting this to true allows the user to drag the marker without needing to tap on it first to focus it.
|
|
166
|
+
*
|
|
167
|
+
* @default false
|
|
168
|
+
* @platform iOS: Apple Maps only
|
|
169
|
+
* @platform Android: Not supported
|
|
170
|
+
*/
|
|
171
|
+
isPreselected?: boolean;
|
|
172
|
+
|
|
173
|
+
/**
|
|
174
|
+
* Callback that is called when the user taps the callout view.
|
|
175
|
+
*
|
|
176
|
+
* @platform iOS: Apple Maps only
|
|
177
|
+
* @platform Android: Supported
|
|
178
|
+
*/
|
|
179
|
+
onCalloutPress?: (event: CalloutPressEvent) => void;
|
|
180
|
+
|
|
181
|
+
/**
|
|
182
|
+
* Callback that is called when the marker is deselected, before the callout is hidden.
|
|
183
|
+
*
|
|
184
|
+
* @platform iOS: Apple Maps only
|
|
185
|
+
* @platform Android: Not supported
|
|
186
|
+
*/
|
|
187
|
+
onDeselect?: (event: MarkerDeselectEvent) => void;
|
|
188
|
+
|
|
189
|
+
/**
|
|
190
|
+
* Callback called continuously as the marker is dragged
|
|
191
|
+
*
|
|
192
|
+
* @platform iOS: Apple Maps only
|
|
193
|
+
* @platform Android: Supported
|
|
194
|
+
*/
|
|
195
|
+
onDrag?: (event: MarkerDragEvent) => void;
|
|
196
|
+
|
|
197
|
+
/**
|
|
198
|
+
* Callback that is called when a drag on the marker finishes.
|
|
199
|
+
* This is usually the point you will want to setState on the marker's coordinate again
|
|
200
|
+
*
|
|
201
|
+
* @platform iOS: Apple Maps only
|
|
202
|
+
* @platform Android: Supported
|
|
203
|
+
*/
|
|
204
|
+
onDragEnd?: (event: MarkerDragStartEndEvent) => void;
|
|
205
|
+
|
|
206
|
+
/**
|
|
207
|
+
* Callback that is called when the user initiates a drag on the marker (if it is draggable)
|
|
208
|
+
*
|
|
209
|
+
* @platform iOS: Apple Maps only
|
|
210
|
+
* @platform Android: Supported
|
|
211
|
+
*/
|
|
212
|
+
onDragStart?: (event: MarkerDragStartEndEvent) => void;
|
|
213
|
+
|
|
214
|
+
/**
|
|
215
|
+
* Callback that is called when the marker is tapped by the user.
|
|
216
|
+
*
|
|
217
|
+
* @platform iOS: Supported
|
|
218
|
+
* @platform Android: Supported
|
|
219
|
+
*/
|
|
220
|
+
onPress?: (event: MarkerPressEvent) => void;
|
|
221
|
+
|
|
222
|
+
/**
|
|
223
|
+
* Callback that is called when the marker becomes selected.
|
|
224
|
+
* This will be called when the callout for that marker is about to be shown.
|
|
225
|
+
*
|
|
226
|
+
* @platform iOS: Supported.
|
|
227
|
+
* @platform Android: Supported
|
|
228
|
+
*/
|
|
229
|
+
onSelect?: (event: MarkerSelectEvent) => void;
|
|
230
|
+
|
|
231
|
+
/**
|
|
232
|
+
* The marker's opacity between 0.0 and 1.0.
|
|
233
|
+
*
|
|
234
|
+
* @default 1.0
|
|
235
|
+
* @platform iOS: Supported
|
|
236
|
+
* @platform Android: Supported
|
|
237
|
+
*/
|
|
238
|
+
opacity?: number;
|
|
239
|
+
|
|
240
|
+
/**
|
|
241
|
+
* If no custom marker view or custom image is provided, the platform default pin will be used, which can be customized by this color.
|
|
242
|
+
* Ignored if a custom marker is being used.<br/><br/>
|
|
243
|
+
* For Android, the set of available colors is limited. Unsupported colors will fall back to red.
|
|
244
|
+
* See [#887](https://github.com/react-community/react-native-maps/issues/887) for more information.
|
|
245
|
+
*
|
|
246
|
+
* @platform iOS: Supported
|
|
247
|
+
* @platform Android: Supported
|
|
248
|
+
*/
|
|
249
|
+
pinColor?: string;
|
|
250
|
+
|
|
251
|
+
/**
|
|
252
|
+
* A float number indicating marker's rotation angle, in degrees.
|
|
253
|
+
*
|
|
254
|
+
* @default 0
|
|
255
|
+
* @platform iOS: Google Maps only
|
|
256
|
+
* @platform Android: Supported
|
|
257
|
+
*/
|
|
258
|
+
rotation?: number;
|
|
259
|
+
|
|
260
|
+
/**
|
|
261
|
+
* Sets whether this marker should propagate `onPress` events.
|
|
262
|
+
* Enabling it will stop the parent `MapView`'s `onPress` from being called.
|
|
263
|
+
*
|
|
264
|
+
* Android does not propagate `onPress` events.
|
|
265
|
+
*
|
|
266
|
+
* See [#1132](https://github.com/react-community/react-native-maps/issues/1132) for more information.
|
|
267
|
+
*
|
|
268
|
+
* @default false
|
|
269
|
+
* @platform iOS: Apple Maps only
|
|
270
|
+
* @platform Android: Not supported
|
|
271
|
+
*/
|
|
272
|
+
stopPropagation?: boolean;
|
|
273
|
+
|
|
274
|
+
/**
|
|
275
|
+
* Sets whether marker should be tappable.
|
|
276
|
+
* If set to false, the marker will not have onPress events.
|
|
277
|
+
*
|
|
278
|
+
* @default true
|
|
279
|
+
* @platform iOS: Google Maps only
|
|
280
|
+
* @platform Android: Not supported
|
|
281
|
+
*/
|
|
282
|
+
tappable?: boolean;
|
|
283
|
+
|
|
284
|
+
/**
|
|
285
|
+
* The title of the marker.
|
|
286
|
+
* This is only used if the <Marker /> component has no `<Callout />` children.
|
|
287
|
+
*
|
|
288
|
+
* If the marker has <Callout /> children, default callout behavior will be used,
|
|
289
|
+
* which will show both the `title` and the `description`, if provided.
|
|
290
|
+
*
|
|
291
|
+
* @platform iOS: Supported
|
|
292
|
+
* @platform Android: Supported
|
|
293
|
+
*/
|
|
294
|
+
title?: string;
|
|
295
|
+
|
|
296
|
+
/**
|
|
297
|
+
* Sets whether this marker should track view changes in info window.
|
|
298
|
+
* Enabling it will let marker change content of info window after first render pass, but will lead to decreased performance,
|
|
299
|
+
* so it's recommended to disable it whenever you don't need it.
|
|
300
|
+
* **Note**: iOS Google Maps only.
|
|
301
|
+
*
|
|
302
|
+
* @default false
|
|
303
|
+
* @platform iOS: Google Maps only
|
|
304
|
+
* @platform Android: Not supported
|
|
305
|
+
*/
|
|
306
|
+
tracksInfoWindowChanges?: boolean;
|
|
307
|
+
|
|
308
|
+
/**
|
|
309
|
+
* Sets whether this marker should track view changes.
|
|
310
|
+
* It's recommended to turn it off whenever it's possible to improve custom marker performance.
|
|
311
|
+
*
|
|
312
|
+
* @default true
|
|
313
|
+
* @platform iOS: Google Maps only
|
|
314
|
+
* @platform Android: Supported
|
|
315
|
+
*/
|
|
316
|
+
tracksViewChanges?: boolean;
|
|
317
|
+
|
|
318
|
+
/**
|
|
319
|
+
* The order in which this tile overlay is drawn with respect to other overlays.
|
|
320
|
+
* An overlay with a larger z-index is drawn over overlays with smaller z-indices.
|
|
321
|
+
* The order of overlays with the same z-index is arbitrary.
|
|
322
|
+
*
|
|
323
|
+
* @platform iOS: Supported
|
|
324
|
+
* @platform Android: Supported
|
|
325
|
+
*/
|
|
326
|
+
zIndex?: number;
|
|
327
|
+
|
|
328
|
+
/**
|
|
329
|
+
Constants that indicates the display priority for annotations.
|
|
330
|
+
@default required
|
|
331
|
+
@platform iOS: Apple Maps only.
|
|
332
|
+
@platform Android: Not supported
|
|
333
|
+
|
|
334
|
+
Required: A constant indicating that the item is required.
|
|
335
|
+
High: A constant indicating that the item’s display priority is high.
|
|
336
|
+
Low: A constant indicating that the item’s display priority is Low.
|
|
337
|
+
*/
|
|
338
|
+
displayPriority?: AppleMarkerPriority;
|
|
339
|
+
|
|
340
|
+
/**
|
|
341
|
+
* Visibility of the title text rendered beneath Marker balloon
|
|
342
|
+
* @platform iOS: Apple Maps only
|
|
343
|
+
* @platform Android: Not supported
|
|
344
|
+
*/
|
|
345
|
+
titleVisibility?: AppleMarkerVisibility;
|
|
346
|
+
|
|
347
|
+
/**
|
|
348
|
+
* Visibility of the subtitle text rendered beneath Marker balloon
|
|
349
|
+
* @platform iOS: Apple Maps only
|
|
350
|
+
* @platform Android: Not supported
|
|
351
|
+
*/
|
|
352
|
+
subtitleVisibility?: AppleMarkerVisibility;
|
|
353
|
+
|
|
354
|
+
/**
|
|
355
|
+
* Indicate type of default markers if it's true MKPinAnnotationView will be used and MKMarkerAnnotationView if it's false
|
|
356
|
+
* It doesn't change anything if you are using custom Markers
|
|
357
|
+
* @platform iOS: Apple Maps only
|
|
358
|
+
* @platform Android: Not supported
|
|
359
|
+
*/
|
|
360
|
+
useLegacyPinView?: boolean;
|
|
361
|
+
};
|
|
362
|
+
|
|
363
|
+
type OmittedProps = Omit<MapMarkerProps, 'stopPropagation'>;
|
|
364
|
+
|
|
365
|
+
export type NativeProps = Modify<
|
|
366
|
+
OmittedProps,
|
|
367
|
+
{icon?: string; image?: MapMarkerProps['image'] | string}
|
|
368
|
+
> & {
|
|
369
|
+
ref: React.RefObject<MapMarkerNativeComponentType | null>;
|
|
370
|
+
};
|
|
371
|
+
|
|
372
|
+
export class MapMarker extends React.Component<MapMarkerProps> {
|
|
373
|
+
// declaration only, as they are set through decorateMap
|
|
374
|
+
/// @ts-ignore
|
|
375
|
+
context!: React.ContextType<typeof ProviderContext>;
|
|
376
|
+
getNativeComponent!: () => NativeComponent<NativeProps>;
|
|
377
|
+
getMapManagerCommand!: (name: string) => MapManagerCommand;
|
|
378
|
+
getUIManagerCommand!: (name: string) => UIManagerCommand;
|
|
379
|
+
|
|
380
|
+
static Animated: Animated.AnimatedComponent<typeof MapMarker>;
|
|
381
|
+
|
|
382
|
+
private marker: NativeProps['ref'];
|
|
383
|
+
private fabricMarker?: Boolean = undefined;
|
|
384
|
+
|
|
385
|
+
constructor(props: MapMarkerProps) {
|
|
386
|
+
super(props);
|
|
387
|
+
|
|
388
|
+
this.marker = React.createRef<MapMarkerNativeComponentType>();
|
|
389
|
+
this.showCallout = this.showCallout.bind(this);
|
|
390
|
+
this.hideCallout = this.hideCallout.bind(this);
|
|
391
|
+
this.setCoordinates = this.setCoordinates.bind(this);
|
|
392
|
+
this.redrawCallout = this.redrawCallout.bind(this);
|
|
393
|
+
this.animateMarkerToCoordinate = this.animateMarkerToCoordinate.bind(this);
|
|
394
|
+
}
|
|
395
|
+
|
|
396
|
+
setNativeProps(props: Partial<NativeProps>) {
|
|
397
|
+
// @ts-ignore
|
|
398
|
+
this.marker.current?.setNativeProps(props);
|
|
399
|
+
}
|
|
400
|
+
|
|
401
|
+
showCallout() {
|
|
402
|
+
if (this.marker.current) {
|
|
403
|
+
if (this.fabricMarker) {
|
|
404
|
+
// @ts-ignore
|
|
405
|
+
FabricCommands.showCallout(this.marker.current);
|
|
406
|
+
} else {
|
|
407
|
+
Commands.showCallout(this.marker.current);
|
|
408
|
+
}
|
|
409
|
+
}
|
|
410
|
+
}
|
|
411
|
+
|
|
412
|
+
hideCallout() {
|
|
413
|
+
if (this.marker.current) {
|
|
414
|
+
if (this.fabricMarker) {
|
|
415
|
+
// @ts-ignore
|
|
416
|
+
FabricCommands.hideCallout(this.marker.current);
|
|
417
|
+
} else {
|
|
418
|
+
Commands.hideCallout(this.marker.current);
|
|
419
|
+
}
|
|
420
|
+
}
|
|
421
|
+
}
|
|
422
|
+
|
|
423
|
+
setCoordinates(coordinate: LatLng) {
|
|
424
|
+
if (this.marker.current) {
|
|
425
|
+
if (this.fabricMarker) {
|
|
426
|
+
FabricCommands.setCoordinates(
|
|
427
|
+
// @ts-ignore
|
|
428
|
+
this.marker.current,
|
|
429
|
+
coordinate.latitude,
|
|
430
|
+
coordinate.longitude,
|
|
431
|
+
);
|
|
432
|
+
} else {
|
|
433
|
+
Commands.setCoordinates(this.marker.current, coordinate);
|
|
434
|
+
}
|
|
435
|
+
}
|
|
436
|
+
}
|
|
437
|
+
|
|
438
|
+
redrawCallout() {
|
|
439
|
+
if (this.marker.current) {
|
|
440
|
+
if (this.fabricMarker) {
|
|
441
|
+
// @ts-ignore
|
|
442
|
+
FabricCommands.redrawCallout(this.marker.current);
|
|
443
|
+
} else {
|
|
444
|
+
Commands.redrawCallout(this.marker.current);
|
|
445
|
+
}
|
|
446
|
+
}
|
|
447
|
+
}
|
|
448
|
+
|
|
449
|
+
animateMarkerToCoordinate(coordinate: LatLng, duration: number = 500) {
|
|
450
|
+
if (this.marker.current) {
|
|
451
|
+
if (this.fabricMarker) {
|
|
452
|
+
FabricCommands.animateToCoordinates(
|
|
453
|
+
// @ts-ignore
|
|
454
|
+
this.marker.current,
|
|
455
|
+
coordinate.latitude,
|
|
456
|
+
coordinate.longitude,
|
|
457
|
+
duration,
|
|
458
|
+
);
|
|
459
|
+
} else {
|
|
460
|
+
Commands.animateMarkerToCoordinate(
|
|
461
|
+
this.marker.current,
|
|
462
|
+
coordinate,
|
|
463
|
+
duration,
|
|
464
|
+
);
|
|
465
|
+
}
|
|
466
|
+
}
|
|
467
|
+
}
|
|
468
|
+
|
|
469
|
+
redraw() {
|
|
470
|
+
if (this.marker.current) {
|
|
471
|
+
Commands.redraw(this.marker.current);
|
|
472
|
+
}
|
|
473
|
+
}
|
|
474
|
+
|
|
475
|
+
render() {
|
|
476
|
+
const {stopPropagation = false} = this.props;
|
|
477
|
+
if (this.fabricMarker === undefined) {
|
|
478
|
+
const provider = this.context;
|
|
479
|
+
this.fabricMarker = !(
|
|
480
|
+
Platform.OS === 'ios' && provider === PROVIDER_GOOGLE
|
|
481
|
+
);
|
|
482
|
+
}
|
|
483
|
+
|
|
484
|
+
let icon;
|
|
485
|
+
if (this.props.icon && this.fabricMarker) {
|
|
486
|
+
icon = fixImageProp(this.props.icon);
|
|
487
|
+
}
|
|
488
|
+
let image;
|
|
489
|
+
if (this.props.image && this.fabricMarker) {
|
|
490
|
+
image = fixImageProp(this.props.image);
|
|
491
|
+
}
|
|
492
|
+
|
|
493
|
+
const AIRMapMarker = this.getNativeComponent();
|
|
494
|
+
|
|
495
|
+
return (
|
|
496
|
+
<AIRMapMarker
|
|
497
|
+
{...this.props}
|
|
498
|
+
ref={this.marker}
|
|
499
|
+
// @ts-ignore
|
|
500
|
+
image={image}
|
|
501
|
+
// @ts-ignore
|
|
502
|
+
icon={icon}
|
|
503
|
+
style={[styles.marker, this.props.style]}
|
|
504
|
+
onPress={event => {
|
|
505
|
+
if (stopPropagation) {
|
|
506
|
+
event.stopPropagation();
|
|
507
|
+
}
|
|
508
|
+
if (this.props.onPress) {
|
|
509
|
+
this.props.onPress(event);
|
|
510
|
+
}
|
|
511
|
+
}}
|
|
512
|
+
/>
|
|
513
|
+
);
|
|
514
|
+
}
|
|
515
|
+
}
|
|
516
|
+
|
|
517
|
+
const styles = StyleSheet.create({
|
|
518
|
+
marker: {
|
|
519
|
+
position: 'absolute',
|
|
520
|
+
backgroundColor: 'transparent',
|
|
521
|
+
},
|
|
522
|
+
});
|
|
523
|
+
|
|
524
|
+
MapMarker.Animated = Animated.createAnimatedComponent(MapMarker);
|
|
525
|
+
|
|
526
|
+
export default decorateMapComponent(MapMarker, 'Marker', {
|
|
527
|
+
google: {
|
|
528
|
+
ios: SUPPORTED,
|
|
529
|
+
android: USES_DEFAULT_IMPLEMENTATION,
|
|
530
|
+
},
|
|
531
|
+
});
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import type {HostComponent} from 'react-native';
|
|
2
|
+
import codegenNativeCommands from 'react-native/Libraries/Utilities/codegenNativeCommands';
|
|
3
|
+
import {NativeProps} from './MapMarker';
|
|
4
|
+
import {LatLng} from './sharedTypes';
|
|
5
|
+
|
|
6
|
+
export type MapMarkerNativeComponentType = HostComponent<NativeProps>;
|
|
7
|
+
|
|
8
|
+
interface NativeCommands {
|
|
9
|
+
showCallout: (
|
|
10
|
+
viewRef: NonNullable<
|
|
11
|
+
React.RefObject<MapMarkerNativeComponentType>['current']
|
|
12
|
+
>,
|
|
13
|
+
) => void;
|
|
14
|
+
hideCallout: (
|
|
15
|
+
viewRef: NonNullable<
|
|
16
|
+
React.RefObject<MapMarkerNativeComponentType>['current']
|
|
17
|
+
>,
|
|
18
|
+
) => void;
|
|
19
|
+
setCoordinates: (
|
|
20
|
+
viewRef: NonNullable<
|
|
21
|
+
React.RefObject<MapMarkerNativeComponentType>['current']
|
|
22
|
+
>,
|
|
23
|
+
coordinate: LatLng,
|
|
24
|
+
) => void;
|
|
25
|
+
redrawCallout: (
|
|
26
|
+
viewRef: NonNullable<
|
|
27
|
+
React.RefObject<MapMarkerNativeComponentType>['current']
|
|
28
|
+
>,
|
|
29
|
+
) => void;
|
|
30
|
+
animateMarkerToCoordinate: (
|
|
31
|
+
viewRef: NonNullable<
|
|
32
|
+
React.RefObject<MapMarkerNativeComponentType>['current']
|
|
33
|
+
>,
|
|
34
|
+
coordinate: LatLng,
|
|
35
|
+
duration: number,
|
|
36
|
+
) => void;
|
|
37
|
+
redraw: (
|
|
38
|
+
viewRef: NonNullable<
|
|
39
|
+
React.RefObject<MapMarkerNativeComponentType>['current']
|
|
40
|
+
>,
|
|
41
|
+
) => void;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export const Commands: NativeCommands = codegenNativeCommands<NativeCommands>({
|
|
45
|
+
supportedCommands: [
|
|
46
|
+
'showCallout',
|
|
47
|
+
'hideCallout',
|
|
48
|
+
'animateMarkerToCoordinate',
|
|
49
|
+
'setCoordinates',
|
|
50
|
+
],
|
|
51
|
+
});
|