@maplibre/maplibre-react-native 8.6.0-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.eslintignore +3 -0
- package/.eslintrc.js +158 -0
- package/.gitattributes +1 -0
- package/.nvmrc +1 -0
- package/.prettierrc.js +7 -0
- package/.sonarcloud.properties +15 -0
- package/CHANGELOG.md +367 -0
- package/CODE_OF_CONDUCT.md +2 -0
- package/CONTRIBUTING.md +34 -0
- package/LICENSE.md +9 -0
- package/README.md +224 -0
- package/RELEASE.md +30 -0
- package/android/build.gradle +34 -0
- package/android/install.md +16 -0
- package/android/rctmgl/.settings/org.eclipse.buildship.core.prefs +2 -0
- package/android/rctmgl/build.gradle +61 -0
- package/android/rctmgl/proguard-rules.pro +25 -0
- package/android/rctmgl/src/main/AndroidManifest.xml +4 -0
- package/android/rctmgl/src/main/java/com/mapbox/rctmgl/RCTMGLPackage.java +99 -0
- package/android/rctmgl/src/main/java/com/mapbox/rctmgl/components/AbstractEvent.java +35 -0
- package/android/rctmgl/src/main/java/com/mapbox/rctmgl/components/AbstractEventEmitter.java +80 -0
- package/android/rctmgl/src/main/java/com/mapbox/rctmgl/components/AbstractMapFeature.java +19 -0
- package/android/rctmgl/src/main/java/com/mapbox/rctmgl/components/annotation/MarkerView.java +23 -0
- package/android/rctmgl/src/main/java/com/mapbox/rctmgl/components/annotation/MarkerViewManager.java +67 -0
- package/android/rctmgl/src/main/java/com/mapbox/rctmgl/components/annotation/RCTMGLCallout.java +15 -0
- package/android/rctmgl/src/main/java/com/mapbox/rctmgl/components/annotation/RCTMGLCalloutManager.java +22 -0
- package/android/rctmgl/src/main/java/com/mapbox/rctmgl/components/annotation/RCTMGLMarkerView.java +112 -0
- package/android/rctmgl/src/main/java/com/mapbox/rctmgl/components/annotation/RCTMGLMarkerViewManager.java +45 -0
- package/android/rctmgl/src/main/java/com/mapbox/rctmgl/components/annotation/RCTMGLPointAnnotation.java +360 -0
- package/android/rctmgl/src/main/java/com/mapbox/rctmgl/components/annotation/RCTMGLPointAnnotationManager.java +88 -0
- package/android/rctmgl/src/main/java/com/mapbox/rctmgl/components/camera/CameraStop.java +249 -0
- package/android/rctmgl/src/main/java/com/mapbox/rctmgl/components/camera/CameraUpdateItem.java +125 -0
- package/android/rctmgl/src/main/java/com/mapbox/rctmgl/components/camera/CameraUpdateQueue.java +73 -0
- package/android/rctmgl/src/main/java/com/mapbox/rctmgl/components/camera/RCTMGLCamera.java +530 -0
- package/android/rctmgl/src/main/java/com/mapbox/rctmgl/components/camera/RCTMGLCameraManager.java +101 -0
- package/android/rctmgl/src/main/java/com/mapbox/rctmgl/components/camera/constants/CameraMode.java +22 -0
- package/android/rctmgl/src/main/java/com/mapbox/rctmgl/components/images/RCTMGLImages.java +234 -0
- package/android/rctmgl/src/main/java/com/mapbox/rctmgl/components/images/RCTMGLImagesManager.java +103 -0
- package/android/rctmgl/src/main/java/com/mapbox/rctmgl/components/location/LocationComponentManager.java +149 -0
- package/android/rctmgl/src/main/java/com/mapbox/rctmgl/components/location/RCTMGLNativeUserLocation.java +66 -0
- package/android/rctmgl/src/main/java/com/mapbox/rctmgl/components/location/RCTMGLNativeUserLocationManager.java +35 -0
- package/android/rctmgl/src/main/java/com/mapbox/rctmgl/components/mapview/LayerSourceInfo.java +59 -0
- package/android/rctmgl/src/main/java/com/mapbox/rctmgl/components/mapview/RCTMGLAndroidTextureMapView.java +16 -0
- package/android/rctmgl/src/main/java/com/mapbox/rctmgl/components/mapview/RCTMGLAndroidTextureMapViewManager.java +31 -0
- package/android/rctmgl/src/main/java/com/mapbox/rctmgl/components/mapview/RCTMGLMapView.java +1527 -0
- package/android/rctmgl/src/main/java/com/mapbox/rctmgl/components/mapview/RCTMGLMapViewManager.java +353 -0
- package/android/rctmgl/src/main/java/com/mapbox/rctmgl/components/mapview/helpers/CameraChangeTracker.java +41 -0
- package/android/rctmgl/src/main/java/com/mapbox/rctmgl/components/styles/RCTMGLStyle.java +83 -0
- package/android/rctmgl/src/main/java/com/mapbox/rctmgl/components/styles/RCTMGLStyleFactory.java +2242 -0
- package/android/rctmgl/src/main/java/com/mapbox/rctmgl/components/styles/RCTMGLStyleFunctionParser.java +108 -0
- package/android/rctmgl/src/main/java/com/mapbox/rctmgl/components/styles/RCTMGLStyleValue.java +212 -0
- package/android/rctmgl/src/main/java/com/mapbox/rctmgl/components/styles/layers/RCTLayer.java +287 -0
- package/android/rctmgl/src/main/java/com/mapbox/rctmgl/components/styles/layers/RCTMGLBackgroundLayer.java +27 -0
- package/android/rctmgl/src/main/java/com/mapbox/rctmgl/components/styles/layers/RCTMGLBackgroundLayerManager.java +64 -0
- package/android/rctmgl/src/main/java/com/mapbox/rctmgl/components/styles/layers/RCTMGLCircleLayer.java +55 -0
- package/android/rctmgl/src/main/java/com/mapbox/rctmgl/components/styles/layers/RCTMGLCircleLayerManager.java +77 -0
- package/android/rctmgl/src/main/java/com/mapbox/rctmgl/components/styles/layers/RCTMGLFillExtrusionLayer.java +55 -0
- package/android/rctmgl/src/main/java/com/mapbox/rctmgl/components/styles/layers/RCTMGLFillExtrusionLayerManager.java +80 -0
- package/android/rctmgl/src/main/java/com/mapbox/rctmgl/components/styles/layers/RCTMGLFillLayer.java +55 -0
- package/android/rctmgl/src/main/java/com/mapbox/rctmgl/components/styles/layers/RCTMGLFillLayerManager.java +80 -0
- package/android/rctmgl/src/main/java/com/mapbox/rctmgl/components/styles/layers/RCTMGLHeatmapLayer.java +55 -0
- package/android/rctmgl/src/main/java/com/mapbox/rctmgl/components/styles/layers/RCTMGLHeatmapLayerManager.java +77 -0
- package/android/rctmgl/src/main/java/com/mapbox/rctmgl/components/styles/layers/RCTMGLLineLayer.java +55 -0
- package/android/rctmgl/src/main/java/com/mapbox/rctmgl/components/styles/layers/RCTMGLLineLayerManager.java +79 -0
- package/android/rctmgl/src/main/java/com/mapbox/rctmgl/components/styles/layers/RCTMGLRasterLayer.java +27 -0
- package/android/rctmgl/src/main/java/com/mapbox/rctmgl/components/styles/layers/RCTMGLRasterLayerManager.java +64 -0
- package/android/rctmgl/src/main/java/com/mapbox/rctmgl/components/styles/layers/RCTMGLSymbolLayer.java +55 -0
- package/android/rctmgl/src/main/java/com/mapbox/rctmgl/components/styles/layers/RCTMGLSymbolLayerManager.java +75 -0
- package/android/rctmgl/src/main/java/com/mapbox/rctmgl/components/styles/light/RCTMGLLight.java +65 -0
- package/android/rctmgl/src/main/java/com/mapbox/rctmgl/components/styles/light/RCTMGLLightManager.java +29 -0
- package/android/rctmgl/src/main/java/com/mapbox/rctmgl/components/styles/sources/RCTMGLImageSource.java +81 -0
- package/android/rctmgl/src/main/java/com/mapbox/rctmgl/components/styles/sources/RCTMGLImageSourceManager.java +72 -0
- package/android/rctmgl/src/main/java/com/mapbox/rctmgl/components/styles/sources/RCTMGLRasterSource.java +45 -0
- package/android/rctmgl/src/main/java/com/mapbox/rctmgl/components/styles/sources/RCTMGLRasterSourceManager.java +44 -0
- package/android/rctmgl/src/main/java/com/mapbox/rctmgl/components/styles/sources/RCTMGLShapeSource.java +302 -0
- package/android/rctmgl/src/main/java/com/mapbox/rctmgl/components/styles/sources/RCTMGLShapeSourceManager.java +227 -0
- package/android/rctmgl/src/main/java/com/mapbox/rctmgl/components/styles/sources/RCTMGLTileSource.java +97 -0
- package/android/rctmgl/src/main/java/com/mapbox/rctmgl/components/styles/sources/RCTMGLTileSourceManager.java +80 -0
- package/android/rctmgl/src/main/java/com/mapbox/rctmgl/components/styles/sources/RCTMGLVectorSource.java +64 -0
- package/android/rctmgl/src/main/java/com/mapbox/rctmgl/components/styles/sources/RCTMGLVectorSourceManager.java +84 -0
- package/android/rctmgl/src/main/java/com/mapbox/rctmgl/components/styles/sources/RCTSource.java +244 -0
- package/android/rctmgl/src/main/java/com/mapbox/rctmgl/events/AbstractEvent.java +66 -0
- package/android/rctmgl/src/main/java/com/mapbox/rctmgl/events/AndroidCallbackEvent.java +38 -0
- package/android/rctmgl/src/main/java/com/mapbox/rctmgl/events/EventEmitter.java +45 -0
- package/android/rctmgl/src/main/java/com/mapbox/rctmgl/events/FeatureClickEvent.java +79 -0
- package/android/rctmgl/src/main/java/com/mapbox/rctmgl/events/IEvent.java +18 -0
- package/android/rctmgl/src/main/java/com/mapbox/rctmgl/events/ImageMissingEvent.java +42 -0
- package/android/rctmgl/src/main/java/com/mapbox/rctmgl/events/LocationEvent.java +100 -0
- package/android/rctmgl/src/main/java/com/mapbox/rctmgl/events/MapChangeEvent.java +47 -0
- package/android/rctmgl/src/main/java/com/mapbox/rctmgl/events/MapClickEvent.java +51 -0
- package/android/rctmgl/src/main/java/com/mapbox/rctmgl/events/MapUserTrackingModeEvent.java +36 -0
- package/android/rctmgl/src/main/java/com/mapbox/rctmgl/events/OfflineEvent.java +29 -0
- package/android/rctmgl/src/main/java/com/mapbox/rctmgl/events/PointAnnotationClickEvent.java +46 -0
- package/android/rctmgl/src/main/java/com/mapbox/rctmgl/events/PointAnnotationDragEvent.java +51 -0
- package/android/rctmgl/src/main/java/com/mapbox/rctmgl/events/constants/EventKeys.java +39 -0
- package/android/rctmgl/src/main/java/com/mapbox/rctmgl/events/constants/EventTypes.java +51 -0
- package/android/rctmgl/src/main/java/com/mapbox/rctmgl/http/CustomHeadersInterceptor.java +38 -0
- package/android/rctmgl/src/main/java/com/mapbox/rctmgl/location/LocationManager.java +168 -0
- package/android/rctmgl/src/main/java/com/mapbox/rctmgl/location/UserLocation.java +63 -0
- package/android/rctmgl/src/main/java/com/mapbox/rctmgl/location/UserLocationVerticalAlignment.java +11 -0
- package/android/rctmgl/src/main/java/com/mapbox/rctmgl/location/UserTrackingMode.java +63 -0
- package/android/rctmgl/src/main/java/com/mapbox/rctmgl/location/UserTrackingState.java +19 -0
- package/android/rctmgl/src/main/java/com/mapbox/rctmgl/modules/RCTMGLLocationModule.java +158 -0
- package/android/rctmgl/src/main/java/com/mapbox/rctmgl/modules/RCTMGLLogging.java +140 -0
- package/android/rctmgl/src/main/java/com/mapbox/rctmgl/modules/RCTMGLModule.java +348 -0
- package/android/rctmgl/src/main/java/com/mapbox/rctmgl/modules/RCTMGLOfflineModule.java +597 -0
- package/android/rctmgl/src/main/java/com/mapbox/rctmgl/modules/RCTMGLSnapshotModule.java +139 -0
- package/android/rctmgl/src/main/java/com/mapbox/rctmgl/utils/BitmapUtils.java +129 -0
- package/android/rctmgl/src/main/java/com/mapbox/rctmgl/utils/ConvertUtils.java +257 -0
- package/android/rctmgl/src/main/java/com/mapbox/rctmgl/utils/DownloadMapImageTask.java +159 -0
- package/android/rctmgl/src/main/java/com/mapbox/rctmgl/utils/ExpressionParser.java +74 -0
- package/android/rctmgl/src/main/java/com/mapbox/rctmgl/utils/GeoJSONUtils.java +209 -0
- package/android/rctmgl/src/main/java/com/mapbox/rctmgl/utils/GeoViewport.java +38 -0
- package/android/rctmgl/src/main/java/com/mapbox/rctmgl/utils/ImageEntry.java +25 -0
- package/android/rctmgl/src/main/java/com/mapbox/rctmgl/utils/ResourceUtils.java +30 -0
- package/android/rctmgl/src/main/java/com/mapbox/rctmgl/utils/SimpleEventCallback.java +30 -0
- package/android/rctmgl/src/main/java/com/mapbox/rctmgl/utils/SphericalMercator.java +69 -0
- package/android/rctmgl/src/main/res/drawable/empty.xml +5 -0
- package/android/rctmgl/src/main/res/drawable/empty_drawable.png +0 -0
- package/android/rctmgl/src/main/res/drawable-xxhdpi/red_marker.png +0 -0
- package/android/rctmgl/src/main/res/layout/annotation.xml +17 -0
- package/android/rctmgl/src/main/res/values/strings.xml +3 -0
- package/android/settings.gradle +1 -0
- package/app.plugin.js +1 -0
- package/assets/heading.png +0 -0
- package/assets/heading@2x.png +0 -0
- package/assets/heading@3x.png +0 -0
- package/assets/indoor_building_map_android.png +0 -0
- package/assets/indoor_building_map_ios.png +0 -0
- package/assets/mapbox_logo.png +0 -0
- package/babel.config.js +9 -0
- package/docs/Annotation.md +39 -0
- package/docs/Annotations.md +17 -0
- package/docs/BackgroundLayer.md +166 -0
- package/docs/Callout.md +15 -0
- package/docs/Camera.md +162 -0
- package/docs/CircleLayer.md +453 -0
- package/docs/CustomHttpHeaders.md +87 -0
- package/docs/FillExtrusionLayer.md +327 -0
- package/docs/FillLayer.md +293 -0
- package/docs/GettingStarted.md +72 -0
- package/docs/HeadingIndicator.md +10 -0
- package/docs/HeatmapLayer.md +215 -0
- package/docs/ImageSource.md +12 -0
- package/docs/Images.md +12 -0
- package/docs/Light.md +159 -0
- package/docs/LineLayer.md +567 -0
- package/docs/Logger.md +23 -0
- package/docs/MapView.md +211 -0
- package/docs/MapboxGL.md +65 -0
- package/docs/MarkerView.md +14 -0
- package/docs/NativeUserLocation.md +11 -0
- package/docs/OfflineManager.md +246 -0
- package/docs/PointAnnotation.md +34 -0
- package/docs/RasterLayer.md +357 -0
- package/docs/RasterSource.md +17 -0
- package/docs/ShapeSource.md +100 -0
- package/docs/Style.md +10 -0
- package/docs/StyleSheet.md +430 -0
- package/docs/SymbolLayer.md +1658 -0
- package/docs/UserLocation.md +39 -0
- package/docs/VectorSource.md +48 -0
- package/docs/docs.json +6093 -0
- package/docs/snapshotManager.md +53 -0
- package/index.d.ts +953 -0
- package/ios/RCTMGL/CameraMode.h +18 -0
- package/ios/RCTMGL/CameraMode.m +18 -0
- package/ios/RCTMGL/CameraStop.h +26 -0
- package/ios/RCTMGL/CameraStop.m +83 -0
- package/ios/RCTMGL/CameraUpdateItem.h +18 -0
- package/ios/RCTMGL/CameraUpdateItem.m +178 -0
- package/ios/RCTMGL/CameraUpdateQueue.h +21 -0
- package/ios/RCTMGL/CameraUpdateQueue.m +74 -0
- package/ios/RCTMGL/FilterParser.h +14 -0
- package/ios/RCTMGL/FilterParser.m +22 -0
- package/ios/RCTMGL/MGLCustomHeaders.h +20 -0
- package/ios/RCTMGL/MGLCustomHeaders.m +98 -0
- package/ios/RCTMGL/MGLFaux3DUserLocationAnnotationView.h +23 -0
- package/ios/RCTMGL/MGLFaux3DUserLocationAnnotationView.m +474 -0
- package/ios/RCTMGL/MGLModule.h +13 -0
- package/ios/RCTMGL/MGLModule.m +269 -0
- package/ios/RCTMGL/MGLOfflineModule.h +19 -0
- package/ios/RCTMGL/MGLOfflineModule.m +516 -0
- package/ios/RCTMGL/MGLSnapshotModule.h +13 -0
- package/ios/RCTMGL/MGLSnapshotModule.m +80 -0
- package/ios/RCTMGL/MGLUserLocationHeadingArrowLayer.h +11 -0
- package/ios/RCTMGL/MGLUserLocationHeadingArrowLayer.m +57 -0
- package/ios/RCTMGL/MGLUserLocationHeadingBeamLayer.h +11 -0
- package/ios/RCTMGL/MGLUserLocationHeadingBeamLayer.m +102 -0
- package/ios/RCTMGL/MGLUserLocationHeadingIndicator.h +10 -0
- package/ios/RCTMGL/RCTConvert+Mapbox.h +16 -0
- package/ios/RCTMGL/RCTConvert+Mapbox.m +32 -0
- package/ios/RCTMGL/RCTMGL.h +13 -0
- package/ios/RCTMGL/RCTMGL.m +13 -0
- package/ios/RCTMGL/RCTMGLBackgroundLayer.h +14 -0
- package/ios/RCTMGL/RCTMGLBackgroundLayer.m +27 -0
- package/ios/RCTMGL/RCTMGLBackgroundLayerManager.h +13 -0
- package/ios/RCTMGL/RCTMGLBackgroundLayerManager.m +35 -0
- package/ios/RCTMGL/RCTMGLCallout.h +15 -0
- package/ios/RCTMGL/RCTMGLCallout.m +74 -0
- package/ios/RCTMGL/RCTMGLCalloutManager.h +13 -0
- package/ios/RCTMGL/RCTMGLCalloutManager.m +21 -0
- package/ios/RCTMGL/RCTMGLCamera.h +39 -0
- package/ios/RCTMGL/RCTMGLCamera.m +258 -0
- package/ios/RCTMGL/RCTMGLCameraManager.h +13 -0
- package/ios/RCTMGL/RCTMGLCameraManager.m +52 -0
- package/ios/RCTMGL/RCTMGLCircleLayer.h +13 -0
- package/ios/RCTMGL/RCTMGLCircleLayer.m +34 -0
- package/ios/RCTMGL/RCTMGLCircleLayerManager.h +13 -0
- package/ios/RCTMGL/RCTMGLCircleLayerManager.m +39 -0
- package/ios/RCTMGL/RCTMGLEvent.h +21 -0
- package/ios/RCTMGL/RCTMGLEvent.m +47 -0
- package/ios/RCTMGL/RCTMGLEventProtocol.h +16 -0
- package/ios/RCTMGL/RCTMGLEventTypes.h +50 -0
- package/ios/RCTMGL/RCTMGLEventTypes.m +49 -0
- package/ios/RCTMGL/RCTMGLFillExtrusionLayer.h +14 -0
- package/ios/RCTMGL/RCTMGLFillExtrusionLayer.m +32 -0
- package/ios/RCTMGL/RCTMGLFillExtrusionLayerManager.h +13 -0
- package/ios/RCTMGL/RCTMGLFillExtrusionLayerManager.m +39 -0
- package/ios/RCTMGL/RCTMGLFillLayer.h +14 -0
- package/ios/RCTMGL/RCTMGLFillLayer.m +33 -0
- package/ios/RCTMGL/RCTMGLFillLayerManager.h +13 -0
- package/ios/RCTMGL/RCTMGLFillLayerManager.m +37 -0
- package/ios/RCTMGL/RCTMGLHeatmapLayer.h +12 -0
- package/ios/RCTMGL/RCTMGLHeatmapLayer.m +30 -0
- package/ios/RCTMGL/RCTMGLHeatmapLayerManager.h +12 -0
- package/ios/RCTMGL/RCTMGLHeatmapLayerManager.m +38 -0
- package/ios/RCTMGL/RCTMGLImageQueue.h +19 -0
- package/ios/RCTMGL/RCTMGLImageQueue.m +57 -0
- package/ios/RCTMGL/RCTMGLImageQueueOperation.h +17 -0
- package/ios/RCTMGL/RCTMGLImageQueueOperation.m +138 -0
- package/ios/RCTMGL/RCTMGLImageSource.h +16 -0
- package/ios/RCTMGL/RCTMGLImageSource.m +60 -0
- package/ios/RCTMGL/RCTMGLImageSourceManager.h +13 -0
- package/ios/RCTMGL/RCTMGLImageSourceManager.m +25 -0
- package/ios/RCTMGL/RCTMGLImages.h +25 -0
- package/ios/RCTMGL/RCTMGLImages.m +126 -0
- package/ios/RCTMGL/RCTMGLImagesManager.h +5 -0
- package/ios/RCTMGL/RCTMGLImagesManager.m +21 -0
- package/ios/RCTMGL/RCTMGLLayer.h +52 -0
- package/ios/RCTMGL/RCTMGLLayer.m +236 -0
- package/ios/RCTMGL/RCTMGLLight.h +17 -0
- package/ios/RCTMGL/RCTMGLLight.m +46 -0
- package/ios/RCTMGL/RCTMGLLightManager.h +13 -0
- package/ios/RCTMGL/RCTMGLLightManager.m +23 -0
- package/ios/RCTMGL/RCTMGLLineLayer.h +14 -0
- package/ios/RCTMGL/RCTMGLLineLayer.m +33 -0
- package/ios/RCTMGL/RCTMGLLineLayerManager.h +13 -0
- package/ios/RCTMGL/RCTMGLLineLayerManager.m +40 -0
- package/ios/RCTMGL/RCTMGLLocation.h +19 -0
- package/ios/RCTMGL/RCTMGLLocation.m +32 -0
- package/ios/RCTMGL/RCTMGLLocationManager.h +30 -0
- package/ios/RCTMGL/RCTMGLLocationManager.m +180 -0
- package/ios/RCTMGL/RCTMGLLocationManagerDelegate.h +20 -0
- package/ios/RCTMGL/RCTMGLLocationModule.h +15 -0
- package/ios/RCTMGL/RCTMGLLocationModule.m +99 -0
- package/ios/RCTMGL/RCTMGLLogging.h +18 -0
- package/ios/RCTMGL/RCTMGLLogging.m +132 -0
- package/ios/RCTMGL/RCTMGLMapTouchEvent.h +25 -0
- package/ios/RCTMGL/RCTMGLMapTouchEvent.m +77 -0
- package/ios/RCTMGL/RCTMGLMapView.h +91 -0
- package/ios/RCTMGL/RCTMGLMapView.m +536 -0
- package/ios/RCTMGL/RCTMGLMapViewManager.h +17 -0
- package/ios/RCTMGL/RCTMGLMapViewManager.m +625 -0
- package/ios/RCTMGL/RCTMGLNativeUserLocation.h +18 -0
- package/ios/RCTMGL/RCTMGLNativeUserLocation.m +49 -0
- package/ios/RCTMGL/RCTMGLNativeUserLocationManager.h +5 -0
- package/ios/RCTMGL/RCTMGLNativeUserLocationManager.m +25 -0
- package/ios/RCTMGL/RCTMGLPointAnnotation.h +41 -0
- package/ios/RCTMGL/RCTMGLPointAnnotation.m +251 -0
- package/ios/RCTMGL/RCTMGLPointAnnotationManager.h +13 -0
- package/ios/RCTMGL/RCTMGLPointAnnotationManager.m +36 -0
- package/ios/RCTMGL/RCTMGLRasterLayer.h +14 -0
- package/ios/RCTMGL/RCTMGLRasterLayer.m +30 -0
- package/ios/RCTMGL/RCTMGLRasterLayerManager.h +13 -0
- package/ios/RCTMGL/RCTMGLRasterLayerManager.m +35 -0
- package/ios/RCTMGL/RCTMGLRasterSource.h +16 -0
- package/ios/RCTMGL/RCTMGLRasterSource.m +35 -0
- package/ios/RCTMGL/RCTMGLRasterSourceManager.h +13 -0
- package/ios/RCTMGL/RCTMGLRasterSourceManager.m +32 -0
- package/ios/RCTMGL/RCTMGLShapeSource.h +52 -0
- package/ios/RCTMGL/RCTMGLShapeSource.m +180 -0
- package/ios/RCTMGL/RCTMGLShapeSourceManager.h +14 -0
- package/ios/RCTMGL/RCTMGLShapeSourceManager.m +205 -0
- package/ios/RCTMGL/RCTMGLSource.h +35 -0
- package/ios/RCTMGL/RCTMGLSource.m +143 -0
- package/ios/RCTMGL/RCTMGLStyle.h +219 -0
- package/ios/RCTMGL/RCTMGLStyle.m +1654 -0
- package/ios/RCTMGL/RCTMGLStyleValue.h +27 -0
- package/ios/RCTMGL/RCTMGLStyleValue.m +167 -0
- package/ios/RCTMGL/RCTMGLSymbolLayer.h +19 -0
- package/ios/RCTMGL/RCTMGLSymbolLayer.m +121 -0
- package/ios/RCTMGL/RCTMGLSymbolLayerManager.h +13 -0
- package/ios/RCTMGL/RCTMGLSymbolLayerManager.m +40 -0
- package/ios/RCTMGL/RCTMGLTileSource.h +22 -0
- package/ios/RCTMGL/RCTMGLTileSource.m +31 -0
- package/ios/RCTMGL/RCTMGLUserLocation.h +15 -0
- package/ios/RCTMGL/RCTMGLUserLocation.m +38 -0
- package/ios/RCTMGL/RCTMGLUtils.h +31 -0
- package/ios/RCTMGL/RCTMGLUtils.m +218 -0
- package/ios/RCTMGL/RCTMGLVectorLayer.h +15 -0
- package/ios/RCTMGL/RCTMGLVectorLayer.m +59 -0
- package/ios/RCTMGL/RCTMGLVectorSource.h +16 -0
- package/ios/RCTMGL/RCTMGLVectorSource.m +28 -0
- package/ios/RCTMGL/RCTMGLVectorSourceManager.h +14 -0
- package/ios/RCTMGL/RCTMGLVectorSourceManager.m +79 -0
- package/ios/RCTMGL/RNMBImageUtils.h +17 -0
- package/ios/RCTMGL/RNMBImageUtils.m +31 -0
- package/ios/RCTMGL/ViewManager.h +16 -0
- package/ios/RCTMGL/ViewManager.m +63 -0
- package/ios/RCTMGL/index.d.ts +1164 -0
- package/ios/RCTMGL.xcodeproj/project.pbxproj +774 -0
- package/ios/install.md +44 -0
- package/javascript/components/AbstractLayer.js +75 -0
- package/javascript/components/AbstractSource.js +15 -0
- package/javascript/components/BackgroundLayer.js +97 -0
- package/javascript/components/Callout.js +139 -0
- package/javascript/components/Camera.js +665 -0
- package/javascript/components/CircleLayer.js +101 -0
- package/javascript/components/FillExtrusionLayer.js +98 -0
- package/javascript/components/FillLayer.js +94 -0
- package/javascript/components/HeadingIndicator.js +31 -0
- package/javascript/components/HeatmapLayer.js +99 -0
- package/javascript/components/ImageSource.js +82 -0
- package/javascript/components/Images.js +119 -0
- package/javascript/components/Light.js +47 -0
- package/javascript/components/LineLayer.js +94 -0
- package/javascript/components/MapView.js +817 -0
- package/javascript/components/MarkerView.js +87 -0
- package/javascript/components/NativeBridgeComponent.js +86 -0
- package/javascript/components/NativeUserLocation.js +41 -0
- package/javascript/components/PointAnnotation.js +216 -0
- package/javascript/components/RasterLayer.js +95 -0
- package/javascript/components/RasterSource.js +124 -0
- package/javascript/components/ShapeSource.js +357 -0
- package/javascript/components/Style.js +264 -0
- package/javascript/components/SymbolLayer.js +120 -0
- package/javascript/components/UserLocation.js +273 -0
- package/javascript/components/VectorSource.js +200 -0
- package/javascript/components/annotations/Annotation.js +122 -0
- package/javascript/index.js +153 -0
- package/javascript/modules/location/locationManager.js +101 -0
- package/javascript/modules/offline/OfflineCreatePackOptions.js +46 -0
- package/javascript/modules/offline/OfflinePack.js +40 -0
- package/javascript/modules/offline/offlineManager.js +378 -0
- package/javascript/modules/snapshot/SnapshotOptions.js +67 -0
- package/javascript/modules/snapshot/snapshotManager.js +62 -0
- package/javascript/utils/BridgeValue.js +81 -0
- package/javascript/utils/Logger.js +114 -0
- package/javascript/utils/animated/Animated.js +39 -0
- package/javascript/utils/animated/AnimatedCoordinatesArray.js +191 -0
- package/javascript/utils/animated/AnimatedExtractCoordinateFromArray.js +43 -0
- package/javascript/utils/animated/AnimatedPoint.js +126 -0
- package/javascript/utils/animated/AnimatedRouteCoordinatesArray.js +124 -0
- package/javascript/utils/animated/AnimatedShape.js +72 -0
- package/javascript/utils/deprecation.js +25 -0
- package/javascript/utils/filterUtils.js +7 -0
- package/javascript/utils/geoUtils.js +73 -0
- package/javascript/utils/index.js +113 -0
- package/javascript/utils/styleMap.js +1901 -0
- package/maplibre-react-native.podspec +79 -0
- package/package.json +120 -0
- package/plugin/build/withMapbox.d.ts +12 -0
- package/plugin/build/withMapbox.js +119 -0
- package/plugin/install.md +32 -0
- package/react-native.config.js +10 -0
- package/scripts/autogenHelpers/DocJSONBuilder.js +458 -0
- package/scripts/autogenHelpers/JSDocNodeTree.js +131 -0
- package/scripts/autogenHelpers/MarkdownBuilder.js +29 -0
- package/scripts/autogenHelpers/globals.js +507 -0
- package/scripts/autogenerate.js +374 -0
- package/scripts/download-style-spec.sh +15 -0
- package/scripts/templates/RCTMGLStyle.h.ejs +33 -0
- package/scripts/templates/RCTMGLStyle.m.ejs +97 -0
- package/scripts/templates/RCTMGLStyleFactory.java.ejs +107 -0
- package/scripts/templates/component.md.ejs +122 -0
- package/scripts/templates/index.d.ts.ejs +56 -0
- package/scripts/templates/styleMap.js.ejs +115 -0
- package/setup-jest.js +121 -0
- package/style-spec/v8.json +5798 -0
- package/tsconfig.json +65 -0
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
import {viewPropTypes} from '../utils';
|
|
2
|
+
import {SymbolLayerStyleProp} from '../utils/styleMap';
|
|
3
|
+
|
|
4
|
+
import AbstractLayer from './AbstractLayer';
|
|
5
|
+
|
|
6
|
+
import PropTypes from 'prop-types';
|
|
7
|
+
import React from 'react';
|
|
8
|
+
import {View, NativeModules, requireNativeComponent} from 'react-native';
|
|
9
|
+
|
|
10
|
+
const MapboxGL = NativeModules.MGLModule;
|
|
11
|
+
|
|
12
|
+
export const NATIVE_MODULE_NAME = 'RCTMGLSymbolLayer';
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* SymbolLayer is a style layer that renders icon and text labels at points or along lines on the map.
|
|
16
|
+
*/
|
|
17
|
+
class SymbolLayer extends AbstractLayer {
|
|
18
|
+
static propTypes = {
|
|
19
|
+
...viewPropTypes,
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* A string that uniquely identifies the source in the style to which it is added.
|
|
23
|
+
*/
|
|
24
|
+
id: PropTypes.string.isRequired,
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* The source from which to obtain the data to style.
|
|
28
|
+
* If the source has not yet been added to the current style, the behavior is undefined.
|
|
29
|
+
* Inferred from parent source only if the layer is a direct child to it.
|
|
30
|
+
*/
|
|
31
|
+
sourceID: PropTypes.string,
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Identifier of the layer within the source identified by the sourceID property from which the receiver obtains the data to style.
|
|
35
|
+
*/
|
|
36
|
+
sourceLayerID: PropTypes.string,
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Inserts a layer above aboveLayerID.
|
|
40
|
+
*/
|
|
41
|
+
aboveLayerID: PropTypes.string,
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* Inserts a layer below belowLayerID
|
|
45
|
+
*/
|
|
46
|
+
belowLayerID: PropTypes.string,
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* Inserts a layer at a specified index
|
|
50
|
+
*/
|
|
51
|
+
layerIndex: PropTypes.number,
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* Filter only the features in the source layer that satisfy a condition that you define
|
|
55
|
+
*/
|
|
56
|
+
filter: PropTypes.array,
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* The minimum zoom level at which the layer gets parsed and appears.
|
|
60
|
+
*/
|
|
61
|
+
minZoomLevel: PropTypes.number,
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* The maximum zoom level at which the layer gets parsed and appears.
|
|
65
|
+
*/
|
|
66
|
+
maxZoomLevel: PropTypes.number,
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* Customizable style attributes
|
|
70
|
+
*/
|
|
71
|
+
style: PropTypes.oneOfType([
|
|
72
|
+
SymbolLayerStyleProp,
|
|
73
|
+
PropTypes.arrayOf(SymbolLayerStyleProp),
|
|
74
|
+
]),
|
|
75
|
+
};
|
|
76
|
+
|
|
77
|
+
static defaultProps = {
|
|
78
|
+
sourceID: MapboxGL.StyleSource.DefaultSourceID,
|
|
79
|
+
};
|
|
80
|
+
|
|
81
|
+
_shouldSnapshot() {
|
|
82
|
+
let isSnapshot = false;
|
|
83
|
+
|
|
84
|
+
if (React.Children.count(this.props.children) <= 0) {
|
|
85
|
+
return isSnapshot;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
React.Children.forEach(this.props.children, child => {
|
|
89
|
+
if (child.type === View) {
|
|
90
|
+
isSnapshot = true;
|
|
91
|
+
}
|
|
92
|
+
});
|
|
93
|
+
|
|
94
|
+
return isSnapshot;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
render() {
|
|
98
|
+
const props = {
|
|
99
|
+
...this.baseProps,
|
|
100
|
+
snapshot: this._shouldSnapshot(),
|
|
101
|
+
sourceLayerID: this.props.sourceLayerID,
|
|
102
|
+
};
|
|
103
|
+
|
|
104
|
+
return (
|
|
105
|
+
<RCTMGLSymbolLayer ref="nativeLayer" {...props}>
|
|
106
|
+
{this.props.children}
|
|
107
|
+
</RCTMGLSymbolLayer>
|
|
108
|
+
);
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
const RCTMGLSymbolLayer = requireNativeComponent(
|
|
113
|
+
NATIVE_MODULE_NAME,
|
|
114
|
+
SymbolLayer,
|
|
115
|
+
{
|
|
116
|
+
nativeOnly: {reactStyle: true, snapshot: true},
|
|
117
|
+
},
|
|
118
|
+
);
|
|
119
|
+
|
|
120
|
+
export default SymbolLayer;
|
|
@@ -0,0 +1,273 @@
|
|
|
1
|
+
import locationManager from '../modules/location/locationManager';
|
|
2
|
+
|
|
3
|
+
import Annotation from './annotations/Annotation';
|
|
4
|
+
import CircleLayer from './CircleLayer';
|
|
5
|
+
import HeadingIndicator from './HeadingIndicator';
|
|
6
|
+
import NativeUserLocation from './NativeUserLocation';
|
|
7
|
+
|
|
8
|
+
import PropTypes from 'prop-types';
|
|
9
|
+
import React from 'react';
|
|
10
|
+
|
|
11
|
+
const mapboxBlue = 'rgba(51, 181, 229, 100)';
|
|
12
|
+
|
|
13
|
+
const layerStyles = {
|
|
14
|
+
normal: {
|
|
15
|
+
pluse: {
|
|
16
|
+
circleRadius: 15,
|
|
17
|
+
circleColor: mapboxBlue,
|
|
18
|
+
circleOpacity: 0.2,
|
|
19
|
+
circlePitchAlignment: 'map',
|
|
20
|
+
},
|
|
21
|
+
background: {
|
|
22
|
+
circleRadius: 9,
|
|
23
|
+
circleColor: '#fff',
|
|
24
|
+
circlePitchAlignment: 'map',
|
|
25
|
+
},
|
|
26
|
+
foreground: {
|
|
27
|
+
circleRadius: 6,
|
|
28
|
+
circleColor: mapboxBlue,
|
|
29
|
+
circlePitchAlignment: 'map',
|
|
30
|
+
},
|
|
31
|
+
},
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
export const normalIcon = (showsUserHeadingIndicator, heading) => [
|
|
35
|
+
<CircleLayer
|
|
36
|
+
key="mapboxUserLocationPluseCircle"
|
|
37
|
+
id="mapboxUserLocationPluseCircle"
|
|
38
|
+
style={layerStyles.normal.pluse}
|
|
39
|
+
/>,
|
|
40
|
+
<CircleLayer
|
|
41
|
+
key="mapboxUserLocationWhiteCircle"
|
|
42
|
+
id="mapboxUserLocationWhiteCircle"
|
|
43
|
+
style={layerStyles.normal.background}
|
|
44
|
+
/>,
|
|
45
|
+
<CircleLayer
|
|
46
|
+
key="mapboxUserLocationBlueCicle"
|
|
47
|
+
id="mapboxUserLocationBlueCicle"
|
|
48
|
+
aboveLayerID="mapboxUserLocationWhiteCircle"
|
|
49
|
+
style={layerStyles.normal.foreground}
|
|
50
|
+
/>,
|
|
51
|
+
...(showsUserHeadingIndicator && heading !== null
|
|
52
|
+
? [HeadingIndicator(heading)]
|
|
53
|
+
: []),
|
|
54
|
+
];
|
|
55
|
+
|
|
56
|
+
class UserLocation extends React.Component {
|
|
57
|
+
static propTypes = {
|
|
58
|
+
/**
|
|
59
|
+
* Whether location icon is animated between updates
|
|
60
|
+
*/
|
|
61
|
+
animated: PropTypes.bool,
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* Which render mode to use.
|
|
65
|
+
* Can either be `normal` or `native`
|
|
66
|
+
*/
|
|
67
|
+
renderMode: PropTypes.oneOf(['normal', 'native']),
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* native/android only render mode
|
|
71
|
+
*
|
|
72
|
+
* - normal: just a circle
|
|
73
|
+
* - compass: triangle with heading
|
|
74
|
+
* - gps: large arrow
|
|
75
|
+
*
|
|
76
|
+
* @platform android
|
|
77
|
+
*/
|
|
78
|
+
androidRenderMode: PropTypes.oneOf(['normal', 'compass', 'gps']),
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* Whether location icon is visible
|
|
82
|
+
*/
|
|
83
|
+
visible: PropTypes.bool,
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* Callback that is triggered on location icon press
|
|
87
|
+
*/
|
|
88
|
+
onPress: PropTypes.func,
|
|
89
|
+
|
|
90
|
+
/**
|
|
91
|
+
* Callback that is triggered on location update
|
|
92
|
+
*/
|
|
93
|
+
onUpdate: PropTypes.func,
|
|
94
|
+
|
|
95
|
+
/**
|
|
96
|
+
* Show or hide small arrow which indicates direction the device is pointing relative to north.
|
|
97
|
+
*/
|
|
98
|
+
showsUserHeadingIndicator: PropTypes.bool,
|
|
99
|
+
|
|
100
|
+
/**
|
|
101
|
+
* Minimum amount of movement before GPS location is updated in meters
|
|
102
|
+
*/
|
|
103
|
+
minDisplacement: PropTypes.number,
|
|
104
|
+
|
|
105
|
+
/**
|
|
106
|
+
* Custom location icon of type mapbox-gl-native components
|
|
107
|
+
*/
|
|
108
|
+
children: PropTypes.any,
|
|
109
|
+
};
|
|
110
|
+
|
|
111
|
+
static defaultProps = {
|
|
112
|
+
animated: true,
|
|
113
|
+
visible: true,
|
|
114
|
+
showsUserHeadingIndicator: false,
|
|
115
|
+
minDisplacement: 0,
|
|
116
|
+
renderMode: 'normal',
|
|
117
|
+
};
|
|
118
|
+
|
|
119
|
+
static RenderMode = {
|
|
120
|
+
Native: 'native',
|
|
121
|
+
Normal: 'normal',
|
|
122
|
+
};
|
|
123
|
+
|
|
124
|
+
constructor(props) {
|
|
125
|
+
super(props);
|
|
126
|
+
|
|
127
|
+
this.state = {
|
|
128
|
+
shouldShowUserLocation: false,
|
|
129
|
+
coordinates: null,
|
|
130
|
+
heading: null,
|
|
131
|
+
};
|
|
132
|
+
|
|
133
|
+
this._onLocationUpdate = this._onLocationUpdate.bind(this);
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
// required as #setLocationManager attempts to setState
|
|
137
|
+
// after component unmount
|
|
138
|
+
_isMounted = null;
|
|
139
|
+
|
|
140
|
+
locationManagerRunning = false;
|
|
141
|
+
|
|
142
|
+
async componentDidMount() {
|
|
143
|
+
this._isMounted = true;
|
|
144
|
+
|
|
145
|
+
await this.setLocationManager({
|
|
146
|
+
running: this.needsLocationManagerRunning(),
|
|
147
|
+
});
|
|
148
|
+
|
|
149
|
+
if (this.renderMode === UserLocation.RenderMode.Native) {
|
|
150
|
+
return;
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
locationManager.setMinDisplacement(this.props.minDisplacement);
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
async componentDidUpdate(prevProps) {
|
|
157
|
+
await this.setLocationManager({
|
|
158
|
+
running: this.needsLocationManagerRunning(),
|
|
159
|
+
});
|
|
160
|
+
|
|
161
|
+
if (this.props.minDisplacement !== prevProps.minDisplacement) {
|
|
162
|
+
locationManager.setMinDisplacement(this.props.minDisplacement);
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
async componentWillUnmount() {
|
|
167
|
+
this._isMounted = false;
|
|
168
|
+
await this.setLocationManager({running: false});
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
/**
|
|
172
|
+
* Whether to start or stop listening to the locationManager
|
|
173
|
+
*
|
|
174
|
+
* Notice, that listening will start automatically when
|
|
175
|
+
* either `onUpdate` or `visible` are set
|
|
176
|
+
*
|
|
177
|
+
* @async
|
|
178
|
+
* @param {Object} running - Object with key `running` and `boolean` value
|
|
179
|
+
* @return {Promise<void>}
|
|
180
|
+
*/
|
|
181
|
+
async setLocationManager({running}) {
|
|
182
|
+
if (this.locationManagerRunning !== running) {
|
|
183
|
+
this.locationManagerRunning = running;
|
|
184
|
+
if (running) {
|
|
185
|
+
locationManager.addListener(this._onLocationUpdate);
|
|
186
|
+
const location = await locationManager.getLastKnownLocation();
|
|
187
|
+
this._onLocationUpdate(location);
|
|
188
|
+
} else {
|
|
189
|
+
locationManager.removeListener(this._onLocationUpdate);
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
/**
|
|
195
|
+
*
|
|
196
|
+
* If locationManager should be running
|
|
197
|
+
*
|
|
198
|
+
* @return {boolean}
|
|
199
|
+
*/
|
|
200
|
+
needsLocationManagerRunning() {
|
|
201
|
+
return (
|
|
202
|
+
!!this.props.onUpdate ||
|
|
203
|
+
(this.props.renderMode === UserLocation.RenderMode.Normal &&
|
|
204
|
+
this.props.visible)
|
|
205
|
+
);
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
_onLocationUpdate(location) {
|
|
209
|
+
if (!this._isMounted || !location) {
|
|
210
|
+
return;
|
|
211
|
+
}
|
|
212
|
+
let coordinates = null;
|
|
213
|
+
let heading = null;
|
|
214
|
+
|
|
215
|
+
if (location && location.coords) {
|
|
216
|
+
const {longitude, latitude} = location.coords;
|
|
217
|
+
({heading} = location.coords);
|
|
218
|
+
coordinates = [longitude, latitude];
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
this.setState({
|
|
222
|
+
coordinates,
|
|
223
|
+
heading,
|
|
224
|
+
});
|
|
225
|
+
|
|
226
|
+
if (this.props.onUpdate) {
|
|
227
|
+
this.props.onUpdate(location);
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
_renderNative() {
|
|
232
|
+
const {androidRenderMode, showsUserHeadingIndicator} = this.props;
|
|
233
|
+
|
|
234
|
+
let props = {
|
|
235
|
+
androidRenderMode,
|
|
236
|
+
iosShowsUserHeadingIndicator: showsUserHeadingIndicator,
|
|
237
|
+
};
|
|
238
|
+
return <NativeUserLocation {...props} />;
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
render() {
|
|
242
|
+
const {heading, coordinates} = this.state;
|
|
243
|
+
const {children, visible, showsUserHeadingIndicator, onPress, animated} =
|
|
244
|
+
this.props;
|
|
245
|
+
|
|
246
|
+
if (!visible) {
|
|
247
|
+
return null;
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
if (this.props.renderMode === UserLocation.RenderMode.Native) {
|
|
251
|
+
return this._renderNative();
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
if (!coordinates) {
|
|
255
|
+
return null;
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
return (
|
|
259
|
+
<Annotation
|
|
260
|
+
animated={animated}
|
|
261
|
+
id="mapboxUserLocation"
|
|
262
|
+
onPress={onPress}
|
|
263
|
+
coordinates={coordinates}
|
|
264
|
+
style={{
|
|
265
|
+
iconRotate: heading,
|
|
266
|
+
}}>
|
|
267
|
+
{children || normalIcon(showsUserHeadingIndicator, heading)}
|
|
268
|
+
</Annotation>
|
|
269
|
+
);
|
|
270
|
+
}
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
export default UserLocation;
|
|
@@ -0,0 +1,200 @@
|
|
|
1
|
+
import {
|
|
2
|
+
cloneReactChildrenWithProps,
|
|
3
|
+
viewPropTypes,
|
|
4
|
+
isFunction,
|
|
5
|
+
isAndroid,
|
|
6
|
+
} from '../utils';
|
|
7
|
+
import {getFilter} from '../utils/filterUtils';
|
|
8
|
+
import {copyPropertiesAsDeprecated} from '../utils/deprecation';
|
|
9
|
+
|
|
10
|
+
import AbstractSource from './AbstractSource';
|
|
11
|
+
import NativeBridgeComponent from './NativeBridgeComponent';
|
|
12
|
+
|
|
13
|
+
import PropTypes from 'prop-types';
|
|
14
|
+
import React from 'react';
|
|
15
|
+
import {NativeModules, requireNativeComponent} from 'react-native';
|
|
16
|
+
|
|
17
|
+
const MapboxGL = NativeModules.MGLModule;
|
|
18
|
+
|
|
19
|
+
export const NATIVE_MODULE_NAME = 'RCTMGLVectorSource';
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* VectorSource is a map content source that supplies tiled vector data in Mapbox Vector Tile format to be shown on the map.
|
|
23
|
+
* The location of and metadata about the tiles are defined either by an option dictionary or by an external file that conforms to the TileJSON specification.
|
|
24
|
+
*/
|
|
25
|
+
class VectorSource extends NativeBridgeComponent(AbstractSource) {
|
|
26
|
+
static propTypes = {
|
|
27
|
+
...viewPropTypes,
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* A string that uniquely identifies the source.
|
|
31
|
+
*/
|
|
32
|
+
id: PropTypes.string.isRequired,
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* A URL to a TileJSON configuration file describing the source’s contents and other metadata.
|
|
36
|
+
*/
|
|
37
|
+
url: PropTypes.string,
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* An array of tile URL templates. If multiple endpoints are specified, clients may use any combination of endpoints.
|
|
41
|
+
* Example: https://example.com/vector-tiles/{z}/{x}/{y}.pbf
|
|
42
|
+
*/
|
|
43
|
+
tileUrlTemplates: PropTypes.arrayOf(PropTypes.string),
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* An unsigned integer that specifies the minimum zoom level at which to display tiles from the source.
|
|
47
|
+
* The value should be between 0 and 22, inclusive, and less than
|
|
48
|
+
* maxZoomLevel, if specified. The default value for this option is 0.
|
|
49
|
+
*/
|
|
50
|
+
minZoomLevel: PropTypes.number,
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* An unsigned integer that specifies the maximum zoom level at which to display tiles from the source.
|
|
54
|
+
* The value should be between 0 and 22, inclusive, and less than
|
|
55
|
+
* minZoomLevel, if specified. The default value for this option is 22.
|
|
56
|
+
*/
|
|
57
|
+
maxZoomLevel: PropTypes.number,
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* Influences the y direction of the tile coordinates. (tms inverts y axis)
|
|
61
|
+
*/
|
|
62
|
+
tms: PropTypes.bool,
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* An HTML or literal text string defining the buttons to be displayed in an action sheet when the
|
|
66
|
+
* source is part of a map view’s style and the map view’s attribution button is pressed.
|
|
67
|
+
*/
|
|
68
|
+
attribution: PropTypes.string,
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* Source press listener, gets called when a user presses one of the children layers only
|
|
72
|
+
* if that layer has a higher z-index than another source layers
|
|
73
|
+
*
|
|
74
|
+
* @param {Object} event
|
|
75
|
+
* @param {Object[]} event.features - the geojson features that have hit by the press (might be multiple)
|
|
76
|
+
* @param {Object} event.coordinates - the coordinates of the click
|
|
77
|
+
* @param {Object} event.point - the point of the click
|
|
78
|
+
*/
|
|
79
|
+
onPress: PropTypes.func,
|
|
80
|
+
|
|
81
|
+
/**
|
|
82
|
+
* Overrides the default touch hitbox(44x44 pixels) for the source layers
|
|
83
|
+
*/
|
|
84
|
+
hitbox: PropTypes.shape({
|
|
85
|
+
/**
|
|
86
|
+
* `width` of hitbox
|
|
87
|
+
*/
|
|
88
|
+
width: PropTypes.number.isRequired,
|
|
89
|
+
/**
|
|
90
|
+
* `height` of hitbox
|
|
91
|
+
*/
|
|
92
|
+
height: PropTypes.number.isRequired,
|
|
93
|
+
}),
|
|
94
|
+
};
|
|
95
|
+
|
|
96
|
+
static defaultProps = {
|
|
97
|
+
id: MapboxGL.StyleSource.DefaultSourceID,
|
|
98
|
+
};
|
|
99
|
+
|
|
100
|
+
constructor(props) {
|
|
101
|
+
super(props, NATIVE_MODULE_NAME);
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
_setNativeRef(nativeRef) {
|
|
105
|
+
this._nativeRef = nativeRef;
|
|
106
|
+
super._runPendingNativeCommands(nativeRef);
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
/**
|
|
110
|
+
* Returns all features that match the query parameters regardless of whether or not the feature is
|
|
111
|
+
* currently rendered on the map. The domain of the query includes all currently-loaded vector tiles
|
|
112
|
+
* and GeoJSON source tiles. This function does not check tiles outside of the visible viewport.
|
|
113
|
+
*
|
|
114
|
+
* @example
|
|
115
|
+
* vectorSource.features(['id1', 'id2'])
|
|
116
|
+
*
|
|
117
|
+
* @param {Array=} layerIDs - A set of strings that correspond to the names of layers defined in the current style. Only the features contained in these layers are included in the returned array.
|
|
118
|
+
* @param {Array=} filter - an optional filter statement to filter the returned Features.
|
|
119
|
+
* @return {FeatureCollection}
|
|
120
|
+
*/
|
|
121
|
+
async features(layerIDs = [], filter = []) {
|
|
122
|
+
const res = await this._runNativeCommand('features', this._nativeRef, [
|
|
123
|
+
layerIDs,
|
|
124
|
+
getFilter(filter),
|
|
125
|
+
]);
|
|
126
|
+
|
|
127
|
+
if (isAndroid()) {
|
|
128
|
+
return JSON.parse(res.data);
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
return res.data;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
onPress(event) {
|
|
135
|
+
const {
|
|
136
|
+
nativeEvent: {
|
|
137
|
+
payload: {features, coordinates, point},
|
|
138
|
+
},
|
|
139
|
+
} = event;
|
|
140
|
+
let newEvent = {
|
|
141
|
+
features,
|
|
142
|
+
coordinates,
|
|
143
|
+
point,
|
|
144
|
+
};
|
|
145
|
+
newEvent = copyPropertiesAsDeprecated(
|
|
146
|
+
event,
|
|
147
|
+
newEvent,
|
|
148
|
+
key => {
|
|
149
|
+
console.warn(
|
|
150
|
+
`event.${key} is deprecated on VectorSource#onPress, please use event.features`,
|
|
151
|
+
);
|
|
152
|
+
},
|
|
153
|
+
{
|
|
154
|
+
nativeEvent: origNativeEvent => ({
|
|
155
|
+
...origNativeEvent,
|
|
156
|
+
payload: features[0],
|
|
157
|
+
}),
|
|
158
|
+
},
|
|
159
|
+
);
|
|
160
|
+
this.props.onPress(newEvent);
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
render() {
|
|
164
|
+
const props = {
|
|
165
|
+
id: this.props.id,
|
|
166
|
+
url: this.props.url,
|
|
167
|
+
tileUrlTemplates: this.props.tileUrlTemplates,
|
|
168
|
+
minZoomLevel: this.props.minZoomLevel,
|
|
169
|
+
maxZoomLevel: this.props.maxZoomLevel,
|
|
170
|
+
tms: this.props.tms,
|
|
171
|
+
attribution: this.props.attribution,
|
|
172
|
+
hitbox: this.props.hitbox,
|
|
173
|
+
hasPressListener: isFunction(this.props.onPress),
|
|
174
|
+
onMapboxVectorSourcePress: this.onPress.bind(this),
|
|
175
|
+
onPress: undefined,
|
|
176
|
+
ref: nativeRef => this._setNativeRef(nativeRef),
|
|
177
|
+
onAndroidCallback: isAndroid() ? this._onAndroidCallback : undefined,
|
|
178
|
+
};
|
|
179
|
+
return (
|
|
180
|
+
<RCTMGLVectorSource ref="nativeSource" {...props}>
|
|
181
|
+
{cloneReactChildrenWithProps(this.props.children, {
|
|
182
|
+
sourceID: this.props.id,
|
|
183
|
+
})}
|
|
184
|
+
</RCTMGLVectorSource>
|
|
185
|
+
);
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
const RCTMGLVectorSource = requireNativeComponent(
|
|
190
|
+
NATIVE_MODULE_NAME,
|
|
191
|
+
VectorSource,
|
|
192
|
+
{
|
|
193
|
+
nativeOnly: {
|
|
194
|
+
hasPressListener: true,
|
|
195
|
+
onMapboxVectorSourcePress: true,
|
|
196
|
+
},
|
|
197
|
+
},
|
|
198
|
+
);
|
|
199
|
+
|
|
200
|
+
export default VectorSource;
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
import SymbolLayer from '../SymbolLayer';
|
|
2
|
+
import Animated from '../../utils/animated/Animated';
|
|
3
|
+
import AnimatedMapPoint from '../../utils/animated/AnimatedPoint';
|
|
4
|
+
|
|
5
|
+
import PropTypes from 'prop-types';
|
|
6
|
+
import React from 'react';
|
|
7
|
+
import {Easing} from 'react-native';
|
|
8
|
+
|
|
9
|
+
class Annotation extends React.Component {
|
|
10
|
+
static propTypes = {
|
|
11
|
+
id: PropTypes.string.isRequired,
|
|
12
|
+
animated: PropTypes.bool,
|
|
13
|
+
animationDuration: PropTypes.number,
|
|
14
|
+
animationEasingFunction: PropTypes.func,
|
|
15
|
+
coordinates: PropTypes.arrayOf(PropTypes.number),
|
|
16
|
+
onPress: PropTypes.func,
|
|
17
|
+
children: PropTypes.any,
|
|
18
|
+
style: PropTypes.any,
|
|
19
|
+
icon: PropTypes.oneOfType([
|
|
20
|
+
PropTypes.string,
|
|
21
|
+
PropTypes.number,
|
|
22
|
+
PropTypes.object,
|
|
23
|
+
]),
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
static defaultProps = {
|
|
27
|
+
animated: false,
|
|
28
|
+
animationDuration: 1000,
|
|
29
|
+
animationEasingFunction: Easing.linear,
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
constructor(props) {
|
|
33
|
+
super(props);
|
|
34
|
+
|
|
35
|
+
const shape = this._getShapeFromProps(props);
|
|
36
|
+
|
|
37
|
+
this.state = {
|
|
38
|
+
shape: props.animated ? new AnimatedMapPoint(shape) : shape,
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
this.onPress = this.onPress.bind(this);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
componentDidUpdate(prevProps) {
|
|
45
|
+
if (!Array.isArray(this.props.coordinates)) {
|
|
46
|
+
this.setState({shape: null});
|
|
47
|
+
return;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
const hasCoordChanged =
|
|
51
|
+
prevProps.coordinates[0] !== this.props.coordinates[0] ||
|
|
52
|
+
prevProps.coordinates[1] !== this.props.coordinates[1];
|
|
53
|
+
|
|
54
|
+
if (!hasCoordChanged) {
|
|
55
|
+
return;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
if (this.props.animated && this.state.shape) {
|
|
59
|
+
// flush current animations
|
|
60
|
+
this.state.shape.stopAnimation();
|
|
61
|
+
|
|
62
|
+
this.state.shape
|
|
63
|
+
.timing({
|
|
64
|
+
coordinates: this.props.coordinates,
|
|
65
|
+
easing: this.props.animationEasingFunction,
|
|
66
|
+
duration: this.props.animationDuration,
|
|
67
|
+
})
|
|
68
|
+
.start();
|
|
69
|
+
} else if (!this.state.shape || !this.props.animated) {
|
|
70
|
+
const shape = this._getShapeFromProps(this.props);
|
|
71
|
+
|
|
72
|
+
this.setState({
|
|
73
|
+
shape: this.props.animated ? new AnimatedMapPoint(shape) : shape,
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
onPress() {
|
|
79
|
+
if (this.props.onPress) {
|
|
80
|
+
this.props.onPress();
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
_getShapeFromProps(props = {}) {
|
|
85
|
+
const lng = props.coordinates[0] || 0;
|
|
86
|
+
const lat = props.coordinates[1] || 0;
|
|
87
|
+
return {type: 'Point', coordinates: [lng, lat]};
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
get symbolStyle() {
|
|
91
|
+
if (!this.props.icon) {
|
|
92
|
+
return undefined;
|
|
93
|
+
}
|
|
94
|
+
return Object.assign({}, this.props.style, {
|
|
95
|
+
iconImage: this.props.icon,
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
render() {
|
|
100
|
+
if (!this.props.coordinates) {
|
|
101
|
+
return null;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
return (
|
|
105
|
+
<Animated.ShapeSource
|
|
106
|
+
id={this.props.id}
|
|
107
|
+
ref="source"
|
|
108
|
+
onPress={this.onPress}
|
|
109
|
+
shape={this.state.shape}>
|
|
110
|
+
{this.symbolStyle && (
|
|
111
|
+
<SymbolLayer
|
|
112
|
+
id={`${this.props.id}-symbol`}
|
|
113
|
+
style={this.symbolStyle}
|
|
114
|
+
/>
|
|
115
|
+
)}
|
|
116
|
+
{this.props.children}
|
|
117
|
+
</Animated.ShapeSource>
|
|
118
|
+
);
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
export default Annotation;
|