@rnmapbox/maps 10.0.0-beta.75 → 10.0.0-beta.77
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -3
- package/android/rctmgl/src/main/java-v10/com/mapbox/rctmgl/components/images/RCTMGLImagesManager.kt +5 -5
- package/android/rctmgl/src/main/java-v10/com/mapbox/rctmgl/components/styles/RCTMGLStyle.kt +7 -1
- package/android/rctmgl/src/main/java-v10/com/mapbox/rctmgl/components/styles/RCTMGLStyleFactory.java +5 -5
- package/android/rctmgl/src/main/java-v10/com/mapbox/rctmgl/components/styles/layers/RCTLayer.kt +37 -10
- package/android/rctmgl/src/main/java-v10/com/mapbox/rctmgl/components/styles/layers/RCTMGLBackgroundLayer.kt +21 -0
- package/android/rctmgl/src/main/java-v10/com/mapbox/rctmgl/components/styles/layers/RCTMGLBackgroundLayerManager.kt +65 -0
- package/android/rctmgl/src/main/java-v10/com/mapbox/rctmgl/components/styles/layers/RCTMGLCircleLayer.kt +40 -0
- package/android/rctmgl/src/main/java-v10/com/mapbox/rctmgl/components/styles/layers/RCTMGLCircleLayerManager.kt +76 -0
- package/android/rctmgl/src/main/java-v10/com/mapbox/rctmgl/components/styles/layers/RCTMGLFillExtrusionLayer.kt +43 -0
- package/android/rctmgl/src/main/java-v10/com/mapbox/rctmgl/components/styles/layers/RCTMGLFillExtrusionLayerManager.kt +76 -0
- package/android/rctmgl/src/main/java-v10/com/mapbox/rctmgl/components/styles/layers/RCTMGLFillLayer.kt +40 -0
- package/android/rctmgl/src/main/java-v10/com/mapbox/rctmgl/components/styles/layers/RCTMGLFillLayerManager.kt +76 -0
- package/android/rctmgl/src/main/java-v10/com/mapbox/rctmgl/components/styles/layers/RCTMGLHeatmapLayer.kt +40 -0
- package/android/rctmgl/src/main/java-v10/com/mapbox/rctmgl/components/styles/layers/RCTMGLHeatmapLayerManager.kt +76 -0
- package/android/rctmgl/src/main/java-v10/com/mapbox/rctmgl/components/styles/layers/RCTMGLLineLayer.kt +40 -0
- package/android/rctmgl/src/main/java-v10/com/mapbox/rctmgl/components/styles/layers/RCTMGLLineLayerManager.kt +76 -0
- package/android/rctmgl/src/main/java-v10/com/mapbox/rctmgl/components/styles/layers/RCTMGLRasterLayer.kt +18 -0
- package/android/rctmgl/src/main/java-v10/com/mapbox/rctmgl/components/styles/layers/RCTMGLRasterLayerManager.kt +65 -0
- package/android/rctmgl/src/main/java-v10/com/mapbox/rctmgl/components/styles/layers/RCTMGLSkyLayerManager.kt +76 -0
- package/android/rctmgl/src/main/java-v10/com/mapbox/rctmgl/components/styles/layers/RCTMGLSymbolLayer.kt +40 -0
- package/android/rctmgl/src/main/java-v10/com/mapbox/rctmgl/components/styles/layers/RCTMGLSymbolLayerManager.kt +76 -0
- package/android/rctmgl/src/main/java-v10/com/mapbox/rctmgl/components/styles/sources/RCTMGLImageSource.kt +69 -0
- package/android/rctmgl/src/main/java-v10/com/mapbox/rctmgl/components/styles/sources/RCTMGLImageSourceManager.kt +54 -0
- package/android/rctmgl/src/main/java-v10/com/mapbox/rctmgl/components/styles/sources/RCTMGLRasterDemSource.kt +82 -0
- package/android/rctmgl/src/main/java-v10/com/mapbox/rctmgl/components/styles/sources/RCTMGLRasterDemSourceManager.kt +30 -0
- package/android/rctmgl/src/main/java-v10/com/mapbox/rctmgl/components/styles/sources/RCTMGLRasterSource.kt +37 -0
- package/android/rctmgl/src/main/java-v10/com/mapbox/rctmgl/components/styles/sources/RCTMGLRasterSourceManager.kt +32 -0
- package/android/rctmgl/src/main/java-v10/com/mapbox/rctmgl/components/styles/sources/RCTMGLShapeSource.kt +5 -0
- package/android/rctmgl/src/main/java-v10/com/mapbox/rctmgl/components/styles/sources/RCTMGLShapeSourceManager.kt +10 -4
- package/android/rctmgl/src/main/java-v10/com/mapbox/rctmgl/components/styles/sources/RCTMGLTileSource.kt +44 -0
- package/android/rctmgl/src/main/java-v10/com/mapbox/rctmgl/components/styles/sources/RCTMGLTileSourceManager.kt +69 -0
- package/android/rctmgl/src/main/java-v10/com/mapbox/rctmgl/components/styles/sources/RCTMGLVectorSource.kt +78 -0
- package/android/rctmgl/src/main/java-v10/com/mapbox/rctmgl/components/styles/sources/RCTMGLVectorSourceManager.kt +69 -0
- package/android/rctmgl/src/main/java-v10/com/mapbox/rctmgl/components/styles/sources/RCTSource.kt +101 -85
- package/android/rctmgl/src/main/java-v10/com/mapbox/rctmgl/events/PointAnnotationDragEvent.java +4 -2
- package/ios/RCTMGL-v10/RCMTGLImage.swift +2 -1
- package/ios/RCTMGL-v10/RCTMGLCamera.swift +11 -31
- package/ios/RCTMGL-v10/RCTMGLImages.swift +57 -17
- package/ios/RCTMGL-v10/RCTMGLInteractiveElement.swift +13 -1
- package/ios/RCTMGL-v10/RCTMGLLayer.swift +35 -6
- package/ios/RCTMGL-v10/RCTMGLLocationModule.swift +27 -4
- package/ios/RCTMGL-v10/RCTMGLMapView.swift +15 -3
- package/ios/RCTMGL-v10/RCTMGLSource.swift +35 -17
- package/ios/RCTMGL-v10/RCTMGLUtils.swift +14 -5
- package/javascript/MGLModule.ts +54 -0
- package/javascript/Mapbox.ts +100 -0
- package/javascript/classes/index.d.ts +20 -1
- package/javascript/components/AbstractLayer.tsx +2 -1
- package/javascript/components/Annotation.tsx +141 -0
- package/javascript/components/BackgroundLayer.tsx +6 -1
- package/javascript/components/{Callout.js → Callout.tsx} +53 -45
- package/javascript/components/CircleLayer.tsx +5 -0
- package/javascript/components/FillExtrusionLayer.tsx +6 -1
- package/javascript/components/FillLayer.tsx +5 -0
- package/javascript/components/HeadingIndicator.tsx +24 -13
- package/javascript/components/HeatmapLayer.tsx +6 -1
- package/javascript/components/ImageSource.tsx +6 -1
- package/javascript/components/Images.tsx +58 -6
- package/javascript/components/LineLayer.tsx +5 -0
- package/javascript/components/MapView.tsx +1 -1
- package/javascript/components/MarkerView.tsx +3 -2
- package/javascript/components/PointAnnotation.tsx +11 -6
- package/javascript/components/RasterDemSource.tsx +5 -0
- package/javascript/components/RasterLayer.tsx +6 -1
- package/javascript/components/RasterSource.tsx +5 -0
- package/javascript/components/ShapeSource.tsx +6 -1
- package/javascript/components/SkyLayer.tsx +5 -0
- package/javascript/components/{Style.js → Style.tsx} +117 -35
- package/javascript/components/SymbolLayer.tsx +6 -1
- package/javascript/components/Terrain.tsx +8 -7
- package/javascript/components/{UserLocation.js → UserLocation.tsx} +106 -95
- package/javascript/components/VectorSource.tsx +6 -1
- package/javascript/index.ts +4 -0
- package/javascript/modules/offline/offlineManager.ts +5 -1
- package/javascript/modules/snapshot/snapshotManager.ts +1 -0
- package/javascript/types/BaseProps.ts +1 -0
- package/javascript/types/Position.ts +1 -0
- package/javascript/utils/Logger.ts +1 -1
- package/javascript/utils/geoUtils.ts +0 -35
- package/javascript/utils/index.ts +0 -8
- package/javascript/utils/styleMap.ts +0 -1598
- package/lib/commonjs/MGLModule.js +37 -0
- package/lib/commonjs/MGLModule.js.map +1 -0
- package/lib/commonjs/Mapbox.js +379 -0
- package/lib/commonjs/Mapbox.js.map +1 -0
- package/lib/commonjs/classes/index.d.js +2 -0
- package/lib/commonjs/classes/index.d.js.map +1 -1
- package/lib/commonjs/components/AbstractLayer.js +1 -2
- package/lib/commonjs/components/AbstractLayer.js.map +1 -1
- package/lib/commonjs/components/{annotations/Annotation.js → Annotation.js} +26 -27
- package/lib/commonjs/components/Annotation.js.map +1 -0
- package/lib/commonjs/components/BackgroundLayer.js.map +1 -1
- package/lib/commonjs/components/Callout.js +7 -33
- package/lib/commonjs/components/Callout.js.map +1 -1
- package/lib/commonjs/components/CircleLayer.js.map +1 -1
- package/lib/commonjs/components/FillExtrusionLayer.js.map +1 -1
- package/lib/commonjs/components/FillLayer.js.map +1 -1
- package/lib/commonjs/components/HeadingIndicator.js +12 -3
- package/lib/commonjs/components/HeadingIndicator.js.map +1 -1
- package/lib/commonjs/components/HeatmapLayer.js.map +1 -1
- package/lib/commonjs/components/ImageSource.js.map +1 -1
- package/lib/commonjs/components/Images.js +17 -1
- package/lib/commonjs/components/Images.js.map +1 -1
- package/lib/commonjs/components/LineLayer.js.map +1 -1
- package/lib/commonjs/components/MapView.js.map +1 -1
- package/lib/commonjs/components/MarkerView.js.map +1 -1
- package/lib/commonjs/components/PointAnnotation.js.map +1 -1
- package/lib/commonjs/components/RasterDemSource.js.map +1 -1
- package/lib/commonjs/components/RasterLayer.js.map +1 -1
- package/lib/commonjs/components/RasterSource.js.map +1 -1
- package/lib/commonjs/components/ShapeSource.js.map +1 -1
- package/lib/commonjs/components/SkyLayer.js.map +1 -1
- package/lib/commonjs/components/Style.js +11 -15
- package/lib/commonjs/components/Style.js.map +1 -1
- package/lib/commonjs/components/SymbolLayer.js.map +1 -1
- package/lib/commonjs/components/Terrain.js.map +1 -1
- package/lib/commonjs/components/UserLocation.js +28 -78
- package/lib/commonjs/components/UserLocation.js.map +1 -1
- package/lib/commonjs/components/VectorSource.js.map +1 -1
- package/lib/commonjs/index.js +16 -339
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/modules/offline/offlineManager.js +6 -0
- package/lib/commonjs/modules/offline/offlineManager.js.map +1 -1
- package/lib/commonjs/modules/snapshot/snapshotManager.js.map +1 -1
- package/lib/commonjs/types/Position.js +2 -0
- package/lib/commonjs/types/Position.js.map +1 -0
- package/lib/commonjs/utils/animated/Animated.js.map +1 -1
- package/lib/commonjs/utils/geoUtils.js +1 -19
- package/lib/commonjs/utils/geoUtils.js.map +1 -1
- package/lib/commonjs/utils/index.js +0 -16
- package/lib/commonjs/utils/index.js.map +1 -1
- package/lib/commonjs/utils/styleMap.js +1 -1217
- package/lib/commonjs/utils/styleMap.js.map +1 -1
- package/lib/module/MGLModule.js +19 -0
- package/lib/module/MGLModule.js.map +1 -0
- package/lib/module/Mapbox.js +59 -0
- package/lib/module/Mapbox.js.map +1 -0
- package/lib/module/classes/index.d.js +2 -0
- package/lib/module/classes/index.d.js.map +1 -1
- package/lib/module/components/AbstractLayer.js +1 -1
- package/lib/module/components/AbstractLayer.js.map +1 -1
- package/lib/module/components/{annotations/Annotation.js → Annotation.js} +26 -27
- package/lib/module/components/Annotation.js.map +1 -0
- package/lib/module/components/BackgroundLayer.js.map +1 -1
- package/lib/module/components/Callout.js +7 -33
- package/lib/module/components/Callout.js.map +1 -1
- package/lib/module/components/CircleLayer.js.map +1 -1
- package/lib/module/components/FillExtrusionLayer.js.map +1 -1
- package/lib/module/components/FillLayer.js.map +1 -1
- package/lib/module/components/HeadingIndicator.js +12 -3
- package/lib/module/components/HeadingIndicator.js.map +1 -1
- package/lib/module/components/HeatmapLayer.js.map +1 -1
- package/lib/module/components/ImageSource.js.map +1 -1
- package/lib/module/components/Images.js +17 -1
- package/lib/module/components/Images.js.map +1 -1
- package/lib/module/components/LineLayer.js.map +1 -1
- package/lib/module/components/MapView.js.map +1 -1
- package/lib/module/components/MarkerView.js.map +1 -1
- package/lib/module/components/PointAnnotation.js.map +1 -1
- package/lib/module/components/RasterDemSource.js.map +1 -1
- package/lib/module/components/RasterLayer.js.map +1 -1
- package/lib/module/components/RasterSource.js.map +1 -1
- package/lib/module/components/ShapeSource.js.map +1 -1
- package/lib/module/components/SkyLayer.js.map +1 -1
- package/lib/module/components/Style.js +11 -15
- package/lib/module/components/Style.js.map +1 -1
- package/lib/module/components/SymbolLayer.js.map +1 -1
- package/lib/module/components/Terrain.js.map +1 -1
- package/lib/module/components/UserLocation.js +27 -77
- package/lib/module/components/UserLocation.js.map +1 -1
- package/lib/module/components/VectorSource.js.map +1 -1
- package/lib/module/index.js +3 -108
- package/lib/module/index.js.map +1 -1
- package/lib/module/modules/offline/offlineManager.js +1 -0
- package/lib/module/modules/offline/offlineManager.js.map +1 -1
- package/lib/module/modules/snapshot/snapshotManager.js.map +1 -1
- package/lib/module/types/Position.js +2 -0
- package/lib/module/types/Position.js.map +1 -0
- package/lib/module/utils/animated/Animated.js.map +1 -1
- package/lib/module/utils/geoUtils.js +0 -16
- package/lib/module/utils/geoUtils.js.map +1 -1
- package/lib/module/utils/index.js +0 -14
- package/lib/module/utils/index.js.map +1 -1
- package/lib/module/utils/styleMap.js +0 -1201
- package/lib/module/utils/styleMap.js.map +1 -1
- package/lib/typescript/MGLModule.d.ts +22 -0
- package/lib/typescript/MGLModule.d.ts.map +1 -0
- package/lib/typescript/Mapbox.d.ts +54 -0
- package/lib/typescript/Mapbox.d.ts.map +1 -0
- package/lib/typescript/components/AbstractLayer.d.ts +1 -0
- package/lib/typescript/components/AbstractLayer.d.ts.map +1 -1
- package/lib/typescript/components/Annotation.d.ts +34 -0
- package/lib/typescript/components/Annotation.d.ts.map +1 -0
- package/lib/typescript/components/BackgroundLayer.d.ts +5 -1
- package/lib/typescript/components/BackgroundLayer.d.ts.map +1 -1
- package/lib/typescript/components/Callout.d.ts +41 -0
- package/lib/typescript/components/Callout.d.ts.map +1 -0
- package/lib/typescript/components/CircleLayer.d.ts +4 -0
- package/lib/typescript/components/CircleLayer.d.ts.map +1 -1
- package/lib/typescript/components/FillExtrusionLayer.d.ts +5 -1
- package/lib/typescript/components/FillExtrusionLayer.d.ts.map +1 -1
- package/lib/typescript/components/FillLayer.d.ts +4 -0
- package/lib/typescript/components/FillLayer.d.ts.map +1 -1
- package/lib/typescript/components/HeadingIndicator.d.ts +2 -1
- package/lib/typescript/components/HeadingIndicator.d.ts.map +1 -1
- package/lib/typescript/components/HeatmapLayer.d.ts +5 -1
- package/lib/typescript/components/HeatmapLayer.d.ts.map +1 -1
- package/lib/typescript/components/ImageSource.d.ts +5 -1
- package/lib/typescript/components/ImageSource.d.ts.map +1 -1
- package/lib/typescript/components/Images.d.ts +24 -2
- package/lib/typescript/components/Images.d.ts.map +1 -1
- package/lib/typescript/components/LineLayer.d.ts +4 -0
- package/lib/typescript/components/LineLayer.d.ts.map +1 -1
- package/lib/typescript/components/MapView.d.ts +2 -5
- package/lib/typescript/components/MapView.d.ts.map +1 -1
- package/lib/typescript/components/MarkerView.d.ts +3 -2
- package/lib/typescript/components/MarkerView.d.ts.map +1 -1
- package/lib/typescript/components/PointAnnotation.d.ts +8 -6
- package/lib/typescript/components/PointAnnotation.d.ts.map +1 -1
- package/lib/typescript/components/RasterDemSource.d.ts +4 -0
- package/lib/typescript/components/RasterDemSource.d.ts.map +1 -1
- package/lib/typescript/components/RasterLayer.d.ts +5 -1
- package/lib/typescript/components/RasterLayer.d.ts.map +1 -1
- package/lib/typescript/components/RasterSource.d.ts +4 -0
- package/lib/typescript/components/RasterSource.d.ts.map +1 -1
- package/lib/typescript/components/ShapeSource.d.ts +5 -1
- package/lib/typescript/components/ShapeSource.d.ts.map +1 -1
- package/lib/typescript/components/SkyLayer.d.ts +4 -0
- package/lib/typescript/components/SkyLayer.d.ts.map +1 -1
- package/lib/typescript/components/Style.d.ts +74 -0
- package/lib/typescript/components/Style.d.ts.map +1 -0
- package/lib/typescript/components/SymbolLayer.d.ts +5 -1
- package/lib/typescript/components/SymbolLayer.d.ts.map +1 -1
- package/lib/typescript/components/Terrain.d.ts +2 -2
- package/lib/typescript/components/Terrain.d.ts.map +1 -1
- package/lib/typescript/components/UserLocation.d.ts +102 -0
- package/lib/typescript/components/UserLocation.d.ts.map +1 -0
- package/lib/typescript/components/VectorSource.d.ts +5 -1
- package/lib/typescript/components/VectorSource.d.ts.map +1 -1
- package/lib/typescript/index.d.ts +4 -0
- package/lib/typescript/index.d.ts.map +1 -0
- package/lib/typescript/modules/offline/offlineManager.d.ts +2 -1
- package/lib/typescript/modules/offline/offlineManager.d.ts.map +1 -1
- package/lib/typescript/modules/snapshot/snapshotManager.d.ts +1 -0
- package/lib/typescript/modules/snapshot/snapshotManager.d.ts.map +1 -1
- package/lib/typescript/types/BaseProps.d.ts +1 -0
- package/lib/typescript/types/BaseProps.d.ts.map +1 -1
- package/lib/typescript/types/Position.d.ts +2 -0
- package/lib/typescript/types/Position.d.ts.map +1 -0
- package/lib/typescript/utils/Logger.d.ts +1 -1
- package/lib/typescript/utils/Logger.d.ts.map +1 -1
- package/lib/typescript/utils/animated/Animated.d.ts +23 -0
- package/lib/typescript/utils/animated/Animated.d.ts.map +1 -0
- package/lib/typescript/utils/geoUtils.d.ts +0 -8
- package/lib/typescript/utils/geoUtils.d.ts.map +1 -1
- package/lib/typescript/utils/index.d.ts +0 -14
- package/lib/typescript/utils/index.d.ts.map +1 -1
- package/lib/typescript/utils/styleMap.d.ts +0 -1406
- package/lib/typescript/utils/styleMap.d.ts.map +1 -1
- package/package.json +35 -39
- package/plugin/build/withMapbox.d.ts +10 -6
- package/plugin/build/withMapbox.js +119 -137
- package/plugin/install.md +21 -0
- package/plugin/src/withMapbox.ts +166 -138
- package/android/rctmgl/src/main/java-v10/com/mapbox/rctmgl/components/styles/layers/RCTMGLBackgroundLayer.java +0 -23
- package/android/rctmgl/src/main/java-v10/com/mapbox/rctmgl/components/styles/layers/RCTMGLBackgroundLayerManager.java +0 -60
- package/android/rctmgl/src/main/java-v10/com/mapbox/rctmgl/components/styles/layers/RCTMGLCircleLayer.java +0 -53
- package/android/rctmgl/src/main/java-v10/com/mapbox/rctmgl/components/styles/layers/RCTMGLCircleLayerManager.java +0 -73
- package/android/rctmgl/src/main/java-v10/com/mapbox/rctmgl/components/styles/layers/RCTMGLFillExtrusionLayer.java +0 -51
- package/android/rctmgl/src/main/java-v10/com/mapbox/rctmgl/components/styles/layers/RCTMGLFillExtrusionLayerManager.java +0 -76
- package/android/rctmgl/src/main/java-v10/com/mapbox/rctmgl/components/styles/layers/RCTMGLFillLayer.java +0 -51
- package/android/rctmgl/src/main/java-v10/com/mapbox/rctmgl/components/styles/layers/RCTMGLFillLayerManager.java +0 -77
- package/android/rctmgl/src/main/java-v10/com/mapbox/rctmgl/components/styles/layers/RCTMGLHeatmapLayer.java +0 -51
- package/android/rctmgl/src/main/java-v10/com/mapbox/rctmgl/components/styles/layers/RCTMGLHeatmapLayerManager.java +0 -73
- package/android/rctmgl/src/main/java-v10/com/mapbox/rctmgl/components/styles/layers/RCTMGLLineLayer.java +0 -51
- package/android/rctmgl/src/main/java-v10/com/mapbox/rctmgl/components/styles/layers/RCTMGLLineLayerManager.java +0 -75
- package/android/rctmgl/src/main/java-v10/com/mapbox/rctmgl/components/styles/layers/RCTMGLRasterLayer.java +0 -24
- package/android/rctmgl/src/main/java-v10/com/mapbox/rctmgl/components/styles/layers/RCTMGLRasterLayerManager.java +0 -60
- package/android/rctmgl/src/main/java-v10/com/mapbox/rctmgl/components/styles/layers/RCTMGLSkyLayerManager.java +0 -73
- package/android/rctmgl/src/main/java-v10/com/mapbox/rctmgl/components/styles/layers/RCTMGLSymbolLayer.java +0 -51
- package/android/rctmgl/src/main/java-v10/com/mapbox/rctmgl/components/styles/layers/RCTMGLSymbolLayerManager.java +0 -71
- package/android/rctmgl/src/main/java-v10/com/mapbox/rctmgl/components/styles/sources/RCTMGLImageSource.java +0 -76
- package/android/rctmgl/src/main/java-v10/com/mapbox/rctmgl/components/styles/sources/RCTMGLImageSourceManager.java +0 -68
- package/android/rctmgl/src/main/java-v10/com/mapbox/rctmgl/components/styles/sources/RCTMGLRasterDemSource.java +0 -122
- package/android/rctmgl/src/main/java-v10/com/mapbox/rctmgl/components/styles/sources/RCTMGLRasterDemSourceManager.java +0 -64
- package/android/rctmgl/src/main/java-v10/com/mapbox/rctmgl/components/styles/sources/RCTMGLRasterSource.java +0 -43
- package/android/rctmgl/src/main/java-v10/com/mapbox/rctmgl/components/styles/sources/RCTMGLRasterSourceManager.java +0 -39
- package/android/rctmgl/src/main/java-v10/com/mapbox/rctmgl/components/styles/sources/RCTMGLTileSource.java +0 -103
- package/android/rctmgl/src/main/java-v10/com/mapbox/rctmgl/components/styles/sources/RCTMGLTileSourceManager.java +0 -80
- package/android/rctmgl/src/main/java-v10/com/mapbox/rctmgl/components/styles/sources/RCTMGLVectorSource.java +0 -100
- package/android/rctmgl/src/main/java-v10/com/mapbox/rctmgl/components/styles/sources/RCTMGLVectorSourceManager.java +0 -80
- package/index.d.ts +0 -516
- package/javascript/components/annotations/Annotation.js +0 -122
- package/javascript/index.js +0 -162
- package/lib/commonjs/components/annotations/Annotation.js.map +0 -1
- package/lib/module/components/annotations/Annotation.js.map +0 -1
- /package/javascript/utils/animated/{Animated.js → Animated.ts} +0 -0
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import React, { useMemo, useState, useEffect } from 'react';
|
|
2
|
-
|
|
2
|
+
|
|
3
|
+
import { FilterExpression } from '../utils/MapboxStyles';
|
|
3
4
|
|
|
4
5
|
import CircleLayer from './CircleLayer';
|
|
5
6
|
import RasterLayer from './RasterLayer';
|
|
@@ -14,7 +15,7 @@ import RasterSource from './RasterSource';
|
|
|
14
15
|
import ImageSource from './ImageSource';
|
|
15
16
|
import { ShapeSource } from './ShapeSource';
|
|
16
17
|
|
|
17
|
-
function toCamelCase(s) {
|
|
18
|
+
function toCamelCase(s: string): string {
|
|
18
19
|
return s.replace(/([-_][a-z])/gi, ($1) => {
|
|
19
20
|
return $1.toUpperCase().replace('-', '').replace('_', '');
|
|
20
21
|
});
|
|
@@ -22,11 +23,13 @@ function toCamelCase(s) {
|
|
|
22
23
|
|
|
23
24
|
// Patches the Mapbox Style Specification keys into the style props attributes:
|
|
24
25
|
// icon-allow-overlap -> iconAllowOverlap
|
|
25
|
-
function toCamelCaseKeys(oldObj) {
|
|
26
|
+
function toCamelCaseKeys(oldObj?: { [key: string]: unknown }): {
|
|
27
|
+
[key: string]: unknown;
|
|
28
|
+
} {
|
|
26
29
|
if (!oldObj) {
|
|
27
30
|
return {};
|
|
28
31
|
}
|
|
29
|
-
const newObj = {};
|
|
32
|
+
const newObj: { [key: string]: unknown } = {};
|
|
30
33
|
Object.keys(oldObj).forEach((key) => {
|
|
31
34
|
const value = oldObj[key];
|
|
32
35
|
if (key.includes('-')) {
|
|
@@ -38,7 +41,7 @@ function toCamelCaseKeys(oldObj) {
|
|
|
38
41
|
return newObj;
|
|
39
42
|
}
|
|
40
43
|
|
|
41
|
-
function getLayerComponentType(layer) {
|
|
44
|
+
function getLayerComponentType(layer: { type: string }) {
|
|
42
45
|
const { type } = layer;
|
|
43
46
|
|
|
44
47
|
switch (type) {
|
|
@@ -65,8 +68,10 @@ function getLayerComponentType(layer) {
|
|
|
65
68
|
return null;
|
|
66
69
|
}
|
|
67
70
|
|
|
68
|
-
function asLayerComponent(layer) {
|
|
69
|
-
|
|
71
|
+
function asLayerComponent(layer: MapboxJSONLayer) {
|
|
72
|
+
type GenericProps = { key?: string; id: string };
|
|
73
|
+
const LayerComponent: typeof React.PureComponent<GenericProps> | null =
|
|
74
|
+
getLayerComponentType(layer) as typeof React.PureComponent<GenericProps>;
|
|
70
75
|
if (!LayerComponent) {
|
|
71
76
|
return null;
|
|
72
77
|
}
|
|
@@ -76,7 +81,14 @@ function asLayerComponent(layer) {
|
|
|
76
81
|
...toCamelCaseKeys(layer.layout),
|
|
77
82
|
};
|
|
78
83
|
|
|
79
|
-
const layerProps
|
|
84
|
+
const layerProps: {
|
|
85
|
+
sourceID?: string;
|
|
86
|
+
sourceLayerID?: string;
|
|
87
|
+
minZoomLevel?: number;
|
|
88
|
+
maxZoomLevel?: number;
|
|
89
|
+
filter?: FilterExpression;
|
|
90
|
+
style?: object;
|
|
91
|
+
} = {};
|
|
80
92
|
|
|
81
93
|
if (layer.source) {
|
|
82
94
|
layerProps.sourceID = layer.source;
|
|
@@ -100,8 +112,17 @@ function asLayerComponent(layer) {
|
|
|
100
112
|
return <LayerComponent key={layer.id} id={layer.id} {...layerProps} />;
|
|
101
113
|
}
|
|
102
114
|
|
|
103
|
-
|
|
104
|
-
|
|
115
|
+
type SourceProps = {
|
|
116
|
+
url?: string;
|
|
117
|
+
tileUrlTemplates?: string[];
|
|
118
|
+
minZoomLevel?: number;
|
|
119
|
+
maxZoomLevel?: number;
|
|
120
|
+
attribution?: string;
|
|
121
|
+
tms?: boolean;
|
|
122
|
+
};
|
|
123
|
+
|
|
124
|
+
function getTileSourceProps(source: MapboxJSONSource): SourceProps {
|
|
125
|
+
const sourceProps: SourceProps = {};
|
|
105
126
|
if (source.url) {
|
|
106
127
|
sourceProps.url = source.url;
|
|
107
128
|
}
|
|
@@ -123,20 +144,22 @@ function getTileSourceProps(source) {
|
|
|
123
144
|
return sourceProps;
|
|
124
145
|
}
|
|
125
146
|
|
|
126
|
-
function getVectorSource(id, source) {
|
|
147
|
+
function getVectorSource(id: string, source: MapboxJSONSource) {
|
|
127
148
|
const sourceProps = { ...getTileSourceProps(source) };
|
|
128
149
|
return <VectorSource key={id} id={id} {...sourceProps} />;
|
|
129
150
|
}
|
|
130
151
|
|
|
131
|
-
function getRasterSource(id, source) {
|
|
132
|
-
const sourceProps
|
|
152
|
+
function getRasterSource(id: string, source: MapboxJSONSource) {
|
|
153
|
+
const sourceProps: { tileSize?: number } & SourceProps = {
|
|
154
|
+
...getTileSourceProps(source),
|
|
155
|
+
};
|
|
133
156
|
if (source.tileSize) {
|
|
134
157
|
sourceProps.tileSize = source.tileSize;
|
|
135
158
|
}
|
|
136
159
|
return <RasterSource key={id} id={id} {...sourceProps} />;
|
|
137
160
|
}
|
|
138
161
|
|
|
139
|
-
function getImageSource(id, source) {
|
|
162
|
+
function getImageSource(id: string, source: MapboxJSONSource) {
|
|
140
163
|
const sourceProps = {
|
|
141
164
|
url: source.url,
|
|
142
165
|
coordinates: source.coordinates,
|
|
@@ -144,12 +167,24 @@ function getImageSource(id, source) {
|
|
|
144
167
|
return <ImageSource key={id} id={id} {...sourceProps} />;
|
|
145
168
|
}
|
|
146
169
|
|
|
147
|
-
|
|
148
|
-
|
|
170
|
+
type ShapeShourceShape = typeof ShapeSource.prototype.props['shape'];
|
|
171
|
+
|
|
172
|
+
function getShapeSource(id: string, source: MapboxJSONSource) {
|
|
173
|
+
const sourceProps: {
|
|
174
|
+
url?: string;
|
|
175
|
+
shape?: ShapeShourceShape;
|
|
176
|
+
cluster?: boolean;
|
|
177
|
+
clusterRadius?: number;
|
|
178
|
+
clusterMaxZoomLevel?: number;
|
|
179
|
+
clusterProperties?: object;
|
|
180
|
+
buffer?: number;
|
|
181
|
+
tolerance?: number;
|
|
182
|
+
lineMetrics?: boolean;
|
|
183
|
+
} & SourceProps = {};
|
|
149
184
|
if (source.data && typeof source.data === 'string') {
|
|
150
185
|
sourceProps.url = source.data;
|
|
151
186
|
} else if (source.data && typeof source.data === 'object') {
|
|
152
|
-
sourceProps.shape = source.data;
|
|
187
|
+
sourceProps.shape = source.data as ShapeShourceShape;
|
|
153
188
|
}
|
|
154
189
|
if (source.cluster !== undefined) {
|
|
155
190
|
sourceProps.cluster = source.cluster;
|
|
@@ -178,7 +213,7 @@ function getShapeSource(id, source) {
|
|
|
178
213
|
return <ShapeSource key={id} id={id} {...sourceProps} />;
|
|
179
214
|
}
|
|
180
215
|
|
|
181
|
-
function asSourceComponent(id, source) {
|
|
216
|
+
function asSourceComponent(id: string, source: MapboxJSONSource) {
|
|
182
217
|
switch (source.type) {
|
|
183
218
|
case 'vector':
|
|
184
219
|
return getVectorSource(id, source);
|
|
@@ -195,26 +230,79 @@ function asSourceComponent(id, source) {
|
|
|
195
230
|
return null;
|
|
196
231
|
}
|
|
197
232
|
|
|
233
|
+
type MapboxJSONLayer = {
|
|
234
|
+
type: string;
|
|
235
|
+
id: string;
|
|
236
|
+
paint?: { [k: string]: unknown };
|
|
237
|
+
layout?: { [k: string]: unknown };
|
|
238
|
+
source?: string;
|
|
239
|
+
minzoom?: number;
|
|
240
|
+
maxzoom?: number;
|
|
241
|
+
filter?: FilterExpression;
|
|
242
|
+
style?: object;
|
|
243
|
+
['source-layer']: string;
|
|
244
|
+
};
|
|
245
|
+
|
|
246
|
+
type MapboxJSONSource = {
|
|
247
|
+
type: string;
|
|
248
|
+
url?: string;
|
|
249
|
+
tiles?: string[];
|
|
250
|
+
minzoom?: number;
|
|
251
|
+
maxzoom?: number;
|
|
252
|
+
attribution?: string;
|
|
253
|
+
scheme?: string;
|
|
254
|
+
tileSize?: number;
|
|
255
|
+
coordinates?: [
|
|
256
|
+
[number, number],
|
|
257
|
+
[number, number],
|
|
258
|
+
[number, number],
|
|
259
|
+
[number, number],
|
|
260
|
+
];
|
|
261
|
+
data?: string | object;
|
|
262
|
+
|
|
263
|
+
buffer: number;
|
|
264
|
+
cluster?: boolean;
|
|
265
|
+
clusterRadius?: number;
|
|
266
|
+
clusterMaxZoom?: number;
|
|
267
|
+
clusterProperties?: object;
|
|
268
|
+
tolerance?: number;
|
|
269
|
+
lineMetrics?: boolean;
|
|
270
|
+
};
|
|
271
|
+
|
|
272
|
+
type MapboxJSON = {
|
|
273
|
+
layers?: MapboxJSONLayer[];
|
|
274
|
+
sources?: { [key: string]: MapboxJSONSource };
|
|
275
|
+
};
|
|
276
|
+
|
|
277
|
+
type Props = {
|
|
278
|
+
/**
|
|
279
|
+
* A JSON object conforming to the schema described in the Mapbox Style Specification , or a URL to such JSON.
|
|
280
|
+
*/
|
|
281
|
+
json: MapboxJSON | URL;
|
|
282
|
+
};
|
|
283
|
+
|
|
198
284
|
/**
|
|
199
285
|
* Style is a component that automatically adds sources / layers to the map using Mapbox GL Style Spec.
|
|
200
286
|
* Only [`sources`](https://docs.mapbox.com/mapbox-gl-js/style-spec/sources) & [`layers`](https://docs.mapbox.com/mapbox-gl-js/style-spec/layers/) are supported.
|
|
201
287
|
* Other fields such as `sprites`, `glyphs` etc. will be ignored. Not all layer / source attributes from the style spec are supported, in general the supported attributes will be mentioned under https://github.com/rnmapbox/maps/tree/main/docs.
|
|
202
288
|
*/
|
|
203
|
-
const Style = (props) => {
|
|
289
|
+
const Style = (props: Props) => {
|
|
204
290
|
const [fetchedJson, setFetchedJson] = useState({});
|
|
205
|
-
const json =
|
|
291
|
+
const json: MapboxJSON =
|
|
292
|
+
typeof props.json === 'object' ? props.json : fetchedJson;
|
|
206
293
|
|
|
207
294
|
// Fetch style when props.json is a URL
|
|
208
295
|
useEffect(() => {
|
|
209
296
|
const abortController = new AbortController();
|
|
210
|
-
const fetchStyleJson = async () => {
|
|
297
|
+
const fetchStyleJson = async (json: string) => {
|
|
211
298
|
try {
|
|
212
|
-
const response = await fetch(
|
|
299
|
+
const response = await fetch(json, {
|
|
213
300
|
signal: abortController.signal,
|
|
214
301
|
});
|
|
215
302
|
const responseJson = await response.json();
|
|
216
303
|
setFetchedJson(responseJson);
|
|
217
|
-
} catch (
|
|
304
|
+
} catch (error: unknown) {
|
|
305
|
+
const e = error as { name?: string };
|
|
218
306
|
if (e.name === 'AbortError') {
|
|
219
307
|
return;
|
|
220
308
|
}
|
|
@@ -222,7 +310,7 @@ const Style = (props) => {
|
|
|
222
310
|
}
|
|
223
311
|
};
|
|
224
312
|
if (typeof props.json === 'string') {
|
|
225
|
-
fetchStyleJson();
|
|
313
|
+
fetchStyleJson(props.json);
|
|
226
314
|
}
|
|
227
315
|
return function cleanup() {
|
|
228
316
|
abortController.abort();
|
|
@@ -238,14 +326,15 @@ const Style = (props) => {
|
|
|
238
326
|
}, [json.layers]);
|
|
239
327
|
|
|
240
328
|
// Extract source components from json
|
|
329
|
+
const { sources } = json;
|
|
241
330
|
const sourceComponents = useMemo(() => {
|
|
242
|
-
if (!
|
|
331
|
+
if (!sources || !Object.keys(sources)) {
|
|
243
332
|
return [];
|
|
244
333
|
}
|
|
245
|
-
return Object.keys(
|
|
246
|
-
.map((id) => asSourceComponent(id,
|
|
334
|
+
return Object.keys(sources)
|
|
335
|
+
.map((id) => asSourceComponent(id, sources[id]))
|
|
247
336
|
.filter((x) => !!x);
|
|
248
|
-
}, [
|
|
337
|
+
}, [sources]);
|
|
249
338
|
|
|
250
339
|
return (
|
|
251
340
|
<>
|
|
@@ -255,11 +344,4 @@ const Style = (props) => {
|
|
|
255
344
|
);
|
|
256
345
|
};
|
|
257
346
|
|
|
258
|
-
Style.propTypes = {
|
|
259
|
-
/**
|
|
260
|
-
* A JSON object conforming to the schema described in the Mapbox Style Specification , or a URL to such JSON.
|
|
261
|
-
*/
|
|
262
|
-
json: PropTypes.any,
|
|
263
|
-
};
|
|
264
|
-
|
|
265
347
|
export default Style;
|
|
@@ -12,10 +12,15 @@ export const NATIVE_MODULE_NAME = 'RCTMGLSymbolLayer';
|
|
|
12
12
|
|
|
13
13
|
export type Props = {
|
|
14
14
|
/**
|
|
15
|
-
* A string that uniquely identifies the
|
|
15
|
+
* A string that uniquely identifies the layer in the style to which it is added.
|
|
16
16
|
*/
|
|
17
17
|
id: string;
|
|
18
18
|
|
|
19
|
+
/**
|
|
20
|
+
* The id refers to en existing layer in the style. Does not create a new layer.
|
|
21
|
+
*/
|
|
22
|
+
existing?: boolean;
|
|
23
|
+
|
|
19
24
|
/**
|
|
20
25
|
* The source from which to obtain the data to style.
|
|
21
26
|
* If the source has not yet been added to the current style, the behavior is undefined.
|
|
@@ -11,7 +11,7 @@ type Props = BaseProps & {
|
|
|
11
11
|
/**
|
|
12
12
|
* Name of a source of raster_dem type to be used for terrain elevation.
|
|
13
13
|
*/
|
|
14
|
-
sourceID
|
|
14
|
+
sourceID?: string;
|
|
15
15
|
|
|
16
16
|
/**
|
|
17
17
|
* Deprecated, use exaggeration in style instead
|
|
@@ -21,7 +21,11 @@ type Props = BaseProps & {
|
|
|
21
21
|
/**
|
|
22
22
|
* Customizable style attributes
|
|
23
23
|
*/
|
|
24
|
-
style
|
|
24
|
+
style?: TerrainLayerStyleProps;
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
type NativeProps = Omit<Props, 'style'> & {
|
|
28
|
+
reactStyle?: { [key: string]: StyleValue };
|
|
25
29
|
};
|
|
26
30
|
|
|
27
31
|
export const Terrain = memo((props: Props) => {
|
|
@@ -46,8 +50,5 @@ export const Terrain = memo((props: Props) => {
|
|
|
46
50
|
return <RCTMGLTerrain {...baseProps} />;
|
|
47
51
|
});
|
|
48
52
|
|
|
49
|
-
const RCTMGLTerrain: HostComponent<
|
|
50
|
-
|
|
51
|
-
reactStyle?: { [key: string]: StyleValue };
|
|
52
|
-
style?: undefined;
|
|
53
|
-
}> = requireNativeComponent(NATIVE_MODULE_NAME);
|
|
53
|
+
const RCTMGLTerrain: HostComponent<NativeProps> =
|
|
54
|
+
requireNativeComponent(NATIVE_MODULE_NAME);
|
|
@@ -1,18 +1,19 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import PropTypes from 'prop-types';
|
|
1
|
+
import React, { ReactElement } from 'react';
|
|
3
2
|
|
|
4
3
|
import locationManager from '../modules/location/locationManager';
|
|
4
|
+
import { type Location } from '../modules/location/locationManager';
|
|
5
|
+
import { CircleLayerStyle } from '../Mapbox';
|
|
5
6
|
|
|
6
|
-
import Annotation from './
|
|
7
|
+
import Annotation from './Annotation';
|
|
7
8
|
import CircleLayer from './CircleLayer';
|
|
8
9
|
import HeadingIndicator from './HeadingIndicator';
|
|
9
10
|
import NativeUserLocation from './NativeUserLocation';
|
|
10
11
|
|
|
11
12
|
const mapboxBlue = 'rgba(51, 181, 229, 100)';
|
|
12
13
|
|
|
13
|
-
const layerStyles = {
|
|
14
|
+
const layerStyles: Record<'normal', Record<string, CircleLayerStyle>> = {
|
|
14
15
|
normal: {
|
|
15
|
-
|
|
16
|
+
pulse: {
|
|
16
17
|
circleRadius: 15,
|
|
17
18
|
circleColor: mapboxBlue,
|
|
18
19
|
circleOpacity: 0.2,
|
|
@@ -31,11 +32,14 @@ const layerStyles = {
|
|
|
31
32
|
},
|
|
32
33
|
};
|
|
33
34
|
|
|
34
|
-
|
|
35
|
+
const normalIcon = (
|
|
36
|
+
showsUserHeadingIndicator?: boolean,
|
|
37
|
+
heading?: number | null,
|
|
38
|
+
): ReactElement[] => [
|
|
35
39
|
<CircleLayer
|
|
36
|
-
key="
|
|
37
|
-
id="
|
|
38
|
-
style={layerStyles.normal.
|
|
40
|
+
key="mapboxUserLocationPulseCircle"
|
|
41
|
+
id="mapboxUserLocationPulseCircle"
|
|
42
|
+
style={layerStyles.normal.pulse}
|
|
39
43
|
/>,
|
|
40
44
|
<CircleLayer
|
|
41
45
|
key="mapboxUserLocationWhiteCircle"
|
|
@@ -43,93 +47,98 @@ export const normalIcon = (showsUserHeadingIndicator, heading) => [
|
|
|
43
47
|
style={layerStyles.normal.background}
|
|
44
48
|
/>,
|
|
45
49
|
<CircleLayer
|
|
46
|
-
key="
|
|
47
|
-
id="
|
|
50
|
+
key="mapboxUserLocationBlueCircle"
|
|
51
|
+
id="mapboxUserLocationBlueCircle"
|
|
48
52
|
aboveLayerID="mapboxUserLocationWhiteCircle"
|
|
49
53
|
style={layerStyles.normal.foreground}
|
|
50
54
|
/>,
|
|
51
|
-
...(showsUserHeadingIndicator && heading
|
|
52
|
-
? [HeadingIndicator({ heading })]
|
|
55
|
+
...(showsUserHeadingIndicator && typeof heading === 'number'
|
|
56
|
+
? [HeadingIndicator({ heading, key: 'mapboxUserLocationHeadingIndicator' })]
|
|
53
57
|
: []),
|
|
54
58
|
];
|
|
55
59
|
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
*/
|
|
115
|
-
children: PropTypes.any,
|
|
116
|
-
};
|
|
60
|
+
export enum UserLocationRenderMode {
|
|
61
|
+
Native = 'native',
|
|
62
|
+
Normal = 'normal',
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
type Props = {
|
|
66
|
+
/**
|
|
67
|
+
* native/android only render mode
|
|
68
|
+
*
|
|
69
|
+
* - normal: just a circle
|
|
70
|
+
* - compass: triangle with heading
|
|
71
|
+
* - gps: large arrow
|
|
72
|
+
*
|
|
73
|
+
* @platform android
|
|
74
|
+
*/
|
|
75
|
+
androidRenderMode?: 'normal' | 'compass' | 'gps';
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* Whether location icon is animated between updates
|
|
79
|
+
*/
|
|
80
|
+
animated?: boolean;
|
|
81
|
+
|
|
82
|
+
/**
|
|
83
|
+
* Custom location icon of type mapbox-gl-native components
|
|
84
|
+
*/
|
|
85
|
+
children?: ReactElement;
|
|
86
|
+
|
|
87
|
+
/**
|
|
88
|
+
* Minimum amount of movement before GPS location is updated in meters
|
|
89
|
+
*/
|
|
90
|
+
minDisplacement?: number;
|
|
91
|
+
|
|
92
|
+
/**
|
|
93
|
+
* Callback that is triggered on location icon press
|
|
94
|
+
*/
|
|
95
|
+
onPress?: () => void;
|
|
96
|
+
|
|
97
|
+
/**
|
|
98
|
+
* Callback that is triggered on location update
|
|
99
|
+
*/
|
|
100
|
+
onUpdate?: (location: Location) => void;
|
|
101
|
+
|
|
102
|
+
/**
|
|
103
|
+
* Which render mode to use.
|
|
104
|
+
*/
|
|
105
|
+
renderMode?: UserLocationRenderMode;
|
|
106
|
+
|
|
107
|
+
/**
|
|
108
|
+
* Request the always location permission, and listen to the location even when the app is in background
|
|
109
|
+
*
|
|
110
|
+
* @platform ios
|
|
111
|
+
*/
|
|
112
|
+
requestsAlwaysUse?: boolean;
|
|
113
|
+
|
|
114
|
+
/**
|
|
115
|
+
* Show or hide small arrow which indicates direction the device is pointing relative to north.
|
|
116
|
+
*/
|
|
117
|
+
showsUserHeadingIndicator?: boolean;
|
|
117
118
|
|
|
119
|
+
/**
|
|
120
|
+
* Whether location icon is visible
|
|
121
|
+
*/
|
|
122
|
+
visible?: boolean;
|
|
123
|
+
};
|
|
124
|
+
|
|
125
|
+
type UserLocationState = {
|
|
126
|
+
shouldShowUserLocation: false;
|
|
127
|
+
coordinates: number[] | null;
|
|
128
|
+
heading: number | null;
|
|
129
|
+
};
|
|
130
|
+
|
|
131
|
+
class UserLocation extends React.Component<Props, UserLocationState> {
|
|
118
132
|
static defaultProps = {
|
|
119
133
|
animated: true,
|
|
120
134
|
visible: true,
|
|
121
135
|
showsUserHeadingIndicator: false,
|
|
122
136
|
requestsAlwaysUse: false,
|
|
123
137
|
minDisplacement: 0,
|
|
124
|
-
renderMode:
|
|
125
|
-
};
|
|
126
|
-
|
|
127
|
-
static RenderMode = {
|
|
128
|
-
Native: 'native',
|
|
129
|
-
Normal: 'normal',
|
|
138
|
+
renderMode: UserLocationRenderMode.Normal,
|
|
130
139
|
};
|
|
131
140
|
|
|
132
|
-
constructor(props) {
|
|
141
|
+
constructor(props: Props) {
|
|
133
142
|
super(props);
|
|
134
143
|
|
|
135
144
|
this.state = {
|
|
@@ -143,34 +152,36 @@ class UserLocation extends React.Component {
|
|
|
143
152
|
|
|
144
153
|
// required as #setLocationManager attempts to setState
|
|
145
154
|
// after component unmount
|
|
146
|
-
_isMounted =
|
|
155
|
+
_isMounted?: boolean = undefined;
|
|
147
156
|
|
|
148
|
-
locationManagerRunning = false;
|
|
157
|
+
locationManagerRunning?: boolean = false;
|
|
149
158
|
|
|
150
159
|
async componentDidMount() {
|
|
151
160
|
this._isMounted = true;
|
|
152
161
|
|
|
153
|
-
locationManager.setMinDisplacement(this.props.minDisplacement);
|
|
162
|
+
locationManager.setMinDisplacement(this.props.minDisplacement || 0);
|
|
154
163
|
|
|
155
164
|
await this.setLocationManager({
|
|
156
165
|
running: this.needsLocationManagerRunning(),
|
|
157
166
|
});
|
|
158
167
|
|
|
159
|
-
if (this.renderMode ===
|
|
168
|
+
if (this.props.renderMode === UserLocationRenderMode.Native) {
|
|
160
169
|
return;
|
|
161
170
|
}
|
|
162
171
|
}
|
|
163
172
|
|
|
164
|
-
async componentDidUpdate(prevProps) {
|
|
173
|
+
async componentDidUpdate(prevProps: Props) {
|
|
165
174
|
await this.setLocationManager({
|
|
166
175
|
running: this.needsLocationManagerRunning(),
|
|
167
176
|
});
|
|
168
177
|
|
|
169
178
|
if (this.props.minDisplacement !== prevProps.minDisplacement) {
|
|
170
|
-
locationManager.setMinDisplacement(this.props.minDisplacement);
|
|
179
|
+
locationManager.setMinDisplacement(this.props.minDisplacement || 0);
|
|
171
180
|
}
|
|
172
181
|
if (this.props.requestsAlwaysUse !== prevProps.requestsAlwaysUse) {
|
|
173
|
-
locationManager.setRequestsAlwaysUse(
|
|
182
|
+
locationManager.setRequestsAlwaysUse(
|
|
183
|
+
this.props.requestsAlwaysUse || false,
|
|
184
|
+
);
|
|
174
185
|
}
|
|
175
186
|
}
|
|
176
187
|
|
|
@@ -189,7 +200,7 @@ class UserLocation extends React.Component {
|
|
|
189
200
|
* @param {Object} running - Object with key `running` and `boolean` value
|
|
190
201
|
* @return {Promise<void>}
|
|
191
202
|
*/
|
|
192
|
-
async setLocationManager({ running }) {
|
|
203
|
+
async setLocationManager({ running }: { running?: boolean }) {
|
|
193
204
|
if (this.locationManagerRunning !== running) {
|
|
194
205
|
this.locationManagerRunning = running;
|
|
195
206
|
if (running) {
|
|
@@ -211,12 +222,12 @@ class UserLocation extends React.Component {
|
|
|
211
222
|
needsLocationManagerRunning() {
|
|
212
223
|
return (
|
|
213
224
|
!!this.props.onUpdate ||
|
|
214
|
-
(this.props.renderMode ===
|
|
225
|
+
(this.props.renderMode === UserLocationRenderMode.Normal &&
|
|
215
226
|
this.props.visible)
|
|
216
227
|
);
|
|
217
228
|
}
|
|
218
229
|
|
|
219
|
-
_onLocationUpdate(location) {
|
|
230
|
+
_onLocationUpdate(location: Location | null) {
|
|
220
231
|
if (!this._isMounted || !location) {
|
|
221
232
|
return;
|
|
222
233
|
}
|
|
@@ -231,7 +242,7 @@ class UserLocation extends React.Component {
|
|
|
231
242
|
|
|
232
243
|
this.setState({
|
|
233
244
|
coordinates,
|
|
234
|
-
heading,
|
|
245
|
+
heading: heading ?? null,
|
|
235
246
|
});
|
|
236
247
|
|
|
237
248
|
if (this.props.onUpdate) {
|
|
@@ -242,7 +253,7 @@ class UserLocation extends React.Component {
|
|
|
242
253
|
_renderNative() {
|
|
243
254
|
const { androidRenderMode, showsUserHeadingIndicator } = this.props;
|
|
244
255
|
|
|
245
|
-
|
|
256
|
+
const props = {
|
|
246
257
|
androidRenderMode,
|
|
247
258
|
iosShowsUserHeadingIndicator: showsUserHeadingIndicator,
|
|
248
259
|
};
|
|
@@ -258,7 +269,7 @@ class UserLocation extends React.Component {
|
|
|
258
269
|
return null;
|
|
259
270
|
}
|
|
260
271
|
|
|
261
|
-
if (this.props.renderMode ===
|
|
272
|
+
if (this.props.renderMode === UserLocationRenderMode.Native) {
|
|
262
273
|
return this._renderNative();
|
|
263
274
|
}
|
|
264
275
|
|
|
@@ -268,8 +279,8 @@ class UserLocation extends React.Component {
|
|
|
268
279
|
|
|
269
280
|
return (
|
|
270
281
|
<Annotation
|
|
271
|
-
animated={animated}
|
|
272
282
|
id="mapboxUserLocation"
|
|
283
|
+
animated={animated}
|
|
273
284
|
onPress={onPress}
|
|
274
285
|
coordinates={coordinates}
|
|
275
286
|
style={{
|
|
@@ -24,6 +24,11 @@ interface Props {
|
|
|
24
24
|
*/
|
|
25
25
|
id: string;
|
|
26
26
|
|
|
27
|
+
/**
|
|
28
|
+
* The id refers to en existing source in the style. Does not create a new source.
|
|
29
|
+
*/
|
|
30
|
+
existing?: boolean;
|
|
31
|
+
|
|
27
32
|
/**
|
|
28
33
|
* A URL to a TileJSON configuration file describing the source’s contents and other metadata.
|
|
29
34
|
*/
|
|
@@ -85,7 +90,7 @@ interface Props {
|
|
|
85
90
|
height: number;
|
|
86
91
|
};
|
|
87
92
|
|
|
88
|
-
children
|
|
93
|
+
children?: React.ReactElement | React.ReactElement[];
|
|
89
94
|
}
|
|
90
95
|
|
|
91
96
|
//interface NativeProps extends Omit<Props, 'children'> {}
|
|
@@ -6,8 +6,12 @@ import {
|
|
|
6
6
|
|
|
7
7
|
import { isUndefined, isFunction, isAndroid } from '../../utils';
|
|
8
8
|
|
|
9
|
+
export {
|
|
10
|
+
default as OfflineCreatePackOptions,
|
|
11
|
+
type OfflineCreatePackOptionsArgs,
|
|
12
|
+
} from './OfflineCreatePackOptions';
|
|
9
13
|
import OfflineCreatePackOptions, {
|
|
10
|
-
OfflineCreatePackOptionsArgs,
|
|
14
|
+
type OfflineCreatePackOptionsArgs,
|
|
11
15
|
} from './OfflineCreatePackOptions';
|
|
12
16
|
import OfflinePack from './OfflinePack';
|
|
13
17
|
|