react-native-maps 1.21.0-alpha.13 → 1.21.0-alpha.130
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/build.gradle +73 -53
- package/android/gradlew +1 -2
- 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 +206 -0
- package/android/src/main/java/com/facebook/react/viewmanagers/RNMapsMapViewManagerInterface.java +73 -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 +46 -0
- package/android/src/main/java/com/facebook/react/viewmanagers/RNMapsOverlayManagerInterface.java +23 -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/rnmaps/fabric/CalloutManager.java +77 -0
- package/android/src/main/java/com/rnmaps/fabric/CircleManager.java +94 -0
- package/android/src/main/java/com/rnmaps/fabric/JSONUtil.java +86 -0
- package/android/src/main/java/com/rnmaps/fabric/MapViewManager.java +619 -0
- package/android/src/main/java/com/rnmaps/fabric/MarkerManager.java +258 -0
- package/android/src/main/java/com/rnmaps/fabric/NativeAirMapsModule.java +235 -2
- package/android/src/main/java/com/rnmaps/fabric/OverlayManager.java +95 -0
- package/android/src/main/java/com/rnmaps/fabric/PolygonManager.java +89 -0
- package/android/src/main/java/com/rnmaps/fabric/PolylineManager.java +121 -0
- package/android/src/main/java/com/rnmaps/fabric/event/OnCalloutPressEvent.java +25 -0
- package/android/src/main/java/com/rnmaps/fabric/event/OnDeselectEvent.java +28 -0
- package/android/src/main/java/com/rnmaps/fabric/event/OnDoublePressEvent.java +27 -0
- package/android/src/main/java/com/rnmaps/fabric/event/OnDragEndEvent.java +28 -0
- package/android/src/main/java/com/rnmaps/fabric/event/OnDragEvent.java +28 -0
- package/android/src/main/java/com/rnmaps/fabric/event/OnDragStartEvent.java +28 -0
- package/android/src/main/java/com/rnmaps/fabric/event/OnIndoorBuildingFocusedEvent.java +28 -0
- package/android/src/main/java/com/rnmaps/fabric/event/OnIndoorLevelActivatedEvent.java +28 -0
- package/android/src/main/java/com/rnmaps/fabric/event/OnKmlReadyEvent.java +28 -0
- package/android/src/main/java/com/rnmaps/fabric/event/OnLongPressEvent.java +28 -0
- package/android/src/main/java/com/rnmaps/fabric/event/OnMapLoadedEvent.java +29 -0
- package/android/src/main/java/com/rnmaps/fabric/event/OnMapReadyEvent.java +29 -0
- package/android/src/main/java/com/rnmaps/fabric/event/OnMarkerDeselectEvent.java +28 -0
- package/android/src/main/java/com/rnmaps/fabric/event/OnMarkerDragEndEvent.java +28 -0
- package/android/src/main/java/com/rnmaps/fabric/event/OnMarkerDragEvent.java +28 -0
- package/android/src/main/java/com/rnmaps/fabric/event/OnMarkerDragStartEvent.java +28 -0
- package/android/src/main/java/com/rnmaps/fabric/event/OnMarkerPressEvent.java +28 -0
- package/android/src/main/java/com/rnmaps/fabric/event/OnMarkerSelectEvent.java +28 -0
- package/android/src/main/java/com/rnmaps/fabric/event/OnPanDragEvent.java +28 -0
- package/android/src/main/java/com/rnmaps/fabric/event/OnPoiClickEvent.java +27 -0
- package/android/src/main/java/com/rnmaps/fabric/event/OnPressEvent.java +27 -0
- package/android/src/main/java/com/rnmaps/fabric/event/OnRegionChangeCompleteEvent.java +30 -0
- package/android/src/main/java/com/rnmaps/fabric/event/OnRegionChangeEvent.java +48 -0
- package/android/src/main/java/com/rnmaps/fabric/event/OnRegionChangeStartEvent.java +33 -0
- package/android/src/main/java/com/rnmaps/fabric/event/OnSelectEvent.java +28 -0
- package/android/src/main/java/com/rnmaps/fabric/event/OnUserLocationChangeEvent.java +28 -0
- package/android/src/main/java/com/rnmaps/maps/MapAirModulePackage.java +40 -4
- package/android/src/main/java/com/rnmaps/maps/MapCallout.java +18 -0
- package/android/src/main/java/com/rnmaps/maps/MapCircle.java +24 -0
- package/android/src/main/java/com/rnmaps/maps/MapManager.java +14 -14
- package/android/src/main/java/com/rnmaps/maps/MapMarker.java +637 -556
- package/android/src/main/java/com/rnmaps/maps/MapMarkerManager.java +3 -3
- package/android/src/main/java/com/rnmaps/maps/MapModule.java +206 -206
- package/android/src/main/java/com/rnmaps/maps/MapOverlay.java +267 -151
- package/android/src/main/java/com/rnmaps/maps/MapPolygon.java +31 -1
- package/android/src/main/java/com/rnmaps/maps/MapPolyline.java +207 -141
- package/android/src/main/java/com/rnmaps/maps/MapPolylineManager.java +1 -16
- package/android/src/main/java/com/rnmaps/maps/MapView.java +1650 -1337
- 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 +29 -0
- package/android/src/main/jni/react/renderer/components/RNMapsSpecs/ComponentDescriptors.h +31 -0
- package/android/src/main/jni/react/renderer/components/RNMapsSpecs/EventEmitters.cpp +977 -0
- package/android/src/main/jni/react/renderer/components/RNMapsSpecs/EventEmitters.h +846 -0
- package/android/src/main/jni/react/renderer/components/RNMapsSpecs/Props.cpp +193 -0
- package/android/src/main/jni/react/renderer/components/RNMapsSpecs/Props.h +1223 -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 +24 -0
- package/android/src/main/jni/react/renderer/components/RNMapsSpecs/ShadowNodes.h +109 -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 +113 -0
- package/ios/AirGoogleMaps/AIRGoogleMap.h +10 -11
- package/ios/AirGoogleMaps/AIRGoogleMap.m +103 -69
- package/ios/AirGoogleMaps/AIRGoogleMapCircle.m +23 -11
- package/ios/AirGoogleMaps/AIRGoogleMapManager.m +10 -9
- package/ios/AirGoogleMaps/AIRGoogleMapMarker.m +6 -3
- package/ios/AirGoogleMaps/AIRGoogleMapMarkerManager.m +1 -1
- package/ios/AirGoogleMaps/AIRGoogleMapPolygon.m +3 -0
- package/ios/AirGoogleMaps/AIRGoogleMapPolyline.h +0 -1
- package/ios/AirGoogleMaps/AIRGoogleMapPolyline.m +0 -7
- package/ios/AirGoogleMaps/AIRGoogleMapUrlTile.m +2 -2
- package/ios/AirGoogleMaps/AIRGoogleMapWMSTile.h +1 -1
- package/ios/AirGoogleMaps/AIRGoogleMapWMSTile.m +4 -4
- package/ios/AirGoogleMaps/RNMapsGoogleMapView.h +1 -1
- package/ios/AirGoogleMaps/RNMapsGoogleMapView.mm +112 -43
- package/ios/AirGoogleMaps/RNMapsGoogleMapViewManager.mm +16 -1
- package/ios/AirGoogleMaps/RNMapsGooglePolygonView.h +26 -0
- package/ios/AirGoogleMaps/RNMapsGooglePolygonView.mm +217 -0
- package/ios/AirGoogleMaps/RNMapsGooglePolygonViewManager.mm +26 -0
- package/ios/AirMaps/AIRMap.h +8 -9
- package/ios/AirMaps/AIRMap.m +222 -239
- package/ios/AirMaps/AIRMapManager.m +10 -7
- package/ios/AirMaps/AIRMapMarker.h +1 -0
- package/ios/AirMaps/AIRMapMarker.m +165 -103
- package/ios/AirMaps/Callout/SMCalloutView.m +1 -1
- package/ios/AirMaps/FabricPlaceholders/PlaceHolderGoogleMapView.h +28 -0
- package/ios/AirMaps/FabricPlaceholders/PlaceHolderGoogleMapView.mm +68 -0
- package/ios/AirMaps/FabricPlaceholders/PlaceHolderPolygonView.h +25 -0
- package/ios/AirMaps/FabricPlaceholders/PlaceHolderPolygonView.mm +43 -0
- package/ios/AirMaps/RNMapsAirModule.h +1 -1
- package/ios/AirMaps/RNMapsAirModule.mm +4 -3
- package/ios/AirMaps/RNMapsDefines.h +0 -0
- package/ios/AirMaps/RNMapsMapView.h +1 -1
- package/ios/AirMaps/RNMapsMapView.mm +119 -95
- package/ios/AirMaps/RNMapsMapViewManager.mm +19 -1
- package/ios/AirMaps/RNMapsMarkerView.h +24 -0
- package/ios/AirMaps/RNMapsMarkerView.mm +430 -0
- package/ios/AirMaps/RNMapsMarkerViewManager.mm +28 -0
- package/ios/AirMaps.xcodeproj/project.pbxproj +20 -0
- 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 +2 -2
- 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 +193 -0
- package/ios/generated/RNMapsSpecs/Props.h +1223 -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/package.json +25 -18
- package/react-native-google-maps.podspec +26 -0
- package/react-native-maps-generated.podspec +31 -0
- package/react-native-maps.podspec +53 -15
- 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 +156 -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 +1223 -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 +219 -0
- package/src/fixImageProp.ts +17 -0
- package/src/index.ts +52 -0
- package/src/sharedTypes.ts +101 -0
- package/src/specs/NativeAirMapsModule.ts +36 -0
- package/src/specs/NativeComponentCallout.ts +63 -0
- package/src/specs/NativeComponentCircle.ts +93 -0
- package/src/specs/NativeComponentGoogleMapView.ts +913 -0
- package/src/specs/NativeComponentGooglePolygon.ts +94 -0
- package/src/specs/NativeComponentMapView.ts +1091 -0
- package/src/specs/NativeComponentMarker.ts +326 -0
- package/src/specs/NativeComponentOverlay.ts +89 -0
- package/src/specs/NativeComponentPolyline.ts +124 -0
- 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 -309
- package/lib/MapMarker.js +0 -116
- package/lib/MapMarkerNativeComponent.d.ts +0 -15
- package/lib/MapMarkerNativeComponent.js +0 -17
- package/lib/MapOverlay.d.ts +0 -87
- package/lib/MapOverlay.js +0 -63
- 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 -715
- package/lib/MapView.js +0 -447
- 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 -23
- package/lib/createFabricMap.js +0 -175
- package/lib/decorateMapComponent.d.ts +0 -36
- package/lib/decorateMapComponent.js +0 -80
- 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/NativeComponentGoogleMapView.d.ts +0 -713
- package/lib/specs/NativeComponentGoogleMapView.js +0 -21
- package/lib/specs/NativeComponentMapView.d.ts +0 -855
- package/lib/specs/NativeComponentMapView.js +0 -21
- /package/ios/{AirMaps → generated}/RNMapsHostVewDelegate.h +0 -0
- /package/{lib/sharedTypesInternal.d.ts → src/sharedTypesInternal.ts} +0 -0
|
@@ -0,0 +1,219 @@
|
|
|
1
|
+
import {createContext} from 'react';
|
|
2
|
+
import {
|
|
3
|
+
requireNativeComponent,
|
|
4
|
+
NativeModules,
|
|
5
|
+
Platform,
|
|
6
|
+
UIManager,
|
|
7
|
+
HostComponent,
|
|
8
|
+
} from 'react-native';
|
|
9
|
+
import {PROVIDER_DEFAULT, PROVIDER_GOOGLE} from './ProviderConstants';
|
|
10
|
+
import {Provider} from './sharedTypes';
|
|
11
|
+
import {MapCallout} from './MapCallout';
|
|
12
|
+
import {MapOverlay} from './MapOverlay';
|
|
13
|
+
import {MapCalloutSubview} from './MapCalloutSubview';
|
|
14
|
+
import {MapCircle} from './MapCircle';
|
|
15
|
+
import {MapHeatmap} from './MapHeatmap';
|
|
16
|
+
import {MapLocalTile} from './MapLocalTile';
|
|
17
|
+
import {MapMarker} from './MapMarker';
|
|
18
|
+
import {MapPolygon} from './MapPolygon';
|
|
19
|
+
import {MapPolyline} from './MapPolyline';
|
|
20
|
+
import {MapUrlTile} from './MapUrlTile';
|
|
21
|
+
import {MapWMSTile} from './MapWMSTile';
|
|
22
|
+
import {Commands} from './MapViewNativeComponent';
|
|
23
|
+
import GooglePolygon from './specs/NativeComponentGooglePolygon';
|
|
24
|
+
import FabricMarker from './specs/NativeComponentMarker';
|
|
25
|
+
import FabricCallout from './specs/NativeComponentCallout';
|
|
26
|
+
import FabricPolyline from './specs/NativeComponentPolyline';
|
|
27
|
+
import FabricCircle from './specs/NativeComponentCircle';
|
|
28
|
+
import FabricOverlay from './specs/NativeComponentOverlay';
|
|
29
|
+
|
|
30
|
+
export const SUPPORTED: ImplementationStatus = 'SUPPORTED';
|
|
31
|
+
export const USES_DEFAULT_IMPLEMENTATION: ImplementationStatus =
|
|
32
|
+
'USES_DEFAULT_IMPLEMENTATION';
|
|
33
|
+
export const NOT_SUPPORTED: ImplementationStatus = 'NOT_SUPPORTED';
|
|
34
|
+
|
|
35
|
+
export const ProviderContext = createContext<Provider>(undefined);
|
|
36
|
+
|
|
37
|
+
export function getNativeMapName(provider: Provider) {
|
|
38
|
+
if (Platform.OS === 'android') {
|
|
39
|
+
return 'AIRMap';
|
|
40
|
+
}
|
|
41
|
+
if (provider === PROVIDER_GOOGLE) {
|
|
42
|
+
return 'AIRGoogleMap';
|
|
43
|
+
}
|
|
44
|
+
return 'AIRMap';
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
function getNativeComponentName(provider: Provider, component: ComponentName) {
|
|
48
|
+
return `${getNativeMapName(provider)}${component}`;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
export const createNotSupportedComponent = (message: string) => () => {
|
|
52
|
+
console.error(message);
|
|
53
|
+
return null;
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
export const googleMapIsInstalled = !!UIManager.hasViewManagerConfig(
|
|
57
|
+
getNativeMapName(PROVIDER_GOOGLE),
|
|
58
|
+
);
|
|
59
|
+
|
|
60
|
+
export default function decorateMapComponent<Type extends Component>(
|
|
61
|
+
Component: Type,
|
|
62
|
+
componentName: ComponentName,
|
|
63
|
+
providers: Providers,
|
|
64
|
+
): Type {
|
|
65
|
+
const components: {
|
|
66
|
+
[key: string]: NativeComponent;
|
|
67
|
+
} = {};
|
|
68
|
+
|
|
69
|
+
const getDefaultComponent = () =>
|
|
70
|
+
requireNativeComponent(getNativeComponentName(undefined, componentName));
|
|
71
|
+
|
|
72
|
+
Component.contextType = ProviderContext;
|
|
73
|
+
|
|
74
|
+
Component.prototype.getNativeComponent =
|
|
75
|
+
function getNativeComponent(): NativeComponent {
|
|
76
|
+
const provider = this.context;
|
|
77
|
+
if (
|
|
78
|
+
componentName === 'Marker' &&
|
|
79
|
+
(Platform.OS !== 'ios' || provider !== PROVIDER_GOOGLE)
|
|
80
|
+
) {
|
|
81
|
+
// @ts-ignore
|
|
82
|
+
return FabricMarker;
|
|
83
|
+
}
|
|
84
|
+
if (
|
|
85
|
+
componentName === 'Polygon' &&
|
|
86
|
+
((provider === PROVIDER_GOOGLE &&
|
|
87
|
+
Platform.OS === 'ios' &&
|
|
88
|
+
googleMapIsInstalled) ||
|
|
89
|
+
Platform.OS === 'android')
|
|
90
|
+
) {
|
|
91
|
+
// @ts-ignore
|
|
92
|
+
return GooglePolygon;
|
|
93
|
+
}
|
|
94
|
+
if (Platform.OS === 'android') {
|
|
95
|
+
if (componentName === 'Callout') {
|
|
96
|
+
// @ts-ignore
|
|
97
|
+
return FabricCallout;
|
|
98
|
+
} else if (componentName === 'Polyline') {
|
|
99
|
+
// @ts-ignore
|
|
100
|
+
return FabricPolyline;
|
|
101
|
+
} else if (componentName === 'Circle') {
|
|
102
|
+
// @ts-ignore
|
|
103
|
+
return FabricCircle;
|
|
104
|
+
} else if (componentName === 'Overlay') {
|
|
105
|
+
// @ts-ignore
|
|
106
|
+
return FabricOverlay;
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
const key = provider || 'default';
|
|
110
|
+
if (components[key]) {
|
|
111
|
+
return components[key];
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
if (provider === PROVIDER_DEFAULT) {
|
|
115
|
+
components[key] = getDefaultComponent();
|
|
116
|
+
return components[key];
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
const providerInfo = providers[provider];
|
|
120
|
+
// quick fix. Previous code assumed android | ios
|
|
121
|
+
if (Platform.OS !== 'android' && Platform.OS !== 'ios') {
|
|
122
|
+
throw new Error(`react-native-maps doesn't support ${Platform.OS}`);
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
const platformSupport = providerInfo[Platform.OS];
|
|
126
|
+
const nativeComponentName = getNativeComponentName(
|
|
127
|
+
provider,
|
|
128
|
+
componentName,
|
|
129
|
+
);
|
|
130
|
+
if (platformSupport === NOT_SUPPORTED) {
|
|
131
|
+
components[key] = createNotSupportedComponent(
|
|
132
|
+
`react-native-maps: ${nativeComponentName} is not supported on ${Platform.OS}`,
|
|
133
|
+
);
|
|
134
|
+
} else if (platformSupport === SUPPORTED) {
|
|
135
|
+
if (
|
|
136
|
+
provider !== PROVIDER_GOOGLE ||
|
|
137
|
+
(Platform.OS === 'ios' && googleMapIsInstalled)
|
|
138
|
+
) {
|
|
139
|
+
components[key] = requireNativeComponent(nativeComponentName);
|
|
140
|
+
}
|
|
141
|
+
} else {
|
|
142
|
+
// (platformSupport === USES_DEFAULT_IMPLEMENTATION)
|
|
143
|
+
if (!components.default) {
|
|
144
|
+
components.default = getDefaultComponent();
|
|
145
|
+
}
|
|
146
|
+
components[key] = components.default;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
return components[key];
|
|
150
|
+
};
|
|
151
|
+
|
|
152
|
+
Component.prototype.getUIManagerCommand = function getUIManagerCommand(
|
|
153
|
+
name: string,
|
|
154
|
+
): UIManagerCommand {
|
|
155
|
+
const nativeComponentName = getNativeComponentName(
|
|
156
|
+
this.context,
|
|
157
|
+
componentName,
|
|
158
|
+
);
|
|
159
|
+
return UIManager.getViewManagerConfig(nativeComponentName).Commands[name];
|
|
160
|
+
};
|
|
161
|
+
|
|
162
|
+
Component.prototype.getMapManagerCommand = function getMapManagerCommand(
|
|
163
|
+
name: string,
|
|
164
|
+
): MapManagerCommand {
|
|
165
|
+
const nativeComponentName = `${getNativeComponentName(
|
|
166
|
+
this.context,
|
|
167
|
+
componentName,
|
|
168
|
+
)}Manager`;
|
|
169
|
+
return NativeModules[nativeComponentName][name];
|
|
170
|
+
};
|
|
171
|
+
|
|
172
|
+
return Component;
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
type ImplementationStatus =
|
|
176
|
+
| 'SUPPORTED'
|
|
177
|
+
| 'USES_DEFAULT_IMPLEMENTATION'
|
|
178
|
+
| 'NOT_SUPPORTED';
|
|
179
|
+
|
|
180
|
+
type Providers = {
|
|
181
|
+
google: {
|
|
182
|
+
ios: ImplementationStatus;
|
|
183
|
+
android: ImplementationStatus;
|
|
184
|
+
};
|
|
185
|
+
};
|
|
186
|
+
|
|
187
|
+
export type UIManagerCommand = number;
|
|
188
|
+
|
|
189
|
+
export type MapManagerCommand = keyof typeof Commands;
|
|
190
|
+
|
|
191
|
+
export type NativeComponent<H = unknown> =
|
|
192
|
+
| HostComponent<H>
|
|
193
|
+
| ReturnType<typeof createNotSupportedComponent>;
|
|
194
|
+
|
|
195
|
+
type Component =
|
|
196
|
+
| typeof MapCallout
|
|
197
|
+
| typeof MapCalloutSubview
|
|
198
|
+
| typeof MapCircle
|
|
199
|
+
| typeof MapHeatmap
|
|
200
|
+
| typeof MapLocalTile
|
|
201
|
+
| typeof MapMarker
|
|
202
|
+
| typeof MapOverlay
|
|
203
|
+
| typeof MapPolygon
|
|
204
|
+
| typeof MapPolyline
|
|
205
|
+
| typeof MapUrlTile
|
|
206
|
+
| typeof MapWMSTile;
|
|
207
|
+
|
|
208
|
+
type ComponentName =
|
|
209
|
+
| 'Callout'
|
|
210
|
+
| 'CalloutSubview'
|
|
211
|
+
| 'Circle'
|
|
212
|
+
| 'Heatmap'
|
|
213
|
+
| 'LocalTile'
|
|
214
|
+
| 'Marker'
|
|
215
|
+
| 'Overlay'
|
|
216
|
+
| 'Polygon'
|
|
217
|
+
| 'Polyline'
|
|
218
|
+
| 'UrlTile'
|
|
219
|
+
| 'WMSTile';
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import {Image, ImageSourcePropType} from 'react-native';
|
|
2
|
+
|
|
3
|
+
export function fixImageProp(
|
|
4
|
+
image: ImageSourcePropType,
|
|
5
|
+
): {uri: string} | ImageSourcePropType {
|
|
6
|
+
if (typeof image === 'string') {
|
|
7
|
+
return {uri: image};
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
if (typeof image === 'number') {
|
|
11
|
+
// Handle local image asset (require('./image.png'))
|
|
12
|
+
const resolvedImage = Image.resolveAssetSource(image);
|
|
13
|
+
return resolvedImage?.uri ? {uri: resolvedImage.uri} : image;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
return image;
|
|
17
|
+
}
|
package/src/index.ts
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import MapView, {
|
|
2
|
+
AnimatedMapView as Animated,
|
|
3
|
+
MAP_TYPES,
|
|
4
|
+
MapViewProps,
|
|
5
|
+
} from './MapView';
|
|
6
|
+
|
|
7
|
+
import Marker from './MapMarker';
|
|
8
|
+
export {MapMarker} from './MapMarker';
|
|
9
|
+
export type {MapMarkerProps} from './MapMarker';
|
|
10
|
+
|
|
11
|
+
import Overlay from './MapOverlay';
|
|
12
|
+
export {MapOverlay} from './MapOverlay';
|
|
13
|
+
export type {MapOverlayProps} from './MapOverlay';
|
|
14
|
+
|
|
15
|
+
export {default as Polyline, MapPolyline} from './MapPolyline';
|
|
16
|
+
export type {MapPolylineProps} from './MapPolyline';
|
|
17
|
+
export {default as Heatmap, MapHeatmap} from './MapHeatmap';
|
|
18
|
+
export type {MapHeatmapProps} from './MapHeatmap';
|
|
19
|
+
export {default as Polygon, MapPolygon} from './MapPolygon';
|
|
20
|
+
export type {MapPolygonProps} from './MapPolygon';
|
|
21
|
+
export {default as Circle, MapCircle} from './MapCircle';
|
|
22
|
+
export type {MapCircleProps} from './MapCircle';
|
|
23
|
+
export {default as UrlTile, MapUrlTile} from './MapUrlTile';
|
|
24
|
+
export type {MapUrlTileProps} from './MapUrlTile';
|
|
25
|
+
export {default as WMSTile, MapWMSTile} from './MapWMSTile';
|
|
26
|
+
export type {MapWMSTileProps} from './MapWMSTile';
|
|
27
|
+
export {default as LocalTile, MapLocalTile} from './MapLocalTile';
|
|
28
|
+
export type {MapLocalTileProps} from './MapLocalTile';
|
|
29
|
+
export {default as Callout, MapCallout} from './MapCallout';
|
|
30
|
+
export type {MapCalloutProps} from './MapCallout';
|
|
31
|
+
export {
|
|
32
|
+
default as CalloutSubview,
|
|
33
|
+
MapCalloutSubview,
|
|
34
|
+
} from './MapCalloutSubview';
|
|
35
|
+
export type {MapCalloutSubviewProps} from './MapCalloutSubview';
|
|
36
|
+
export {default as AnimatedRegion} from './AnimatedRegion';
|
|
37
|
+
export {default as Geojson} from './Geojson';
|
|
38
|
+
export type {GeojsonProps} from './Geojson';
|
|
39
|
+
|
|
40
|
+
export {Marker, Overlay};
|
|
41
|
+
export type {MapViewProps};
|
|
42
|
+
export {Animated, MAP_TYPES};
|
|
43
|
+
|
|
44
|
+
export * from './ProviderConstants';
|
|
45
|
+
export * from './MapView.types';
|
|
46
|
+
export * from './MapPolygon.types';
|
|
47
|
+
export * from './sharedTypes';
|
|
48
|
+
|
|
49
|
+
export const MarkerAnimated = Marker.Animated;
|
|
50
|
+
export const OverlayAnimated = Overlay.Animated;
|
|
51
|
+
|
|
52
|
+
export default MapView;
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import {NativeSyntheticEvent} from 'react-native';
|
|
2
|
+
|
|
3
|
+
export type Provider = 'google' | undefined;
|
|
4
|
+
|
|
5
|
+
export type LatLng = {
|
|
6
|
+
latitude: number;
|
|
7
|
+
longitude: number;
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
export type Point = {
|
|
11
|
+
x: number;
|
|
12
|
+
y: number;
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
export type Region = LatLng & {
|
|
16
|
+
latitudeDelta: number;
|
|
17
|
+
longitudeDelta: number;
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
export type Frame = Point & {height: number; width: number};
|
|
21
|
+
|
|
22
|
+
export type CalloutPressEvent = NativeSyntheticEvent<{
|
|
23
|
+
action: 'callout-press';
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* @platform iOS
|
|
27
|
+
*/
|
|
28
|
+
frame?: Frame;
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* @platform iOS
|
|
32
|
+
*/
|
|
33
|
+
id?: string;
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* @platform iOS
|
|
37
|
+
*/
|
|
38
|
+
point?: Point;
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* @platform Android
|
|
42
|
+
*/
|
|
43
|
+
coordinate?: LatLng;
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* @platform Android
|
|
47
|
+
*/
|
|
48
|
+
position?: Point;
|
|
49
|
+
}>;
|
|
50
|
+
|
|
51
|
+
export type LineCapType = 'butt' | 'round' | 'square';
|
|
52
|
+
export type LineJoinType = 'miter' | 'round' | 'bevel';
|
|
53
|
+
|
|
54
|
+
export type ClickEvent<T = {}> = NativeSyntheticEvent<
|
|
55
|
+
{coordinate: LatLng; position: Point} & T
|
|
56
|
+
>;
|
|
57
|
+
|
|
58
|
+
export type MarkerDeselectEvent = Omit<
|
|
59
|
+
ClickEvent<{
|
|
60
|
+
action: 'marker-deselect';
|
|
61
|
+
id: string;
|
|
62
|
+
}>,
|
|
63
|
+
'position'
|
|
64
|
+
>;
|
|
65
|
+
|
|
66
|
+
export type MarkerSelectEvent = Omit<
|
|
67
|
+
ClickEvent<{id: string; action: 'marker-select'}>,
|
|
68
|
+
'position'
|
|
69
|
+
>;
|
|
70
|
+
|
|
71
|
+
export type MarkerDragEvent = ClickEvent<{
|
|
72
|
+
/**
|
|
73
|
+
* @platform iOS
|
|
74
|
+
*/
|
|
75
|
+
id?: string;
|
|
76
|
+
}>;
|
|
77
|
+
|
|
78
|
+
export type MarkerDragStartEndEvent = NativeSyntheticEvent<{
|
|
79
|
+
coordinate: LatLng;
|
|
80
|
+
|
|
81
|
+
/**
|
|
82
|
+
* @platform iOS
|
|
83
|
+
*/
|
|
84
|
+
id?: string;
|
|
85
|
+
|
|
86
|
+
/**
|
|
87
|
+
* @platform Android
|
|
88
|
+
*/
|
|
89
|
+
position?: Point;
|
|
90
|
+
}>;
|
|
91
|
+
|
|
92
|
+
export type MarkerPressEvent = NativeSyntheticEvent<{
|
|
93
|
+
id: string;
|
|
94
|
+
action: 'marker-press';
|
|
95
|
+
coordinate: LatLng;
|
|
96
|
+
|
|
97
|
+
/**
|
|
98
|
+
* @platform Android
|
|
99
|
+
*/
|
|
100
|
+
position?: Point;
|
|
101
|
+
}>;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import type {TurboModule} from 'react-native';
|
|
2
|
+
import {TurboModuleRegistry} from 'react-native';
|
|
3
|
+
import type {Double} from 'react-native/Libraries/Types/CodegenTypes';
|
|
4
|
+
import type {Camera} from './NativeComponentMapView';
|
|
5
|
+
import {Address} from 'react-native-maps';
|
|
6
|
+
|
|
7
|
+
type LatLng = {
|
|
8
|
+
latitude: Double;
|
|
9
|
+
longitude: Double;
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
type Point = Readonly<{
|
|
13
|
+
x: Double; // Non-nullable Double for x
|
|
14
|
+
y: Double; // Non-nullable Double for y
|
|
15
|
+
}>;
|
|
16
|
+
|
|
17
|
+
export type Region = Readonly<
|
|
18
|
+
LatLng & {
|
|
19
|
+
latitudeDelta: Double; // Non-nullable Double for latitudeDelta
|
|
20
|
+
longitudeDelta: Double; // Non-nullable Double for longitudeDelta
|
|
21
|
+
}
|
|
22
|
+
>;
|
|
23
|
+
|
|
24
|
+
export type MapBoundaries = {northEast: LatLng; southWest: LatLng};
|
|
25
|
+
|
|
26
|
+
export interface Spec extends TurboModule {
|
|
27
|
+
getCamera(tag: Double): Promise<Camera>;
|
|
28
|
+
getMarkersFrames(tag: Double, onlyVisible: boolean): Promise<unknown>;
|
|
29
|
+
getMapBoundaries(tag: Double): Promise<MapBoundaries>;
|
|
30
|
+
takeSnapshot(tag: Double, config: string): Promise<string>;
|
|
31
|
+
getAddressFromCoordinates(tag: Double, coordinate: LatLng): Promise<Address>;
|
|
32
|
+
getPointForCoordinate(tag: Double, coordinate: LatLng): Promise<Point>;
|
|
33
|
+
getCoordinateForPoint(tag: Double, point: Point): Promise<LatLng>;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export default TurboModuleRegistry.getEnforcing<Spec>('RNMapsAirModule');
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import type {HostComponent, ViewProps} from 'react-native';
|
|
2
|
+
|
|
3
|
+
import codegenNativeComponent from 'react-native/Libraries/Utilities/codegenNativeComponent';
|
|
4
|
+
import {
|
|
5
|
+
Double,
|
|
6
|
+
BubblingEventHandler,
|
|
7
|
+
} from 'react-native/Libraries/Types/CodegenTypes';
|
|
8
|
+
|
|
9
|
+
export type LatLng = Readonly<{
|
|
10
|
+
latitude: Double; // Non-nullable Double for latitude
|
|
11
|
+
longitude: Double; // Non-nullable Double for longitude
|
|
12
|
+
}>;
|
|
13
|
+
|
|
14
|
+
export type CalloutPressEvent = BubblingEventHandler<
|
|
15
|
+
Readonly<{
|
|
16
|
+
action?: string;
|
|
17
|
+
id: string;
|
|
18
|
+
coordinate: {
|
|
19
|
+
latitude: Double; // Inlined LatLng
|
|
20
|
+
longitude: Double;
|
|
21
|
+
};
|
|
22
|
+
position?: {
|
|
23
|
+
x: Double; // Inlined Point
|
|
24
|
+
y: Double;
|
|
25
|
+
}; // Optional position for Android
|
|
26
|
+
}>
|
|
27
|
+
>;
|
|
28
|
+
|
|
29
|
+
export interface CalloutFabricNativeProps extends ViewProps {
|
|
30
|
+
/**
|
|
31
|
+
* If `true`, clicks on transparent areas in callout will be passed to map.
|
|
32
|
+
*
|
|
33
|
+
* @default false
|
|
34
|
+
* @platform iOS: Supported
|
|
35
|
+
* @platform Android: Not supported
|
|
36
|
+
*/
|
|
37
|
+
alphaHitTest?: boolean;
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* Callback that is called when the user presses on the callout
|
|
41
|
+
*
|
|
42
|
+
* @platform iOS: Apple Maps only
|
|
43
|
+
* @platform Android: Supported
|
|
44
|
+
*/
|
|
45
|
+
onPress?: CalloutPressEvent;
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* If `false`, a default "tooltip" bubble window will be drawn around this callouts children.
|
|
49
|
+
* If `true`, the child views can fully customize their appearance, including any "bubble" like styles.
|
|
50
|
+
*
|
|
51
|
+
* @default false
|
|
52
|
+
* @platform iOS: Supported
|
|
53
|
+
* @platform Android: Supported
|
|
54
|
+
*/
|
|
55
|
+
tooltip?: boolean;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
export default codegenNativeComponent<CalloutFabricNativeProps>(
|
|
59
|
+
'RNMapsCallout',
|
|
60
|
+
{
|
|
61
|
+
excludedPlatforms: ['iOS'],
|
|
62
|
+
},
|
|
63
|
+
) as HostComponent<CalloutFabricNativeProps>;
|
|
@@ -0,0 +1,93 @@
|
|
|
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
|
+
} from 'react-native/Libraries/Types/CodegenTypes';
|
|
9
|
+
|
|
10
|
+
export type LatLng = Readonly<{
|
|
11
|
+
latitude: Double; // Non-nullable Double for latitude
|
|
12
|
+
longitude: Double; // Non-nullable Double for longitude
|
|
13
|
+
}>;
|
|
14
|
+
|
|
15
|
+
export type CirclePressEventHandler = BubblingEventHandler<
|
|
16
|
+
Readonly<{
|
|
17
|
+
action?: string;
|
|
18
|
+
id: string;
|
|
19
|
+
coordinate: {
|
|
20
|
+
latitude: Double; // Inlined LatLng
|
|
21
|
+
longitude: Double;
|
|
22
|
+
};
|
|
23
|
+
position?: {
|
|
24
|
+
x: Double; // Inlined Point
|
|
25
|
+
y: Double;
|
|
26
|
+
}; // Optional position for Android
|
|
27
|
+
}>
|
|
28
|
+
>;
|
|
29
|
+
|
|
30
|
+
export interface CircleFabricNativeProps extends ViewProps {
|
|
31
|
+
/**
|
|
32
|
+
* The coordinates of the center of the circle.
|
|
33
|
+
*
|
|
34
|
+
* @platform iOS: Supported
|
|
35
|
+
* @platform Android: Supported
|
|
36
|
+
*/
|
|
37
|
+
center: LatLng;
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* The stroke color to use for the path.
|
|
41
|
+
*
|
|
42
|
+
* @default `#000`, `rgba(r,g,b,0.5)`
|
|
43
|
+
* @platform iOS: Supported
|
|
44
|
+
* @platform Android: Supported
|
|
45
|
+
*/
|
|
46
|
+
fillColor?: ColorValue;
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* The radius of the circle to be drawn (in meters)
|
|
50
|
+
*
|
|
51
|
+
* @platform iOS: Supported
|
|
52
|
+
* @platform Android: Supported
|
|
53
|
+
*/
|
|
54
|
+
radius: Double;
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* The stroke color to use for the path.
|
|
58
|
+
*
|
|
59
|
+
* @default `#000`, `rgba(r,g,b,0.5)`
|
|
60
|
+
* @platform iOS: Supported
|
|
61
|
+
* @platform Android: Supported
|
|
62
|
+
*/
|
|
63
|
+
strokeColor?: ColorValue;
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* Callback that is called when user taps on the map.
|
|
67
|
+
*
|
|
68
|
+
* @platform iOS: Supported
|
|
69
|
+
* @platform Android: Supported
|
|
70
|
+
*/
|
|
71
|
+
onPress?: CirclePressEventHandler;
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* The stroke width to use for the path.
|
|
75
|
+
*
|
|
76
|
+
* @default 1
|
|
77
|
+
* @platform iOS: Supported
|
|
78
|
+
* @platform Android: Supported
|
|
79
|
+
*/
|
|
80
|
+
strokeWidth?: Float;
|
|
81
|
+
|
|
82
|
+
/**
|
|
83
|
+
* Boolean to allow a polygon to be tappable and use the onPress function.
|
|
84
|
+
*
|
|
85
|
+
* @platform iOS: Google Maps only
|
|
86
|
+
* @platform Android: Supported
|
|
87
|
+
*/
|
|
88
|
+
tappable?: boolean;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
export default codegenNativeComponent<CircleFabricNativeProps>('RNMapsCircle', {
|
|
92
|
+
excludedPlatforms: ['iOS'],
|
|
93
|
+
}) as HostComponent<CircleFabricNativeProps>;
|