react-native-maps 0.31.1 → 1.0.0-alpha.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/build.gradle +89 -33
- package/android/gradle/wrapper/gradle-wrapper.jar +0 -0
- package/android/gradle/wrapper/gradle-wrapper.properties +5 -0
- package/android/gradlew +251 -0
- package/android/gradlew.bat +94 -0
- package/android/src/main/AndroidManifest.xml +1 -5
- 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/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 +623 -0
- package/android/src/main/java/com/rnmaps/fabric/MarkerManager.java +258 -0
- package/android/src/main/java/com/rnmaps/fabric/NativeAirMapsModule.java +284 -0
- package/android/src/main/java/com/rnmaps/fabric/OverlayManager.java +101 -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/UrlTileManager.java +124 -0
- package/android/src/main/java/com/rnmaps/fabric/WMSTileManager.java +114 -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/{airbnb/android/react → rnmaps}/maps/FileUtil.java +3 -6
- package/android/src/main/java/com/{airbnb/android/react → rnmaps}/maps/FusedLocationSource.java +5 -2
- package/android/src/main/java/com/{airbnb/android/react → rnmaps}/maps/ImageReadable.java +1 -1
- package/android/src/main/java/com/{airbnb/android/react → rnmaps}/maps/ImageReader.java +5 -7
- package/android/src/main/java/com/{airbnb/android/react → rnmaps}/maps/ImageUtil.java +1 -2
- package/android/src/main/java/com/{airbnb/android/react → rnmaps}/maps/LatLngBoundsUtils.java +1 -1
- package/android/src/main/java/com/rnmaps/maps/MapAirModulePackage.java +98 -0
- package/android/src/main/java/com/rnmaps/maps/MapCallout.java +41 -0
- package/android/src/main/java/com/{airbnb/android/react/maps/AirMapCalloutManager.java → rnmaps/maps/MapCalloutManager.java} +6 -6
- package/android/src/main/java/com/{airbnb/android/react/maps/AirMapCircle.java → rnmaps/maps/MapCircle.java} +34 -8
- package/android/src/main/java/com/{airbnb/android/react/maps/AirMapCircleManager.java → rnmaps/maps/MapCircleManager.java} +15 -20
- package/android/src/main/java/com/rnmaps/maps/MapFeature.java +17 -0
- package/android/src/main/java/com/{airbnb/android/react/maps/AirMapGradientPolyline.java → rnmaps/maps/MapGradientPolyline.java} +9 -12
- package/android/src/main/java/com/{airbnb/android/react/maps/AirMapGradientPolylineManager.java → rnmaps/maps/MapGradientPolylineManager.java} +13 -18
- package/android/src/main/java/com/{airbnb/android/react/maps/AirMapHeatmap.java → rnmaps/maps/MapHeatmap.java} +8 -9
- package/android/src/main/java/com/{airbnb/android/react/maps/AirMapHeatmapManager.java → rnmaps/maps/MapHeatmapManager.java} +8 -8
- package/android/src/main/java/com/{airbnb/android/react/maps/AirMapLocalTile.java → rnmaps/maps/MapLocalTile.java} +19 -16
- package/android/src/main/java/com/rnmaps/maps/MapLocalTileManager.java +54 -0
- package/android/src/main/java/com/rnmaps/maps/MapManager.java +504 -0
- package/android/src/main/java/com/rnmaps/maps/MapMarker.java +706 -0
- package/android/src/main/java/com/rnmaps/maps/MapMarkerManager.java +368 -0
- package/android/src/main/java/com/rnmaps/maps/MapModule.java +283 -0
- package/android/src/main/java/com/rnmaps/maps/MapOverlay.java +262 -0
- package/android/src/main/java/com/rnmaps/maps/MapOverlayManager.java +97 -0
- package/android/src/main/java/com/{airbnb/android/react/maps/AirMapPolygon.java → rnmaps/maps/MapPolygon.java} +73 -9
- package/android/src/main/java/com/{airbnb/android/react/maps/AirMapPolygonManager.java → rnmaps/maps/MapPolygonManager.java} +22 -22
- package/android/src/main/java/com/rnmaps/maps/MapPolyline.java +230 -0
- package/android/src/main/java/com/{airbnb/android/react/maps/AirMapPolylineManager.java → rnmaps/maps/MapPolylineManager.java} +18 -38
- package/android/src/main/java/com/{airbnb/android/react/maps/AirMapTileProvider.java → rnmaps/maps/MapTileProvider.java} +55 -76
- package/android/src/main/java/com/{airbnb/android/react/maps/AirMapTileWorker.java → rnmaps/maps/MapTileWorker.java} +7 -14
- package/android/src/main/java/com/rnmaps/maps/MapUIBlock.java +64 -0
- package/android/src/main/java/com/{airbnb/android/react/maps/AirMapUrlTile.java → rnmaps/maps/MapUrlTile.java} +29 -29
- package/android/src/main/java/com/rnmaps/maps/MapUrlTileManager.java +87 -0
- package/android/src/main/java/com/rnmaps/maps/MapView.java +1844 -0
- package/android/src/main/java/com/{airbnb/android/react/maps/AirMapWMSTile.java → rnmaps/maps/MapWMSTile.java} +11 -17
- package/android/src/main/java/com/rnmaps/maps/MapWMSTileManager.java +81 -0
- package/android/src/main/java/com/rnmaps/maps/MapsPackage.java +45 -0
- package/android/src/main/java/com/{airbnb/android/react → rnmaps}/maps/RegionChangeEvent.java +1 -1
- package/android/src/main/java/com/{airbnb/android/react → rnmaps}/maps/SizeReportingShadowNode.java +1 -1
- package/android/src/main/java/com/{airbnb/android/react → rnmaps}/maps/ViewAttacherGroup.java +2 -7
- package/android/src/main/java/com/{airbnb/android/react → rnmaps}/maps/ViewChangesTracker.java +12 -11
- 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/app.plugin.js +1 -0
- package/ios/AirGoogleMaps/AIRGMSMarker.h +2 -0
- package/ios/AirGoogleMaps/AIRGoogleMap.h +22 -12
- package/ios/AirGoogleMaps/{AIRGoogleMap.m → AIRGoogleMap.mm} +407 -130
- package/ios/AirGoogleMaps/AIRGoogleMapCircle.h +2 -3
- package/ios/AirGoogleMaps/AIRGoogleMapCircle.m +42 -3
- package/ios/AirGoogleMaps/AIRGoogleMapCoordinate.h +13 -0
- package/ios/AirGoogleMaps/AIRGoogleMapCoordinate.m +10 -0
- package/ios/AirGoogleMaps/AIRGoogleMapHeatmap.h +1 -1
- package/ios/AirGoogleMaps/AIRGoogleMapManager.h +11 -0
- package/ios/AirGoogleMaps/AIRGoogleMapManager.mm +543 -0
- package/ios/AirGoogleMaps/AIRGoogleMapMarker.h +4 -0
- package/ios/AirGoogleMaps/AIRGoogleMapMarker.m +369 -237
- package/ios/AirGoogleMaps/AIRGoogleMapMarkerManager.m +3 -2
- package/ios/AirGoogleMaps/AIRGoogleMapOverlay.h +0 -1
- package/ios/AirGoogleMaps/AIRGoogleMapPolygon.h +7 -6
- package/ios/AirGoogleMaps/AIRGoogleMapPolygon.m +62 -5
- package/ios/AirGoogleMaps/AIRGoogleMapPolygonManager.m +3 -3
- package/ios/AirGoogleMaps/AIRGoogleMapPolyline.h +4 -3
- package/ios/AirGoogleMaps/AIRGoogleMapPolyline.m +9 -9
- package/ios/AirGoogleMaps/AIRGoogleMapPolylineManager.m +2 -2
- package/ios/AirGoogleMaps/AIRGoogleMapUrlTile.m +2 -2
- package/ios/AirGoogleMaps/AIRGoogleMapWMSTile.h +1 -1
- package/ios/AirGoogleMaps/AIRGoogleMapWMSTile.m +4 -4
- package/ios/AirGoogleMaps/RCTConvert+GMSMapViewType.h +3 -0
- package/ios/AirGoogleMaps/RCTConvert+GMSMapViewType.m +18 -0
- package/ios/AirGoogleMaps/RNMapsGoogleMapView.h +29 -0
- package/ios/AirGoogleMaps/RNMapsGoogleMapView.mm +678 -0
- package/ios/AirGoogleMaps/RNMapsGoogleMapViewManager.mm +40 -0
- package/ios/AirGoogleMaps/RNMapsGooglePolygonView.h +26 -0
- package/ios/AirGoogleMaps/RNMapsGooglePolygonView.mm +226 -0
- package/ios/AirGoogleMaps/RNMapsGooglePolygonViewManager.mm +26 -0
- package/ios/AirGoogleMaps/Resources/GoogleMapsPrivacy.bundle/PrivacyInfo.xcprivacy +110 -0
- package/ios/AirMaps/AIRMap.h +19 -14
- package/ios/AirMaps/{AIRMap.m → AIRMap.mm} +333 -120
- package/ios/AirMaps/AIRMapCircle.m +1 -53
- package/ios/AirMaps/AIRMapCoordinate.m +2 -4
- package/ios/AirMaps/AIRMapManager.m +64 -218
- package/ios/AirMaps/AIRMapMarker.h +5 -0
- package/ios/AirMaps/AIRMapMarker.m +180 -69
- package/ios/AirMaps/AIRMapMarkerManager.m +3 -0
- package/ios/AirMaps/AIRMapOverlay.m +2 -2
- package/ios/AirMaps/AIRMapPolygon.m +0 -52
- package/ios/AirMaps/AIRMapPolyline.m +3 -2
- package/ios/AirMaps/AIRMapWMSTile.m +8 -8
- package/ios/AirMaps/Callout/SMCalloutView.m +1 -1
- 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 +52 -0
- package/ios/AirMaps/RCTComponentData+Maps.h +13 -0
- package/ios/AirMaps/RCTComponentData+Maps.m +55 -0
- package/ios/AirMaps/RCTConvert+AirMap.h +6 -1
- package/ios/AirMaps/RCTConvert+AirMap.m +18 -0
- package/ios/AirMaps/RNMapsAirModule.h +15 -0
- package/ios/AirMaps/RNMapsAirModule.mm +164 -0
- package/ios/AirMaps/RNMapsDefines.h +1 -0
- package/ios/AirMaps/RNMapsMapView.h +27 -0
- package/ios/AirMaps/RNMapsMapView.mm +577 -0
- package/ios/AirMaps/RNMapsMapViewManager.mm +42 -0
- package/ios/AirMaps/RNMapsMarkerView.h +24 -0
- package/ios/AirMaps/RNMapsMarkerView.mm +439 -0
- package/ios/AirMaps/RNMapsMarkerViewManager.mm +28 -0
- package/ios/AirMaps/UIView+AirMap.h +11 -0
- package/ios/AirMaps/UIView+AirMap.m +20 -0
- package/ios/AirMaps/module.modulemap +6 -0
- package/ios/AirMaps.xcodeproj/project.pbxproj +44 -4
- package/ios/PrivacyInfo.xcprivacy +37 -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/generated/RNMapsAirModuleDelegate.h +24 -0
- package/ios/generated/RNMapsHostVewDelegate.h +17 -0
- 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 +57 -34
- package/plugin/build/android.js +58 -0
- package/plugin/build/index.js +10 -0
- package/plugin/build/ios.js +176 -0
- package/plugin/build/types.js +2 -0
- package/react-native-maps.podspec +114 -11
- package/react-native.config.js +15 -0
- package/src/{AnimatedRegion.js → AnimatedRegion.ts} +26 -21
- 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 +1235 -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 +230 -0
- package/src/fixImageProp.ts +17 -0
- package/src/index.ts +52 -0
- package/src/sharedTypes.ts +101 -0
- package/src/sharedTypesInternal.ts +1 -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 +922 -0
- package/src/specs/NativeComponentGooglePolygon.ts +94 -0
- package/src/specs/NativeComponentMapView.ts +1100 -0
- package/src/specs/NativeComponentMarker.ts +326 -0
- package/src/specs/NativeComponentOverlay.ts +98 -0
- package/src/specs/NativeComponentPolyline.ts +124 -0
- package/src/specs/NativeComponentUrlTile.ts +128 -0
- package/src/specs/NativeComponentWMSTile.ts +107 -0
- package/LICENSE +0 -21
- package/README.md +0 -652
- package/android/src/main/assets/ula.kml +0 -1214
- package/android/src/main/java/com/airbnb/android/react/maps/AirMapCallout.java +0 -23
- package/android/src/main/java/com/airbnb/android/react/maps/AirMapFeature.java +0 -18
- package/android/src/main/java/com/airbnb/android/react/maps/AirMapLiteManager.java +0 -20
- package/android/src/main/java/com/airbnb/android/react/maps/AirMapLocalTileManager.java +0 -56
- package/android/src/main/java/com/airbnb/android/react/maps/AirMapManager.java +0 -500
- package/android/src/main/java/com/airbnb/android/react/maps/AirMapMarker.java +0 -630
- package/android/src/main/java/com/airbnb/android/react/maps/AirMapMarkerManager.java +0 -370
- package/android/src/main/java/com/airbnb/android/react/maps/AirMapModule.java +0 -380
- package/android/src/main/java/com/airbnb/android/react/maps/AirMapOverlay.java +0 -169
- package/android/src/main/java/com/airbnb/android/react/maps/AirMapOverlayManager.java +0 -81
- package/android/src/main/java/com/airbnb/android/react/maps/AirMapPolyline.java +0 -162
- package/android/src/main/java/com/airbnb/android/react/maps/AirMapUrlTileManager.java +0 -97
- package/android/src/main/java/com/airbnb/android/react/maps/AirMapView.java +0 -1384
- package/android/src/main/java/com/airbnb/android/react/maps/AirMapWMSTileManager.java +0 -87
- package/android/src/main/java/com/airbnb/android/react/maps/MapsPackage.java +0 -65
- package/index.d.ts +0 -637
- package/ios/AirGoogleMaps/AIRGoogleMapManager.m +0 -690
- package/ios/User.xcconfig +0 -0
- package/react-native-google-maps.podspec +0 -22
- package/src/Geojson.js +0 -334
- package/src/MapCallout.js +0 -51
- package/src/MapCalloutSubview.js +0 -44
- package/src/MapCircle.js +0 -150
- package/src/MapHeatmap.js +0 -99
- package/src/MapLocalTile.js +0 -52
- package/src/MapMarker.js +0 -377
- package/src/MapOverlay.js +0 -86
- package/src/MapPolygon.js +0 -202
- package/src/MapPolyline.js +0 -168
- package/src/MapUrlTile.js +0 -131
- package/src/MapView.js +0 -1160
- package/src/MapView.web.js +0 -1
- package/src/MapWMSTile.js +0 -122
- package/src/ProviderConstants.js +0 -2
- package/src/decorateMapComponent.js +0 -112
- package/src/index.js +0 -31
package/src/MapView.js
DELETED
|
@@ -1,1160 +0,0 @@
|
|
|
1
|
-
import PropTypes from 'prop-types';
|
|
2
|
-
import React from 'react';
|
|
3
|
-
import {
|
|
4
|
-
Platform,
|
|
5
|
-
Animated as RNAnimated,
|
|
6
|
-
requireNativeComponent,
|
|
7
|
-
NativeModules,
|
|
8
|
-
findNodeHandle,
|
|
9
|
-
} from 'react-native';
|
|
10
|
-
import {
|
|
11
|
-
EdgeInsetsPropType,
|
|
12
|
-
PointPropType,
|
|
13
|
-
ColorPropType,
|
|
14
|
-
ViewPropTypes,
|
|
15
|
-
} from 'deprecated-react-native-prop-types';
|
|
16
|
-
import MapMarker from './MapMarker';
|
|
17
|
-
import MapPolyline from './MapPolyline';
|
|
18
|
-
import MapPolygon from './MapPolygon';
|
|
19
|
-
import MapCircle from './MapCircle';
|
|
20
|
-
import MapCallout from './MapCallout';
|
|
21
|
-
import MapCalloutSubview from './MapCalloutSubview';
|
|
22
|
-
import MapOverlay from './MapOverlay';
|
|
23
|
-
import MapUrlTile from './MapUrlTile';
|
|
24
|
-
import MapWMSTile from './MapWMSTile';
|
|
25
|
-
import MapLocalTile from './MapLocalTile';
|
|
26
|
-
import MapHeatMap from './MapHeatmap';
|
|
27
|
-
import AnimatedRegion from './AnimatedRegion';
|
|
28
|
-
import Geojson from './Geojson';
|
|
29
|
-
import {
|
|
30
|
-
contextTypes as childContextTypes,
|
|
31
|
-
getAirMapName,
|
|
32
|
-
googleMapIsInstalled,
|
|
33
|
-
createNotSupportedComponent,
|
|
34
|
-
} from './decorateMapComponent';
|
|
35
|
-
import * as ProviderConstants from './ProviderConstants';
|
|
36
|
-
|
|
37
|
-
export const MAP_TYPES = {
|
|
38
|
-
STANDARD: 'standard',
|
|
39
|
-
SATELLITE: 'satellite',
|
|
40
|
-
HYBRID: 'hybrid',
|
|
41
|
-
TERRAIN: 'terrain',
|
|
42
|
-
NONE: 'none',
|
|
43
|
-
MUTEDSTANDARD: 'mutedStandard',
|
|
44
|
-
};
|
|
45
|
-
|
|
46
|
-
const GOOGLE_MAPS_ONLY_TYPES = [MAP_TYPES.TERRAIN, MAP_TYPES.NONE];
|
|
47
|
-
|
|
48
|
-
const viewConfig = {
|
|
49
|
-
uiViewClassName: 'AIR<provider>Map',
|
|
50
|
-
validAttributes: {
|
|
51
|
-
region: true,
|
|
52
|
-
},
|
|
53
|
-
};
|
|
54
|
-
|
|
55
|
-
/**
|
|
56
|
-
* Defines the map camera.
|
|
57
|
-
*/
|
|
58
|
-
const CameraShape = PropTypes.shape({
|
|
59
|
-
center: PropTypes.shape({
|
|
60
|
-
latitude: PropTypes.number.isRequired,
|
|
61
|
-
longitude: PropTypes.number.isRequired,
|
|
62
|
-
}),
|
|
63
|
-
pitch: PropTypes.number.isRequired,
|
|
64
|
-
heading: PropTypes.number.isRequired,
|
|
65
|
-
altitude: PropTypes.number.isRequired,
|
|
66
|
-
zoom: PropTypes.number.isRequired,
|
|
67
|
-
});
|
|
68
|
-
|
|
69
|
-
const propTypes = {
|
|
70
|
-
...ViewPropTypes,
|
|
71
|
-
/**
|
|
72
|
-
* When provider is "google", we will use GoogleMaps.
|
|
73
|
-
* Any value other than "google" will default to using
|
|
74
|
-
* MapKit in iOS or GoogleMaps in android as the map provider.
|
|
75
|
-
*/
|
|
76
|
-
provider: PropTypes.oneOf(['google']),
|
|
77
|
-
|
|
78
|
-
/**
|
|
79
|
-
* Used to style and layout the `MapView`. See `StyleSheet.js` and
|
|
80
|
-
* `ViewStylePropTypes.js` for more info.
|
|
81
|
-
*/
|
|
82
|
-
style: ViewPropTypes.style,
|
|
83
|
-
|
|
84
|
-
/**
|
|
85
|
-
* A json object that describes the style of the map. This is transformed to a string
|
|
86
|
-
* and saved in mayStyleString to be sent to android and ios
|
|
87
|
-
* https://developers.google.com/maps/documentation/ios-sdk/styling#use_a_string_resource
|
|
88
|
-
* https://developers.google.com/maps/documentation/android-api/styling
|
|
89
|
-
*/
|
|
90
|
-
customMapStyle: PropTypes.array,
|
|
91
|
-
|
|
92
|
-
/**
|
|
93
|
-
* A json string that describes the style of the map
|
|
94
|
-
* https://developers.google.com/maps/documentation/ios-sdk/styling#use_a_string_resource
|
|
95
|
-
* https://developers.google.com/maps/documentation/android-api/styling
|
|
96
|
-
*/
|
|
97
|
-
customMapStyleString: PropTypes.string,
|
|
98
|
-
|
|
99
|
-
/**
|
|
100
|
-
* If `true` the app will ask for the user's location.
|
|
101
|
-
* Default value is `false`.
|
|
102
|
-
*
|
|
103
|
-
* **NOTE**: You need to add NSLocationWhenInUseUsageDescription key in
|
|
104
|
-
* Info.plist to enable geolocation, otherwise it is going
|
|
105
|
-
* to *fail silently*! You will also need to add an explanation for why
|
|
106
|
-
* you need the users location against `NSLocationWhenInUseUsageDescription` in Info.plist.
|
|
107
|
-
* Otherwise Apple may reject your app submission.
|
|
108
|
-
*/
|
|
109
|
-
showsUserLocation: PropTypes.bool,
|
|
110
|
-
|
|
111
|
-
/**
|
|
112
|
-
* The title of the annotation for current user location. This only works if
|
|
113
|
-
* `showsUserLocation` is true.
|
|
114
|
-
* There is a default value `My Location` set by MapView.
|
|
115
|
-
*
|
|
116
|
-
* @platform ios
|
|
117
|
-
*/
|
|
118
|
-
userLocationAnnotationTitle: PropTypes.string,
|
|
119
|
-
|
|
120
|
-
/**
|
|
121
|
-
* The user interface style for the map view
|
|
122
|
-
* There is a default value is the device settings.
|
|
123
|
-
*
|
|
124
|
-
* @platform ios
|
|
125
|
-
*/
|
|
126
|
-
userInterfaceStyle: PropTypes.oneOf(['light', 'dark']),
|
|
127
|
-
|
|
128
|
-
/**
|
|
129
|
-
* If `false` hide the button to move map to the current user's location.
|
|
130
|
-
* Default value is `true`.
|
|
131
|
-
*
|
|
132
|
-
* @platform android
|
|
133
|
-
*/
|
|
134
|
-
showsMyLocationButton: PropTypes.bool,
|
|
135
|
-
|
|
136
|
-
/**
|
|
137
|
-
* If `true` the map will focus on the user's location. This only works if
|
|
138
|
-
* `showsUserLocation` is true and the user has shared their location.
|
|
139
|
-
* Default value is `false`.
|
|
140
|
-
*
|
|
141
|
-
* @platform ios
|
|
142
|
-
*/
|
|
143
|
-
followsUserLocation: PropTypes.bool,
|
|
144
|
-
/**
|
|
145
|
-
* If `true` clicking user location will show the default callout for userLocation annotation
|
|
146
|
-
* Default value is `false`.
|
|
147
|
-
*
|
|
148
|
-
* @platform ios
|
|
149
|
-
*/
|
|
150
|
-
userLocationCalloutEnabled: PropTypes.bool,
|
|
151
|
-
|
|
152
|
-
/**
|
|
153
|
-
* If `false` points of interest won't be displayed on the map.
|
|
154
|
-
* Default value is `true`.
|
|
155
|
-
*
|
|
156
|
-
*/
|
|
157
|
-
showsPointsOfInterest: PropTypes.bool,
|
|
158
|
-
|
|
159
|
-
/**
|
|
160
|
-
* If `false` compass won't be displayed on the map.
|
|
161
|
-
* Default value is `true`.
|
|
162
|
-
*
|
|
163
|
-
* @platform ios
|
|
164
|
-
*/
|
|
165
|
-
showsCompass: PropTypes.bool,
|
|
166
|
-
|
|
167
|
-
/**
|
|
168
|
-
* If `false` the user won't be able to pinch/zoom the map.
|
|
169
|
-
* Default value is `true`.
|
|
170
|
-
*
|
|
171
|
-
*/
|
|
172
|
-
zoomEnabled: PropTypes.bool,
|
|
173
|
-
|
|
174
|
-
/**
|
|
175
|
-
* If `false` the user won't be able to double tap to zoom the map.
|
|
176
|
-
* However it will greatly decrease delay of tap gesture recognition.
|
|
177
|
-
* Default value is `true`.
|
|
178
|
-
*
|
|
179
|
-
*/
|
|
180
|
-
zoomTapEnabled: PropTypes.bool,
|
|
181
|
-
|
|
182
|
-
/**
|
|
183
|
-
*If `false` the user won't be able to zoom the map
|
|
184
|
-
* Default value is `true`.
|
|
185
|
-
*
|
|
186
|
-
*@platform android
|
|
187
|
-
*/
|
|
188
|
-
zoomControlEnabled: PropTypes.bool,
|
|
189
|
-
|
|
190
|
-
/**
|
|
191
|
-
* If `false` the user won't be able to pinch/rotate the map.
|
|
192
|
-
* Default value is `true`.
|
|
193
|
-
*
|
|
194
|
-
*/
|
|
195
|
-
rotateEnabled: PropTypes.bool,
|
|
196
|
-
|
|
197
|
-
/**
|
|
198
|
-
* If `false` the map will stay centered while rotating or zooming.
|
|
199
|
-
* Default value is `true`.
|
|
200
|
-
*
|
|
201
|
-
*/
|
|
202
|
-
scrollDuringRotateOrZoomEnabled: PropTypes.bool,
|
|
203
|
-
|
|
204
|
-
/**
|
|
205
|
-
* If `true` the map will be cached to an Image for performance
|
|
206
|
-
* Default value is `false`.
|
|
207
|
-
*
|
|
208
|
-
*/
|
|
209
|
-
cacheEnabled: PropTypes.bool,
|
|
210
|
-
|
|
211
|
-
/**
|
|
212
|
-
* If `true` the map will be showing a loading indicator
|
|
213
|
-
* Default value is `false`.
|
|
214
|
-
*
|
|
215
|
-
*/
|
|
216
|
-
loadingEnabled: PropTypes.bool,
|
|
217
|
-
|
|
218
|
-
/**
|
|
219
|
-
* Loading background color while generating map cache image or loading the map
|
|
220
|
-
* Default color is light gray.
|
|
221
|
-
*
|
|
222
|
-
*/
|
|
223
|
-
loadingBackgroundColor: ColorPropType,
|
|
224
|
-
|
|
225
|
-
/**
|
|
226
|
-
* Loading indicator color while generating map cache image or loading the map
|
|
227
|
-
* Default color is gray color for iOS, theme color for Android.
|
|
228
|
-
*
|
|
229
|
-
*/
|
|
230
|
-
loadingIndicatorColor: ColorPropType,
|
|
231
|
-
|
|
232
|
-
/**
|
|
233
|
-
* If `false` the user won't be able to change the map region being displayed.
|
|
234
|
-
* Default value is `true`.
|
|
235
|
-
*
|
|
236
|
-
*/
|
|
237
|
-
scrollEnabled: PropTypes.bool,
|
|
238
|
-
|
|
239
|
-
/**
|
|
240
|
-
* If `false` the user won't be able to adjust the camera’s pitch angle.
|
|
241
|
-
* Default value is `true`.
|
|
242
|
-
*
|
|
243
|
-
*/
|
|
244
|
-
pitchEnabled: PropTypes.bool,
|
|
245
|
-
|
|
246
|
-
/**
|
|
247
|
-
* If `false` will hide 'Navigate' and 'Open in Maps' buttons on marker press
|
|
248
|
-
* Default value is `true`.
|
|
249
|
-
*
|
|
250
|
-
* @platform android
|
|
251
|
-
*/
|
|
252
|
-
toolbarEnabled: PropTypes.bool,
|
|
253
|
-
|
|
254
|
-
/**
|
|
255
|
-
* A Boolean indicating whether on marker press the map will move to the pressed marker
|
|
256
|
-
* Default value is `true`
|
|
257
|
-
*
|
|
258
|
-
* @platform android
|
|
259
|
-
*/
|
|
260
|
-
moveOnMarkerPress: PropTypes.bool,
|
|
261
|
-
|
|
262
|
-
/**
|
|
263
|
-
* A Boolean indicating whether the map shows scale information.
|
|
264
|
-
* Default value is `false`
|
|
265
|
-
*
|
|
266
|
-
* @platform ios
|
|
267
|
-
*/
|
|
268
|
-
showsScale: PropTypes.bool,
|
|
269
|
-
|
|
270
|
-
/**
|
|
271
|
-
* A Boolean indicating whether the map displays extruded building information.
|
|
272
|
-
* Default value is `true`.
|
|
273
|
-
*/
|
|
274
|
-
showsBuildings: PropTypes.bool,
|
|
275
|
-
|
|
276
|
-
/**
|
|
277
|
-
* A Boolean value indicating whether the map displays traffic information.
|
|
278
|
-
* Default value is `false`.
|
|
279
|
-
*/
|
|
280
|
-
showsTraffic: PropTypes.bool,
|
|
281
|
-
|
|
282
|
-
/**
|
|
283
|
-
* A Boolean indicating whether indoor maps should be enabled.
|
|
284
|
-
* Default value is `false`
|
|
285
|
-
*
|
|
286
|
-
* @platform android
|
|
287
|
-
*/
|
|
288
|
-
showsIndoors: PropTypes.bool,
|
|
289
|
-
|
|
290
|
-
/**
|
|
291
|
-
* A Boolean indicating whether indoor level picker should be enabled.
|
|
292
|
-
* Default value is `false`
|
|
293
|
-
*
|
|
294
|
-
* @platform android
|
|
295
|
-
*/
|
|
296
|
-
showsIndoorLevelPicker: PropTypes.bool,
|
|
297
|
-
|
|
298
|
-
/**
|
|
299
|
-
* The map type to be displayed.
|
|
300
|
-
*
|
|
301
|
-
* - standard: standard road map (default)
|
|
302
|
-
* - satellite: satellite view
|
|
303
|
-
* - hybrid: satellite view with roads and points of interest overlayed
|
|
304
|
-
* - terrain: topographic view
|
|
305
|
-
* - none: no base map
|
|
306
|
-
*/
|
|
307
|
-
mapType: PropTypes.oneOf(Object.values(MAP_TYPES)),
|
|
308
|
-
|
|
309
|
-
/**
|
|
310
|
-
* The region to be displayed by the map.
|
|
311
|
-
*
|
|
312
|
-
* The region is defined by the center coordinates and the span of
|
|
313
|
-
* coordinates to display.
|
|
314
|
-
*/
|
|
315
|
-
region: PropTypes.shape({
|
|
316
|
-
/**
|
|
317
|
-
* Coordinates for the center of the map.
|
|
318
|
-
*/
|
|
319
|
-
latitude: PropTypes.number.isRequired,
|
|
320
|
-
longitude: PropTypes.number.isRequired,
|
|
321
|
-
|
|
322
|
-
/**
|
|
323
|
-
* Difference between the minimun and the maximum latitude/longitude
|
|
324
|
-
* to be displayed.
|
|
325
|
-
*/
|
|
326
|
-
latitudeDelta: PropTypes.number.isRequired,
|
|
327
|
-
longitudeDelta: PropTypes.number.isRequired,
|
|
328
|
-
}),
|
|
329
|
-
|
|
330
|
-
/**
|
|
331
|
-
* The initial region to be displayed by the map. Use this prop instead of `region`
|
|
332
|
-
* only if you don't want to control the viewport of the map besides the initial region.
|
|
333
|
-
*
|
|
334
|
-
* Changing this prop after the component has mounted will not result in a region change.
|
|
335
|
-
*
|
|
336
|
-
* This is similar to the `initialValue` prop of a text input.
|
|
337
|
-
*/
|
|
338
|
-
initialRegion: PropTypes.shape({
|
|
339
|
-
/**
|
|
340
|
-
* Coordinates for the center of the map.
|
|
341
|
-
*/
|
|
342
|
-
latitude: PropTypes.number.isRequired,
|
|
343
|
-
longitude: PropTypes.number.isRequired,
|
|
344
|
-
|
|
345
|
-
/**
|
|
346
|
-
* Difference between the minimun and the maximum latitude/longitude
|
|
347
|
-
* to be displayed.
|
|
348
|
-
*/
|
|
349
|
-
latitudeDelta: PropTypes.number.isRequired,
|
|
350
|
-
longitudeDelta: PropTypes.number.isRequired,
|
|
351
|
-
}),
|
|
352
|
-
|
|
353
|
-
/**
|
|
354
|
-
* The camera view the map should use.
|
|
355
|
-
*
|
|
356
|
-
* Use the camera system, instead of the region system, if you need control over
|
|
357
|
-
* the pitch or heading.
|
|
358
|
-
*/
|
|
359
|
-
camera: CameraShape,
|
|
360
|
-
|
|
361
|
-
/**
|
|
362
|
-
* The initial camera view the map should use. Use this prop instead of `camera`
|
|
363
|
-
* only if you don't want to control the camera of the map besides the initial view.
|
|
364
|
-
*
|
|
365
|
-
* Use the camera system, instead of the region system, if you need control over
|
|
366
|
-
* the pitch or heading.
|
|
367
|
-
*
|
|
368
|
-
* Changing this prop after the component has mounted will not result in a camera change.
|
|
369
|
-
*
|
|
370
|
-
* This is similar to the `initialValue` prop of a text input.
|
|
371
|
-
*/
|
|
372
|
-
initialCamera: CameraShape,
|
|
373
|
-
|
|
374
|
-
/**
|
|
375
|
-
* A Boolean indicating whether to use liteMode for android
|
|
376
|
-
* Default value is `false`
|
|
377
|
-
*
|
|
378
|
-
* @platform android
|
|
379
|
-
*/
|
|
380
|
-
liteMode: PropTypes.bool,
|
|
381
|
-
|
|
382
|
-
/**
|
|
383
|
-
* (Google Maps only)
|
|
384
|
-
*
|
|
385
|
-
* Padding that is used by the Google Map View to position
|
|
386
|
-
* the camera, legal labels and buttons
|
|
387
|
-
*
|
|
388
|
-
*/
|
|
389
|
-
mapPadding: EdgeInsetsPropType,
|
|
390
|
-
|
|
391
|
-
/**
|
|
392
|
-
* (Google Maps only, iOS)
|
|
393
|
-
*
|
|
394
|
-
* Whether the safe area padding is added to the Google Map View padding.
|
|
395
|
-
* This affects where markers, compass, Google logo etc. are placed on the view.
|
|
396
|
-
*
|
|
397
|
-
*/
|
|
398
|
-
paddingAdjustmentBehavior: PropTypes.oneOf(['always', 'automatic', 'never']),
|
|
399
|
-
|
|
400
|
-
/**
|
|
401
|
-
* Maximum size of area that can be displayed.
|
|
402
|
-
*
|
|
403
|
-
* @platform ios
|
|
404
|
-
*/
|
|
405
|
-
maxDelta: PropTypes.number,
|
|
406
|
-
|
|
407
|
-
/**
|
|
408
|
-
* Minimum size of area that can be displayed.
|
|
409
|
-
*
|
|
410
|
-
* @platform ios
|
|
411
|
-
*/
|
|
412
|
-
minDelta: PropTypes.number,
|
|
413
|
-
|
|
414
|
-
/**
|
|
415
|
-
* Insets for the map's legal label, originally at bottom left of the map.
|
|
416
|
-
* See `EdgeInsetsPropType.js` for more information.
|
|
417
|
-
*/
|
|
418
|
-
legalLabelInsets: EdgeInsetsPropType,
|
|
419
|
-
|
|
420
|
-
/**
|
|
421
|
-
* Callback that is called once the map is fully loaded.
|
|
422
|
-
*/
|
|
423
|
-
onMapReady: PropTypes.func,
|
|
424
|
-
|
|
425
|
-
/**
|
|
426
|
-
* Callback that is called once all tiles have been loaded
|
|
427
|
-
* (or failed permanently) and labels have been rendered.
|
|
428
|
-
*/
|
|
429
|
-
onMapLoaded: PropTypes.func,
|
|
430
|
-
|
|
431
|
-
/**
|
|
432
|
-
* Callback that is called once the kml is fully loaded.
|
|
433
|
-
*/
|
|
434
|
-
onKmlReady: PropTypes.func,
|
|
435
|
-
|
|
436
|
-
/**
|
|
437
|
-
* Callback that is called continuously when the user is dragging the map.
|
|
438
|
-
*/
|
|
439
|
-
onRegionChange: PropTypes.func,
|
|
440
|
-
|
|
441
|
-
/**
|
|
442
|
-
* Callback that is called once, when the user is done moving the map.
|
|
443
|
-
*/
|
|
444
|
-
onRegionChangeComplete: PropTypes.func,
|
|
445
|
-
|
|
446
|
-
/**
|
|
447
|
-
* Callback that is called when user taps on the map.
|
|
448
|
-
*/
|
|
449
|
-
onPress: PropTypes.func,
|
|
450
|
-
|
|
451
|
-
/**
|
|
452
|
-
* Callback that is called when user double taps on the map.
|
|
453
|
-
*/
|
|
454
|
-
onDoublePress: PropTypes.func,
|
|
455
|
-
|
|
456
|
-
/**
|
|
457
|
-
* Callback that is called when user makes a "long press" somewhere on the map.
|
|
458
|
-
*/
|
|
459
|
-
onLongPress: PropTypes.func,
|
|
460
|
-
|
|
461
|
-
/**
|
|
462
|
-
* Callback that is called when the underlying map figures our users current location.
|
|
463
|
-
*/
|
|
464
|
-
onUserLocationChange: PropTypes.func,
|
|
465
|
-
|
|
466
|
-
/**
|
|
467
|
-
* Callback that is called when user makes a "drag" somewhere on the map
|
|
468
|
-
*/
|
|
469
|
-
onPanDrag: PropTypes.func,
|
|
470
|
-
|
|
471
|
-
/**
|
|
472
|
-
* Callback that is called when user click on a POI
|
|
473
|
-
*/
|
|
474
|
-
onPoiClick: PropTypes.func,
|
|
475
|
-
|
|
476
|
-
/**
|
|
477
|
-
* Callback that is called when a marker on the map is tapped by the user.
|
|
478
|
-
*/
|
|
479
|
-
onMarkerPress: PropTypes.func,
|
|
480
|
-
|
|
481
|
-
/**
|
|
482
|
-
* Callback that is called when a marker on the map becomes selected. This will be called when
|
|
483
|
-
* the callout for that marker is about to be shown.
|
|
484
|
-
*
|
|
485
|
-
* @platform ios
|
|
486
|
-
*/
|
|
487
|
-
onMarkerSelect: PropTypes.func,
|
|
488
|
-
|
|
489
|
-
/**
|
|
490
|
-
* Callback that is called when a marker on the map becomes deselected. This will be called when
|
|
491
|
-
* the callout for that marker is about to be hidden.
|
|
492
|
-
*
|
|
493
|
-
* @platform ios
|
|
494
|
-
*/
|
|
495
|
-
onMarkerDeselect: PropTypes.func,
|
|
496
|
-
|
|
497
|
-
/**
|
|
498
|
-
* Callback that is called when a callout is tapped by the user.
|
|
499
|
-
*/
|
|
500
|
-
onCalloutPress: PropTypes.func,
|
|
501
|
-
|
|
502
|
-
/**
|
|
503
|
-
* Callback that is called when the user initiates a drag on a marker (if it is draggable)
|
|
504
|
-
*/
|
|
505
|
-
onMarkerDragStart: PropTypes.func,
|
|
506
|
-
|
|
507
|
-
/**
|
|
508
|
-
* Callback called continuously as a marker is dragged
|
|
509
|
-
*/
|
|
510
|
-
onMarkerDrag: PropTypes.func,
|
|
511
|
-
|
|
512
|
-
/**
|
|
513
|
-
* Callback that is called when a drag on a marker finishes. This is usually the point you
|
|
514
|
-
* will want to setState on the marker's coordinate again
|
|
515
|
-
*/
|
|
516
|
-
onMarkerDragEnd: PropTypes.func,
|
|
517
|
-
|
|
518
|
-
/**
|
|
519
|
-
* Minimum zoom value for the map, must be between 0 and 20
|
|
520
|
-
*/
|
|
521
|
-
minZoomLevel: PropTypes.number,
|
|
522
|
-
|
|
523
|
-
/**
|
|
524
|
-
* Maximum zoom value for the map, must be between 0 and 20
|
|
525
|
-
*/
|
|
526
|
-
maxZoomLevel: PropTypes.number,
|
|
527
|
-
|
|
528
|
-
/**
|
|
529
|
-
* Url KML Source
|
|
530
|
-
*/
|
|
531
|
-
kmlSrc: PropTypes.string,
|
|
532
|
-
|
|
533
|
-
/**
|
|
534
|
-
* Offset Point x y for compass location.
|
|
535
|
-
*
|
|
536
|
-
* @platform ios
|
|
537
|
-
*/
|
|
538
|
-
compassOffset: PointPropType,
|
|
539
|
-
|
|
540
|
-
/**
|
|
541
|
-
* Callback that is called when a level is activated on a indoor building.
|
|
542
|
-
*/
|
|
543
|
-
onIndoorLevelActivated: PropTypes.func,
|
|
544
|
-
|
|
545
|
-
/**
|
|
546
|
-
* Callback that is called when a Building is focused.
|
|
547
|
-
*/
|
|
548
|
-
onIndoorBuildingFocused: PropTypes.func,
|
|
549
|
-
|
|
550
|
-
/**
|
|
551
|
-
* Sets the tint color of the map. (Changes the color of the position indicator) Defaults to system blue.
|
|
552
|
-
*
|
|
553
|
-
* @platform ios
|
|
554
|
-
*/
|
|
555
|
-
tintColor: ColorPropType,
|
|
556
|
-
};
|
|
557
|
-
|
|
558
|
-
class MapView extends React.Component {
|
|
559
|
-
constructor(props) {
|
|
560
|
-
super(props);
|
|
561
|
-
|
|
562
|
-
this.state = {
|
|
563
|
-
isReady: Platform.OS === 'ios',
|
|
564
|
-
};
|
|
565
|
-
|
|
566
|
-
this._onMapReady = this._onMapReady.bind(this);
|
|
567
|
-
this._onMarkerPress = this._onMarkerPress.bind(this);
|
|
568
|
-
this._onChange = this._onChange.bind(this);
|
|
569
|
-
this._onLayout = this._onLayout.bind(this);
|
|
570
|
-
}
|
|
571
|
-
|
|
572
|
-
setNativeProps(props) {
|
|
573
|
-
this.map.setNativeProps(props);
|
|
574
|
-
}
|
|
575
|
-
|
|
576
|
-
getChildContext() {
|
|
577
|
-
return { provider: this.props.provider };
|
|
578
|
-
}
|
|
579
|
-
|
|
580
|
-
getSnapshotBeforeUpdate(prevProps) {
|
|
581
|
-
if (
|
|
582
|
-
this.state.isReady &&
|
|
583
|
-
this.props.customMapStyle !== prevProps.customMapStyle
|
|
584
|
-
) {
|
|
585
|
-
this._updateStyle(this.props);
|
|
586
|
-
}
|
|
587
|
-
return this.props.region || null;
|
|
588
|
-
}
|
|
589
|
-
|
|
590
|
-
componentDidUpdate(prevProps, prevState, region) {
|
|
591
|
-
const a = this.__lastRegion;
|
|
592
|
-
const b = region;
|
|
593
|
-
if (!a || !b) {
|
|
594
|
-
return;
|
|
595
|
-
}
|
|
596
|
-
if (
|
|
597
|
-
a.latitude !== b.latitude ||
|
|
598
|
-
a.longitude !== b.longitude ||
|
|
599
|
-
a.latitudeDelta !== b.latitudeDelta ||
|
|
600
|
-
a.longitudeDelta !== b.longitudeDelta
|
|
601
|
-
) {
|
|
602
|
-
this.map.setNativeProps({ region: b });
|
|
603
|
-
}
|
|
604
|
-
}
|
|
605
|
-
|
|
606
|
-
componentDidMount() {
|
|
607
|
-
const { isReady } = this.state;
|
|
608
|
-
if (isReady) {
|
|
609
|
-
this._updateStyle(this.props);
|
|
610
|
-
}
|
|
611
|
-
}
|
|
612
|
-
|
|
613
|
-
_updateStyle(props) {
|
|
614
|
-
const { customMapStyle } = props;
|
|
615
|
-
this.map.setNativeProps({
|
|
616
|
-
customMapStyleString: JSON.stringify(customMapStyle),
|
|
617
|
-
});
|
|
618
|
-
}
|
|
619
|
-
|
|
620
|
-
_onMapReady() {
|
|
621
|
-
const { region, initialRegion, onMapReady } = this.props;
|
|
622
|
-
if (region) {
|
|
623
|
-
this.map.setNativeProps({ region });
|
|
624
|
-
} else if (initialRegion) {
|
|
625
|
-
this.map.setNativeProps({ initialRegion });
|
|
626
|
-
}
|
|
627
|
-
this._updateStyle(this.props);
|
|
628
|
-
this.setState({ isReady: true }, () => {
|
|
629
|
-
if (onMapReady) {
|
|
630
|
-
onMapReady();
|
|
631
|
-
}
|
|
632
|
-
});
|
|
633
|
-
}
|
|
634
|
-
|
|
635
|
-
_onLayout(e) {
|
|
636
|
-
const { layout } = e.nativeEvent;
|
|
637
|
-
if (!layout.width || !layout.height) {
|
|
638
|
-
return;
|
|
639
|
-
}
|
|
640
|
-
if (this.state.isReady && !this.__layoutCalled) {
|
|
641
|
-
const { region, initialRegion } = this.props;
|
|
642
|
-
if (region) {
|
|
643
|
-
this.__layoutCalled = true;
|
|
644
|
-
this.map.setNativeProps({ region });
|
|
645
|
-
} else if (initialRegion) {
|
|
646
|
-
this.__layoutCalled = true;
|
|
647
|
-
this.map.setNativeProps({ initialRegion });
|
|
648
|
-
}
|
|
649
|
-
}
|
|
650
|
-
if (this.props.onLayout) {
|
|
651
|
-
this.props.onLayout(e);
|
|
652
|
-
}
|
|
653
|
-
}
|
|
654
|
-
|
|
655
|
-
_onMarkerPress(event) {
|
|
656
|
-
if (this.props.onMarkerPress) {
|
|
657
|
-
this.props.onMarkerPress(event.nativeEvent);
|
|
658
|
-
}
|
|
659
|
-
}
|
|
660
|
-
|
|
661
|
-
_onChange({ nativeEvent }) {
|
|
662
|
-
this.__lastRegion = nativeEvent.region;
|
|
663
|
-
const isGesture = nativeEvent.isGesture;
|
|
664
|
-
const details = { isGesture };
|
|
665
|
-
|
|
666
|
-
if (nativeEvent.continuous) {
|
|
667
|
-
if (this.props.onRegionChange) {
|
|
668
|
-
this.props.onRegionChange(nativeEvent.region, details);
|
|
669
|
-
}
|
|
670
|
-
} else if (this.props.onRegionChangeComplete) {
|
|
671
|
-
this.props.onRegionChangeComplete(nativeEvent.region, details);
|
|
672
|
-
}
|
|
673
|
-
}
|
|
674
|
-
|
|
675
|
-
getCamera() {
|
|
676
|
-
if (Platform.OS === 'android') {
|
|
677
|
-
return NativeModules.AirMapModule.getCamera(this._getHandle());
|
|
678
|
-
} else if (Platform.OS === 'ios') {
|
|
679
|
-
return this._runCommand('getCamera', []);
|
|
680
|
-
}
|
|
681
|
-
return Promise.reject('getCamera not supported on this platform');
|
|
682
|
-
}
|
|
683
|
-
|
|
684
|
-
setCamera(camera) {
|
|
685
|
-
this._runCommand('setCamera', [camera]);
|
|
686
|
-
}
|
|
687
|
-
|
|
688
|
-
animateCamera(camera, opts) {
|
|
689
|
-
this._runCommand('animateCamera', [camera, opts ? opts.duration : 500]);
|
|
690
|
-
}
|
|
691
|
-
|
|
692
|
-
animateToNavigation(location, bearing, angle, duration) {
|
|
693
|
-
console.warn(
|
|
694
|
-
'animateToNavigation() is deprecated, use animateCamera() instead'
|
|
695
|
-
);
|
|
696
|
-
this._runCommand('animateToNavigation', [
|
|
697
|
-
location,
|
|
698
|
-
bearing,
|
|
699
|
-
angle,
|
|
700
|
-
duration || 500,
|
|
701
|
-
]);
|
|
702
|
-
}
|
|
703
|
-
|
|
704
|
-
animateToRegion(region, duration) {
|
|
705
|
-
this._runCommand('animateToRegion', [region, duration || 500]);
|
|
706
|
-
}
|
|
707
|
-
|
|
708
|
-
animateToCoordinate(latLng, duration) {
|
|
709
|
-
console.warn(
|
|
710
|
-
'animateToCoordinate() is deprecated, use animateCamera() instead'
|
|
711
|
-
);
|
|
712
|
-
this._runCommand('animateToCoordinate', [latLng, duration || 500]);
|
|
713
|
-
}
|
|
714
|
-
|
|
715
|
-
animateToBearing(bearing, duration) {
|
|
716
|
-
console.warn(
|
|
717
|
-
'animateToBearing() is deprecated, use animateCamera() instead'
|
|
718
|
-
);
|
|
719
|
-
this._runCommand('animateToBearing', [bearing, duration || 500]);
|
|
720
|
-
}
|
|
721
|
-
|
|
722
|
-
animateToViewingAngle(angle, duration) {
|
|
723
|
-
console.warn(
|
|
724
|
-
'animateToViewingAngle() is deprecated, use animateCamera() instead'
|
|
725
|
-
);
|
|
726
|
-
this._runCommand('animateToViewingAngle', [angle, duration || 500]);
|
|
727
|
-
}
|
|
728
|
-
|
|
729
|
-
fitToElements(options = {}) {
|
|
730
|
-
const {
|
|
731
|
-
edgePadding = { top: 0, right: 0, bottom: 0, left: 0 },
|
|
732
|
-
animated = true,
|
|
733
|
-
} = options;
|
|
734
|
-
|
|
735
|
-
this._runCommand('fitToElements', [edgePadding, animated]);
|
|
736
|
-
}
|
|
737
|
-
|
|
738
|
-
fitToSuppliedMarkers(markers, options = {}) {
|
|
739
|
-
const {
|
|
740
|
-
edgePadding = { top: 0, right: 0, bottom: 0, left: 0 },
|
|
741
|
-
animated = true,
|
|
742
|
-
} = options;
|
|
743
|
-
|
|
744
|
-
this._runCommand('fitToSuppliedMarkers', [markers, edgePadding, animated]);
|
|
745
|
-
}
|
|
746
|
-
|
|
747
|
-
fitToCoordinates(coordinates = [], options = {}) {
|
|
748
|
-
const {
|
|
749
|
-
edgePadding = { top: 0, right: 0, bottom: 0, left: 0 },
|
|
750
|
-
animated = true,
|
|
751
|
-
} = options;
|
|
752
|
-
|
|
753
|
-
this._runCommand('fitToCoordinates', [coordinates, edgePadding, animated]);
|
|
754
|
-
}
|
|
755
|
-
|
|
756
|
-
/**
|
|
757
|
-
* Get visible boudaries
|
|
758
|
-
*
|
|
759
|
-
* @return Promise Promise with the bounding box ({ northEast: <LatLng>, southWest: <LatLng> })
|
|
760
|
-
*/
|
|
761
|
-
async getMapBoundaries() {
|
|
762
|
-
if (Platform.OS === 'android') {
|
|
763
|
-
return await NativeModules.AirMapModule.getMapBoundaries(
|
|
764
|
-
this._getHandle()
|
|
765
|
-
);
|
|
766
|
-
} else if (Platform.OS === 'ios') {
|
|
767
|
-
return await this._runCommand('getMapBoundaries', []);
|
|
768
|
-
}
|
|
769
|
-
return Promise.reject('getMapBoundaries not supported on this platform');
|
|
770
|
-
}
|
|
771
|
-
|
|
772
|
-
setMapBoundaries(northEast, southWest) {
|
|
773
|
-
this._runCommand('setMapBoundaries', [northEast, southWest]);
|
|
774
|
-
}
|
|
775
|
-
|
|
776
|
-
setIndoorActiveLevelIndex(activeLevelIndex) {
|
|
777
|
-
this._runCommand('setIndoorActiveLevelIndex', [activeLevelIndex]);
|
|
778
|
-
}
|
|
779
|
-
|
|
780
|
-
/**
|
|
781
|
-
* Takes a snapshot of the map and saves it to a picture
|
|
782
|
-
* file or returns the image as a base64 encoded string.
|
|
783
|
-
*
|
|
784
|
-
* @param config Configuration options
|
|
785
|
-
* @param [config.width] Width of the rendered map-view (when omitted actual view width is used).
|
|
786
|
-
* @param [config.height] Height of the rendered map-view (when omitted actual height is used).
|
|
787
|
-
* @param [config.region] Region to render (Only supported on iOS).
|
|
788
|
-
* @param [config.format] Encoding format ('png', 'jpg') (default: 'png').
|
|
789
|
-
* @param [config.quality] Compression quality (only used for jpg) (default: 1.0).
|
|
790
|
-
* @param [config.result] Result format ('file', 'base64') (default: 'file').
|
|
791
|
-
*
|
|
792
|
-
* @return Promise Promise with either the file-uri or base64 encoded string
|
|
793
|
-
*/
|
|
794
|
-
takeSnapshot(args) {
|
|
795
|
-
// For the time being we support the legacy API on iOS.
|
|
796
|
-
// This will be removed in a future release and only the
|
|
797
|
-
// new Promise style API shall be supported.
|
|
798
|
-
if (Platform.OS === 'ios' && arguments.length === 4) {
|
|
799
|
-
console.warn(
|
|
800
|
-
'Old takeSnapshot API has been deprecated; will be removed in the near future'
|
|
801
|
-
);
|
|
802
|
-
const width = arguments[0];
|
|
803
|
-
const height = arguments[1];
|
|
804
|
-
const region = arguments[2];
|
|
805
|
-
const callback = arguments[3];
|
|
806
|
-
this._runCommand('takeSnapshot', [
|
|
807
|
-
width || 0,
|
|
808
|
-
height || 0,
|
|
809
|
-
region || {},
|
|
810
|
-
'png',
|
|
811
|
-
1,
|
|
812
|
-
'legacy',
|
|
813
|
-
callback,
|
|
814
|
-
]);
|
|
815
|
-
return undefined;
|
|
816
|
-
}
|
|
817
|
-
|
|
818
|
-
// Sanitize inputs
|
|
819
|
-
const config = {
|
|
820
|
-
width: args.width || 0,
|
|
821
|
-
height: args.height || 0,
|
|
822
|
-
region: args.region || {},
|
|
823
|
-
format: args.format || 'png',
|
|
824
|
-
quality: args.quality || 1.0,
|
|
825
|
-
result: args.result || 'file',
|
|
826
|
-
};
|
|
827
|
-
if (config.format !== 'png' && config.format !== 'jpg') {
|
|
828
|
-
throw new Error('Invalid format specified');
|
|
829
|
-
}
|
|
830
|
-
if (config.result !== 'file' && config.result !== 'base64') {
|
|
831
|
-
throw new Error('Invalid result specified');
|
|
832
|
-
}
|
|
833
|
-
|
|
834
|
-
// Call native function
|
|
835
|
-
if (Platform.OS === 'android') {
|
|
836
|
-
return NativeModules.AirMapModule.takeSnapshot(this._getHandle(), config);
|
|
837
|
-
} else if (Platform.OS === 'ios') {
|
|
838
|
-
return new Promise((resolve, reject) => {
|
|
839
|
-
this._runCommand('takeSnapshot', [
|
|
840
|
-
config.width,
|
|
841
|
-
config.height,
|
|
842
|
-
config.region,
|
|
843
|
-
config.format,
|
|
844
|
-
config.quality,
|
|
845
|
-
config.result,
|
|
846
|
-
(err, snapshot) => {
|
|
847
|
-
if (err) {
|
|
848
|
-
reject(err);
|
|
849
|
-
} else {
|
|
850
|
-
resolve(snapshot);
|
|
851
|
-
}
|
|
852
|
-
},
|
|
853
|
-
]);
|
|
854
|
-
});
|
|
855
|
-
}
|
|
856
|
-
return Promise.reject('takeSnapshot not supported on this platform');
|
|
857
|
-
}
|
|
858
|
-
|
|
859
|
-
/**
|
|
860
|
-
* Convert a coordinate to address by using default Geocoder
|
|
861
|
-
*
|
|
862
|
-
* @param coordinate Coordinate
|
|
863
|
-
* @param [coordinate.latitude] Latitude
|
|
864
|
-
* @param [coordinate.longitude] Longitude
|
|
865
|
-
*
|
|
866
|
-
* @return Promise with return type Address
|
|
867
|
-
*/
|
|
868
|
-
addressForCoordinate(coordinate) {
|
|
869
|
-
if (Platform.OS === 'android') {
|
|
870
|
-
return NativeModules.AirMapModule.getAddressFromCoordinates(
|
|
871
|
-
this._getHandle(),
|
|
872
|
-
coordinate
|
|
873
|
-
);
|
|
874
|
-
} else if (Platform.OS === 'ios') {
|
|
875
|
-
return this._runCommand('getAddressFromCoordinates', [coordinate]);
|
|
876
|
-
}
|
|
877
|
-
return Promise.reject('getAddress not supported on this platform');
|
|
878
|
-
}
|
|
879
|
-
|
|
880
|
-
/**
|
|
881
|
-
* Convert a map coordinate to user-space point
|
|
882
|
-
*
|
|
883
|
-
* @param coordinate Coordinate
|
|
884
|
-
* @param [coordinate.latitude] Latitude
|
|
885
|
-
* @param [coordinate.longitude] Longitude
|
|
886
|
-
*
|
|
887
|
-
* @return Promise Promise with the point ({ x: Number, y: Number })
|
|
888
|
-
*/
|
|
889
|
-
pointForCoordinate(coordinate) {
|
|
890
|
-
if (Platform.OS === 'android') {
|
|
891
|
-
return NativeModules.AirMapModule.pointForCoordinate(
|
|
892
|
-
this._getHandle(),
|
|
893
|
-
coordinate
|
|
894
|
-
);
|
|
895
|
-
} else if (Platform.OS === 'ios') {
|
|
896
|
-
return this._runCommand('pointForCoordinate', [coordinate]);
|
|
897
|
-
}
|
|
898
|
-
return Promise.reject('pointForCoordinate not supported on this platform');
|
|
899
|
-
}
|
|
900
|
-
|
|
901
|
-
/**
|
|
902
|
-
* Convert a user-space point to a map coordinate
|
|
903
|
-
*
|
|
904
|
-
* @param point Point
|
|
905
|
-
* @param [point.x] X
|
|
906
|
-
* @param [point.x] Y
|
|
907
|
-
*
|
|
908
|
-
* @return Promise Promise with the coordinate ({ latitude: Number, longitude: Number })
|
|
909
|
-
*/
|
|
910
|
-
coordinateForPoint(point) {
|
|
911
|
-
if (Platform.OS === 'android') {
|
|
912
|
-
return NativeModules.AirMapModule.coordinateForPoint(
|
|
913
|
-
this._getHandle(),
|
|
914
|
-
point
|
|
915
|
-
);
|
|
916
|
-
} else if (Platform.OS === 'ios') {
|
|
917
|
-
return this._runCommand('coordinateForPoint', [point]);
|
|
918
|
-
}
|
|
919
|
-
return Promise.reject('coordinateForPoint not supported on this platform');
|
|
920
|
-
}
|
|
921
|
-
|
|
922
|
-
/**
|
|
923
|
-
* Get markers' centers and frames in user-space coordinates
|
|
924
|
-
*
|
|
925
|
-
* @param onlyVisible boolean true to include only visible markers, false to include all
|
|
926
|
-
*
|
|
927
|
-
* @return Promise Promise with { <identifier>: { point: Point, frame: Frame } }
|
|
928
|
-
*/
|
|
929
|
-
getMarkersFrames(onlyVisible = false) {
|
|
930
|
-
if (Platform.OS === 'ios') {
|
|
931
|
-
return this._runCommand('getMarkersFrames', [onlyVisible]);
|
|
932
|
-
}
|
|
933
|
-
return Promise.reject('getMarkersFrames not supported on this platform');
|
|
934
|
-
}
|
|
935
|
-
|
|
936
|
-
/**
|
|
937
|
-
* Get bounding box from region
|
|
938
|
-
*
|
|
939
|
-
* @param region Region
|
|
940
|
-
*
|
|
941
|
-
* @return Object Object bounding box ({ northEast: <LatLng>, southWest: <LatLng> })
|
|
942
|
-
*/
|
|
943
|
-
boundingBoxForRegion(region) {
|
|
944
|
-
return {
|
|
945
|
-
northEast: {
|
|
946
|
-
latitude: region.latitude + region.latitudeDelta / 2,
|
|
947
|
-
longitude: region.longitude + region.longitudeDelta / 2,
|
|
948
|
-
},
|
|
949
|
-
southWest: {
|
|
950
|
-
latitude: region.latitude - region.latitudeDelta / 2,
|
|
951
|
-
longitude: region.longitude - region.longitudeDelta / 2,
|
|
952
|
-
},
|
|
953
|
-
};
|
|
954
|
-
}
|
|
955
|
-
|
|
956
|
-
_uiManagerCommand(name) {
|
|
957
|
-
const UIManager = NativeModules.UIManager;
|
|
958
|
-
const componentName = getAirMapName(this.props.provider);
|
|
959
|
-
|
|
960
|
-
if (!UIManager.getViewManagerConfig) {
|
|
961
|
-
// RN < 0.58
|
|
962
|
-
return UIManager[componentName].Commands[name];
|
|
963
|
-
}
|
|
964
|
-
|
|
965
|
-
// RN >= 0.58
|
|
966
|
-
return UIManager.getViewManagerConfig(componentName).Commands[name];
|
|
967
|
-
}
|
|
968
|
-
|
|
969
|
-
_mapManagerCommand(name) {
|
|
970
|
-
const managerName = getAirMapName(this.props.provider);
|
|
971
|
-
|
|
972
|
-
if (managerName === 'UI') {
|
|
973
|
-
const UIManager = NativeModules.UIManager;
|
|
974
|
-
if (!UIManager.getViewManagerConfig) {
|
|
975
|
-
// RN < 0.58
|
|
976
|
-
return UIManager[name];
|
|
977
|
-
}
|
|
978
|
-
|
|
979
|
-
// RN >= 0.58
|
|
980
|
-
return UIManager.getViewManagerConfig(name);
|
|
981
|
-
}
|
|
982
|
-
|
|
983
|
-
return NativeModules[`${getAirMapName(this.props.provider)}Manager`][name];
|
|
984
|
-
}
|
|
985
|
-
|
|
986
|
-
_getHandle() {
|
|
987
|
-
return findNodeHandle(this.map);
|
|
988
|
-
}
|
|
989
|
-
|
|
990
|
-
_runCommand(name, args) {
|
|
991
|
-
switch (Platform.OS) {
|
|
992
|
-
case 'android':
|
|
993
|
-
return NativeModules.UIManager.dispatchViewManagerCommand(
|
|
994
|
-
this._getHandle(),
|
|
995
|
-
this._uiManagerCommand(name),
|
|
996
|
-
args
|
|
997
|
-
);
|
|
998
|
-
|
|
999
|
-
case 'ios':
|
|
1000
|
-
return this._mapManagerCommand(name)(this._getHandle(), ...args);
|
|
1001
|
-
|
|
1002
|
-
default:
|
|
1003
|
-
return Promise.reject(`Invalid platform was passed: ${Platform.OS}`);
|
|
1004
|
-
}
|
|
1005
|
-
}
|
|
1006
|
-
|
|
1007
|
-
render() {
|
|
1008
|
-
let props;
|
|
1009
|
-
|
|
1010
|
-
if (this.state.isReady) {
|
|
1011
|
-
props = {
|
|
1012
|
-
region: null,
|
|
1013
|
-
initialRegion: null,
|
|
1014
|
-
onMarkerPress: this._onMarkerPress,
|
|
1015
|
-
onChange: this._onChange,
|
|
1016
|
-
onMapReady: this._onMapReady,
|
|
1017
|
-
onLayout: this._onLayout,
|
|
1018
|
-
...this.props,
|
|
1019
|
-
};
|
|
1020
|
-
if (
|
|
1021
|
-
Platform.OS === 'ios' &&
|
|
1022
|
-
props.provider === ProviderConstants.PROVIDER_DEFAULT &&
|
|
1023
|
-
GOOGLE_MAPS_ONLY_TYPES.includes(props.mapType)
|
|
1024
|
-
) {
|
|
1025
|
-
props.mapType = MAP_TYPES.standard;
|
|
1026
|
-
}
|
|
1027
|
-
if (props.onPanDrag) {
|
|
1028
|
-
props.handlePanDrag = !!props.onPanDrag;
|
|
1029
|
-
}
|
|
1030
|
-
} else {
|
|
1031
|
-
props = {
|
|
1032
|
-
style: this.props.style,
|
|
1033
|
-
region: null,
|
|
1034
|
-
initialRegion: this.props.initialRegion || null,
|
|
1035
|
-
onMarkerPress: this._onMarkerPress,
|
|
1036
|
-
onChange: this._onChange,
|
|
1037
|
-
onMapReady: this._onMapReady,
|
|
1038
|
-
onLayout: this._onLayout,
|
|
1039
|
-
};
|
|
1040
|
-
}
|
|
1041
|
-
|
|
1042
|
-
if (Platform.OS === 'android' && this.props.liteMode) {
|
|
1043
|
-
return (
|
|
1044
|
-
<AIRMapLite
|
|
1045
|
-
ref={(ref) => {
|
|
1046
|
-
this.map = ref;
|
|
1047
|
-
}}
|
|
1048
|
-
{...props}
|
|
1049
|
-
/>
|
|
1050
|
-
);
|
|
1051
|
-
}
|
|
1052
|
-
|
|
1053
|
-
const AIRMap = getAirMapComponent(this.props.provider);
|
|
1054
|
-
|
|
1055
|
-
return (
|
|
1056
|
-
<AIRMap
|
|
1057
|
-
ref={(ref) => {
|
|
1058
|
-
this.map = ref;
|
|
1059
|
-
}}
|
|
1060
|
-
{...props}
|
|
1061
|
-
/>
|
|
1062
|
-
);
|
|
1063
|
-
}
|
|
1064
|
-
}
|
|
1065
|
-
|
|
1066
|
-
MapView.propTypes = propTypes;
|
|
1067
|
-
MapView.viewConfig = viewConfig;
|
|
1068
|
-
MapView.childContextTypes = childContextTypes;
|
|
1069
|
-
|
|
1070
|
-
MapView.MAP_TYPES = MAP_TYPES;
|
|
1071
|
-
|
|
1072
|
-
const nativeComponent = (Component) =>
|
|
1073
|
-
requireNativeComponent(Component, MapView, {
|
|
1074
|
-
nativeOnly: {
|
|
1075
|
-
onChange: true,
|
|
1076
|
-
onMapReady: true,
|
|
1077
|
-
onKmlReady: true,
|
|
1078
|
-
handlePanDrag: true,
|
|
1079
|
-
},
|
|
1080
|
-
});
|
|
1081
|
-
const airMaps = {
|
|
1082
|
-
default: nativeComponent('AIRMap'),
|
|
1083
|
-
};
|
|
1084
|
-
if (Platform.OS === 'android') {
|
|
1085
|
-
airMaps.google = airMaps.default;
|
|
1086
|
-
} else {
|
|
1087
|
-
airMaps.google = googleMapIsInstalled
|
|
1088
|
-
? nativeComponent('AIRGoogleMap')
|
|
1089
|
-
: createNotSupportedComponent(
|
|
1090
|
-
'react-native-maps: AirGoogleMaps dir must be added to your xCode project to support GoogleMaps on iOS.'
|
|
1091
|
-
);
|
|
1092
|
-
}
|
|
1093
|
-
const getAirMapComponent = (provider) => airMaps[provider || 'default'];
|
|
1094
|
-
|
|
1095
|
-
let AIRMapLite;
|
|
1096
|
-
if (!NativeModules.UIManager.getViewManagerConfig) {
|
|
1097
|
-
// RN < 0.58
|
|
1098
|
-
AIRMapLite =
|
|
1099
|
-
NativeModules.UIManager.AIRMapLite &&
|
|
1100
|
-
requireNativeComponent('AIRMapLite', MapView, {
|
|
1101
|
-
nativeOnly: {
|
|
1102
|
-
onChange: true,
|
|
1103
|
-
onMapReady: true,
|
|
1104
|
-
handlePanDrag: true,
|
|
1105
|
-
},
|
|
1106
|
-
});
|
|
1107
|
-
} else {
|
|
1108
|
-
// RN >= 0.58
|
|
1109
|
-
AIRMapLite =
|
|
1110
|
-
NativeModules.UIManager.getViewManagerConfig('AIRMapLite') &&
|
|
1111
|
-
requireNativeComponent('AIRMapLite', MapView, {
|
|
1112
|
-
nativeOnly: {
|
|
1113
|
-
onChange: true,
|
|
1114
|
-
onMapReady: true,
|
|
1115
|
-
handlePanDrag: true,
|
|
1116
|
-
},
|
|
1117
|
-
});
|
|
1118
|
-
}
|
|
1119
|
-
|
|
1120
|
-
export const Animated = RNAnimated.createAnimatedComponent(MapView);
|
|
1121
|
-
|
|
1122
|
-
export const enableLatestRenderer = () => {
|
|
1123
|
-
if (Platform.OS !== 'android') {
|
|
1124
|
-
return;
|
|
1125
|
-
}
|
|
1126
|
-
return NativeModules.AirMapModule.enableLatestRenderer();
|
|
1127
|
-
};
|
|
1128
|
-
|
|
1129
|
-
export const ProviderPropType = PropTypes.oneOf(
|
|
1130
|
-
Object.values(ProviderConstants)
|
|
1131
|
-
);
|
|
1132
|
-
|
|
1133
|
-
/**
|
|
1134
|
-
* TODO:
|
|
1135
|
-
* All of these properties on MapView are unecessary since they can be imported
|
|
1136
|
-
* individually with the es6 exports in index.js. Removing them is a breaking change,
|
|
1137
|
-
* but potentially allows for better dead code elimination since references are not
|
|
1138
|
-
* kept to components which are never used.
|
|
1139
|
-
*/
|
|
1140
|
-
|
|
1141
|
-
MapView.Marker = MapMarker;
|
|
1142
|
-
MapView.Polyline = MapPolyline;
|
|
1143
|
-
MapView.Polygon = MapPolygon;
|
|
1144
|
-
MapView.Circle = MapCircle;
|
|
1145
|
-
MapView.UrlTile = MapUrlTile;
|
|
1146
|
-
MapView.MapWMSTile = MapWMSTile;
|
|
1147
|
-
MapView.LocalTile = MapLocalTile;
|
|
1148
|
-
MapView.Heatmap = MapHeatMap;
|
|
1149
|
-
MapView.Overlay = MapOverlay;
|
|
1150
|
-
MapView.Callout = MapCallout;
|
|
1151
|
-
MapView.CalloutSubview = MapCalloutSubview;
|
|
1152
|
-
Object.assign(MapView, ProviderConstants);
|
|
1153
|
-
MapView.ProviderPropType = ProviderPropType;
|
|
1154
|
-
|
|
1155
|
-
MapView.Animated = Animated;
|
|
1156
|
-
MapView.AnimatedRegion = AnimatedRegion;
|
|
1157
|
-
|
|
1158
|
-
MapView.Geojson = Geojson;
|
|
1159
|
-
|
|
1160
|
-
export default MapView;
|