@rnmapbox/maps 10.0.0-beta.49 → 10.0.0-beta.53
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/android/.gitignore +9 -0
- package/android/.npmignore +9 -0
- package/android/rctmgl/.gitignore +1 -0
- package/android/rctmgl/.npmignore +1 -0
- package/android/rctmgl/src/main/java-mapboxgl/common/com/mapbox/rctmgl/modules/RCTMGLModule.java +2 -1
- package/android/rctmgl/src/main/java-v10/com/mapbox/rctmgl/modules/RCTMGLModule.kt +3 -1
- package/index.d.ts +1 -1
- package/ios/RCTMGL/MGLModule.m +2 -1
- package/ios/RCTMGL-v10/MGLModule.m +3 -1
- package/ios/RCTMGL-v10/MGLModule.swift +15 -2
- package/javascript/components/AbstractLayer.tsx +2 -1
- package/javascript/components/Camera.tsx +1 -2
- package/javascript/index.js +2 -2
- package/javascript/requestAndroidLocationPermissions.ts +1 -2
- package/javascript/utils/{MapboxStyles.ts → MapboxStyles.d.ts} +0 -0
- package/javascript/utils/StyleValue.ts +3 -8
- package/lib/commonjs/classes/AnimatedCoordinatesArray.js +165 -0
- package/lib/commonjs/classes/AnimatedCoordinatesArray.js.map +1 -0
- package/lib/commonjs/classes/AnimatedExtractCoordinateFromArray.js +44 -0
- package/lib/commonjs/classes/AnimatedExtractCoordinateFromArray.js.map +1 -0
- package/lib/commonjs/classes/AnimatedPoint.js +117 -0
- package/lib/commonjs/classes/AnimatedPoint.js.map +1 -0
- package/lib/commonjs/classes/AnimatedRouteCoordinatesArray.js +155 -0
- package/lib/commonjs/classes/AnimatedRouteCoordinatesArray.js.map +1 -0
- package/lib/commonjs/classes/AnimatedShape.js +78 -0
- package/lib/commonjs/classes/AnimatedShape.js.map +1 -0
- package/lib/commonjs/classes/index.d.js +17 -0
- package/lib/commonjs/classes/index.d.js.map +1 -0
- package/lib/commonjs/classes/index.js +61 -0
- package/lib/commonjs/classes/index.js.map +1 -0
- package/lib/commonjs/components/AbstractLayer.js +61 -0
- package/lib/commonjs/components/AbstractLayer.js.map +1 -0
- package/lib/commonjs/components/AbstractSource.js +26 -0
- package/lib/commonjs/components/AbstractSource.js.map +1 -0
- package/lib/commonjs/components/Atmosphere.js +26 -0
- package/lib/commonjs/components/Atmosphere.js.map +1 -0
- package/lib/commonjs/components/BackgroundLayer.js +82 -0
- package/lib/commonjs/components/BackgroundLayer.js.map +1 -0
- package/lib/commonjs/components/Callout.js +119 -0
- package/lib/commonjs/components/Callout.js.map +1 -0
- package/lib/commonjs/components/Camera.js +336 -0
- package/lib/commonjs/components/Camera.js.map +1 -0
- package/lib/commonjs/components/CircleLayer.js +87 -0
- package/lib/commonjs/components/CircleLayer.js.map +1 -0
- package/lib/commonjs/components/FillExtrusionLayer.js +89 -0
- package/lib/commonjs/components/FillExtrusionLayer.js.map +1 -0
- package/lib/commonjs/components/FillLayer.js +89 -0
- package/lib/commonjs/components/FillLayer.js.map +1 -0
- package/lib/commonjs/components/HeadingIndicator.js +33 -0
- package/lib/commonjs/components/HeadingIndicator.js.map +1 -0
- package/lib/commonjs/components/HeatmapLayer.js +90 -0
- package/lib/commonjs/components/HeatmapLayer.js.map +1 -0
- package/lib/commonjs/components/ImageSource.js +66 -0
- package/lib/commonjs/components/ImageSource.js.map +1 -0
- package/lib/commonjs/components/Images.js +98 -0
- package/lib/commonjs/components/Images.js.map +1 -0
- package/lib/commonjs/components/Light.js +51 -0
- package/lib/commonjs/components/Light.js.map +1 -0
- package/lib/commonjs/components/LineLayer.js +89 -0
- package/lib/commonjs/components/LineLayer.js.map +1 -0
- package/lib/commonjs/components/MapView.js +740 -0
- package/lib/commonjs/components/MapView.js.map +1 -0
- package/lib/commonjs/components/MarkerView.js +102 -0
- package/lib/commonjs/components/MarkerView.js.map +1 -0
- package/lib/commonjs/components/NativeBridgeComponent.js +85 -0
- package/lib/commonjs/components/NativeBridgeComponent.js.map +1 -0
- package/lib/commonjs/components/NativeUserLocation.js +41 -0
- package/lib/commonjs/components/NativeUserLocation.js.map +1 -0
- package/lib/commonjs/components/PointAnnotation.js +121 -0
- package/lib/commonjs/components/PointAnnotation.js.map +1 -0
- package/lib/commonjs/components/RasterDemSource.js +95 -0
- package/lib/commonjs/components/RasterDemSource.js.map +1 -0
- package/lib/commonjs/components/RasterLayer.js +85 -0
- package/lib/commonjs/components/RasterLayer.js.map +1 -0
- package/lib/commonjs/components/RasterSource.js +112 -0
- package/lib/commonjs/components/RasterSource.js.map +1 -0
- package/lib/commonjs/components/ShapeSource.js +193 -0
- package/lib/commonjs/components/ShapeSource.js.map +1 -0
- package/lib/commonjs/components/SkyLayer.js +73 -0
- package/lib/commonjs/components/SkyLayer.js.map +1 -0
- package/lib/commonjs/components/Style.js +269 -0
- package/lib/commonjs/components/Style.js.map +1 -0
- package/lib/commonjs/components/SymbolLayer.js +49 -0
- package/lib/commonjs/components/SymbolLayer.js.map +1 -0
- package/lib/commonjs/components/Terrain.js +37 -0
- package/lib/commonjs/components/Terrain.js.map +1 -0
- package/lib/commonjs/components/UserLocation.js +255 -0
- package/lib/commonjs/components/UserLocation.js.map +1 -0
- package/lib/commonjs/components/VectorSource.js +175 -0
- package/lib/commonjs/components/VectorSource.js.map +1 -0
- package/lib/commonjs/components/annotations/Annotation.js +105 -0
- package/lib/commonjs/components/annotations/Annotation.js.map +1 -0
- package/lib/commonjs/global.d.js +2 -0
- package/lib/commonjs/global.d.js.map +1 -0
- package/lib/commonjs/index.js +331 -0
- package/lib/commonjs/index.js.map +1 -0
- package/lib/commonjs/index.web.js +27 -0
- package/lib/commonjs/index.web.js.map +1 -0
- package/lib/commonjs/modules/location/locationManager.js +85 -0
- package/lib/commonjs/modules/location/locationManager.js.map +1 -0
- package/lib/commonjs/modules/offline/OfflineCreatePackOptions.js +45 -0
- package/lib/commonjs/modules/offline/OfflineCreatePackOptions.js.map +1 -0
- package/lib/commonjs/modules/offline/OfflinePack.js +41 -0
- package/lib/commonjs/modules/offline/OfflinePack.js.map +1 -0
- package/lib/commonjs/modules/offline/offlineManager.js +356 -0
- package/lib/commonjs/modules/offline/offlineManager.js.map +1 -0
- package/lib/commonjs/modules/snapshot/SnapshotOptions.js +60 -0
- package/lib/commonjs/modules/snapshot/SnapshotOptions.js.map +1 -0
- package/lib/commonjs/modules/snapshot/snapshotManager.js +68 -0
- package/lib/commonjs/modules/snapshot/snapshotManager.js.map +1 -0
- package/lib/commonjs/requestAndroidLocationPermissions.js +25 -0
- package/lib/commonjs/requestAndroidLocationPermissions.js.map +1 -0
- package/lib/commonjs/types/index.js +6 -0
- package/lib/commonjs/types/index.js.map +1 -0
- package/lib/commonjs/utils/BridgeValue.js +66 -0
- package/lib/commonjs/utils/BridgeValue.js.map +1 -0
- package/lib/commonjs/utils/Logger.js +119 -0
- package/lib/commonjs/utils/Logger.js.map +1 -0
- package/lib/commonjs/utils/MapboxStyles.d.js +183 -0
- package/lib/commonjs/utils/MapboxStyles.d.js.map +1 -0
- package/lib/commonjs/utils/StyleValue.js +41 -0
- package/lib/commonjs/utils/StyleValue.js.map +1 -0
- package/lib/commonjs/utils/animated/Animated.js +33 -0
- package/lib/commonjs/utils/animated/Animated.js.map +1 -0
- package/lib/commonjs/utils/deprecation.js +40 -0
- package/lib/commonjs/utils/deprecation.js.map +1 -0
- package/lib/commonjs/utils/filterUtils.js +13 -0
- package/lib/commonjs/utils/filterUtils.js.map +1 -0
- package/lib/commonjs/utils/geoUtils.d.js +2 -0
- package/lib/commonjs/utils/geoUtils.d.js.map +1 -0
- package/lib/commonjs/utils/geoUtils.js +65 -0
- package/lib/commonjs/utils/geoUtils.js.map +1 -0
- package/lib/commonjs/utils/index.d.js +2 -0
- package/lib/commonjs/utils/index.d.js.map +1 -0
- package/lib/commonjs/utils/index.js +122 -0
- package/lib/commonjs/utils/index.js.map +1 -0
- package/lib/commonjs/utils/styleMap.js +1530 -0
- package/lib/commonjs/utils/styleMap.js.map +1 -0
- package/lib/commonjs/web/MapContext.js +12 -0
- package/lib/commonjs/web/MapContext.js.map +1 -0
- package/lib/commonjs/web/MapboxModule.js +21 -0
- package/lib/commonjs/web/MapboxModule.js.map +1 -0
- package/lib/commonjs/web/UnimplementedComponent.js +16 -0
- package/lib/commonjs/web/UnimplementedComponent.js.map +1 -0
- package/lib/commonjs/web/components/Camera.js +48 -0
- package/lib/commonjs/web/components/Camera.js.map +1 -0
- package/lib/commonjs/web/components/MapView.js +67 -0
- package/lib/commonjs/web/components/MapView.js.map +1 -0
- package/lib/commonjs/web/index.js +41 -0
- package/lib/commonjs/web/index.js.map +1 -0
- package/lib/commonjs/web/utils/Logger.js +100 -0
- package/lib/commonjs/web/utils/Logger.js.map +1 -0
- package/lib/module/classes/AnimatedCoordinatesArray.js +158 -0
- package/lib/module/classes/AnimatedCoordinatesArray.js.map +1 -0
- package/lib/module/classes/AnimatedExtractCoordinateFromArray.js +37 -0
- package/lib/module/classes/AnimatedExtractCoordinateFromArray.js.map +1 -0
- package/lib/module/classes/AnimatedPoint.js +110 -0
- package/lib/module/classes/AnimatedPoint.js.map +1 -0
- package/lib/module/classes/AnimatedRouteCoordinatesArray.js +148 -0
- package/lib/module/classes/AnimatedRouteCoordinatesArray.js.map +1 -0
- package/lib/module/classes/AnimatedShape.js +71 -0
- package/lib/module/classes/AnimatedShape.js.map +1 -0
- package/lib/module/classes/index.d.js +6 -0
- package/lib/module/classes/index.d.js.map +1 -0
- package/lib/module/classes/index.js +6 -0
- package/lib/module/classes/index.js.map +1 -0
- package/lib/module/components/AbstractLayer.js +54 -0
- package/lib/module/components/AbstractLayer.js.map +1 -0
- package/lib/module/components/AbstractSource.js +18 -0
- package/lib/module/components/AbstractSource.js.map +1 -0
- package/lib/module/components/Atmosphere.js +16 -0
- package/lib/module/components/Atmosphere.js.map +1 -0
- package/lib/module/components/BackgroundLayer.js +73 -0
- package/lib/module/components/BackgroundLayer.js.map +1 -0
- package/lib/module/components/Callout.js +110 -0
- package/lib/module/components/Callout.js.map +1 -0
- package/lib/module/components/Camera.js +326 -0
- package/lib/module/components/Camera.js.map +1 -0
- package/lib/module/components/CircleLayer.js +78 -0
- package/lib/module/components/CircleLayer.js.map +1 -0
- package/lib/module/components/FillExtrusionLayer.js +80 -0
- package/lib/module/components/FillExtrusionLayer.js.map +1 -0
- package/lib/module/components/FillLayer.js +80 -0
- package/lib/module/components/FillLayer.js.map +1 -0
- package/lib/module/components/HeadingIndicator.js +25 -0
- package/lib/module/components/HeadingIndicator.js.map +1 -0
- package/lib/module/components/HeatmapLayer.js +81 -0
- package/lib/module/components/HeatmapLayer.js.map +1 -0
- package/lib/module/components/ImageSource.js +57 -0
- package/lib/module/components/ImageSource.js.map +1 -0
- package/lib/module/components/Images.js +89 -0
- package/lib/module/components/Images.js.map +1 -0
- package/lib/module/components/Light.js +42 -0
- package/lib/module/components/Light.js.map +1 -0
- package/lib/module/components/LineLayer.js +80 -0
- package/lib/module/components/LineLayer.js.map +1 -0
- package/lib/module/components/MapView.js +730 -0
- package/lib/module/components/MapView.js.map +1 -0
- package/lib/module/components/MarkerView.js +93 -0
- package/lib/module/components/MarkerView.js.map +1 -0
- package/lib/module/components/NativeBridgeComponent.js +78 -0
- package/lib/module/components/NativeBridgeComponent.js.map +1 -0
- package/lib/module/components/NativeUserLocation.js +33 -0
- package/lib/module/components/NativeUserLocation.js.map +1 -0
- package/lib/module/components/PointAnnotation.js +112 -0
- package/lib/module/components/PointAnnotation.js.map +1 -0
- package/lib/module/components/RasterDemSource.js +86 -0
- package/lib/module/components/RasterDemSource.js.map +1 -0
- package/lib/module/components/RasterLayer.js +76 -0
- package/lib/module/components/RasterLayer.js.map +1 -0
- package/lib/module/components/RasterSource.js +103 -0
- package/lib/module/components/RasterSource.js.map +1 -0
- package/lib/module/components/ShapeSource.js +184 -0
- package/lib/module/components/ShapeSource.js.map +1 -0
- package/lib/module/components/SkyLayer.js +64 -0
- package/lib/module/components/SkyLayer.js.map +1 -0
- package/lib/module/components/Style.js +259 -0
- package/lib/module/components/Style.js.map +1 -0
- package/lib/module/components/SymbolLayer.js +40 -0
- package/lib/module/components/SymbolLayer.js.map +1 -0
- package/lib/module/components/Terrain.js +27 -0
- package/lib/module/components/Terrain.js.map +1 -0
- package/lib/module/components/UserLocation.js +246 -0
- package/lib/module/components/UserLocation.js.map +1 -0
- package/lib/module/components/VectorSource.js +166 -0
- package/lib/module/components/VectorSource.js.map +1 -0
- package/lib/module/components/annotations/Annotation.js +97 -0
- package/lib/module/components/annotations/Annotation.js.map +1 -0
- package/lib/module/global.d.js +2 -0
- package/lib/module/global.d.js.map +1 -0
- package/lib/module/index.js +105 -0
- package/lib/module/index.js.map +1 -0
- package/lib/module/index.web.js +3 -0
- package/lib/module/index.web.js.map +1 -0
- package/lib/module/modules/location/locationManager.js +77 -0
- package/lib/module/modules/location/locationManager.js.map +1 -0
- package/lib/module/modules/offline/OfflineCreatePackOptions.js +38 -0
- package/lib/module/modules/offline/OfflineCreatePackOptions.js.map +1 -0
- package/lib/module/modules/offline/OfflinePack.js +34 -0
- package/lib/module/modules/offline/OfflinePack.js.map +1 -0
- package/lib/module/modules/offline/offlineManager.js +347 -0
- package/lib/module/modules/offline/offlineManager.js.map +1 -0
- package/lib/module/modules/snapshot/SnapshotOptions.js +53 -0
- package/lib/module/modules/snapshot/SnapshotOptions.js.map +1 -0
- package/lib/module/modules/snapshot/snapshotManager.js +60 -0
- package/lib/module/modules/snapshot/snapshotManager.js.map +1 -0
- package/lib/module/requestAndroidLocationPermissions.js +19 -0
- package/lib/module/requestAndroidLocationPermissions.js.map +1 -0
- package/lib/module/types/index.js +2 -0
- package/lib/module/types/index.js.map +1 -0
- package/lib/module/utils/BridgeValue.js +59 -0
- package/lib/module/utils/BridgeValue.js.map +1 -0
- package/lib/module/utils/Logger.js +112 -0
- package/lib/module/utils/Logger.js.map +1 -0
- package/lib/module/utils/MapboxStyles.d.js +179 -0
- package/lib/module/utils/MapboxStyles.d.js.map +1 -0
- package/lib/module/utils/StyleValue.js +34 -0
- package/lib/module/utils/StyleValue.js.map +1 -0
- package/lib/module/utils/animated/Animated.js +25 -0
- package/lib/module/utils/animated/Animated.js.map +1 -0
- package/lib/module/utils/deprecation.js +33 -0
- package/lib/module/utils/deprecation.js.map +1 -0
- package/lib/module/utils/filterUtils.js +7 -0
- package/lib/module/utils/filterUtils.js.map +1 -0
- package/lib/module/utils/geoUtils.d.js +2 -0
- package/lib/module/utils/geoUtils.d.js.map +1 -0
- package/lib/module/utils/geoUtils.js +50 -0
- package/lib/module/utils/geoUtils.js.map +1 -0
- package/lib/module/utils/index.d.js +2 -0
- package/lib/module/utils/index.d.js.map +1 -0
- package/lib/module/utils/index.js +99 -0
- package/lib/module/utils/index.js.map +1 -0
- package/lib/module/utils/styleMap.js +1505 -0
- package/lib/module/utils/styleMap.js.map +1 -0
- package/lib/module/web/MapContext.js +4 -0
- package/lib/module/web/MapContext.js.map +1 -0
- package/lib/module/web/MapboxModule.js +13 -0
- package/lib/module/web/MapboxModule.js.map +1 -0
- package/lib/module/web/UnimplementedComponent.js +8 -0
- package/lib/module/web/UnimplementedComponent.js.map +1 -0
- package/lib/module/web/components/Camera.js +40 -0
- package/lib/module/web/components/Camera.js.map +1 -0
- package/lib/module/web/components/MapView.js +60 -0
- package/lib/module/web/components/MapView.js.map +1 -0
- package/lib/module/web/index.js +16 -0
- package/lib/module/web/index.js.map +1 -0
- package/lib/module/web/utils/Logger.js +93 -0
- package/lib/module/web/utils/Logger.js.map +1 -0
- package/lib/typescript/components/AbstractLayer.d.ts +28 -0
- package/lib/typescript/components/AbstractLayer.d.ts.map +1 -0
- package/lib/typescript/components/AbstractSource.d.ts +9 -0
- package/lib/typescript/components/AbstractSource.d.ts.map +1 -0
- package/lib/typescript/components/Atmosphere.d.ts +9 -0
- package/lib/typescript/components/Atmosphere.d.ts.map +1 -0
- package/lib/typescript/components/Camera.d.ts +119 -0
- package/lib/typescript/components/Camera.d.ts.map +1 -0
- package/lib/typescript/components/HeadingIndicator.d.ts +7 -0
- package/lib/typescript/components/HeadingIndicator.d.ts.map +1 -0
- package/lib/typescript/components/MarkerView.d.ts +52 -0
- package/lib/typescript/components/MarkerView.d.ts.map +1 -0
- package/lib/typescript/components/NativeBridgeComponent.d.ts +50 -0
- package/lib/typescript/components/NativeBridgeComponent.d.ts.map +1 -0
- package/lib/typescript/components/PointAnnotation.d.ts +162 -0
- package/lib/typescript/components/PointAnnotation.d.ts.map +1 -0
- package/lib/typescript/components/ShapeSource.d.ts +222 -0
- package/lib/typescript/components/ShapeSource.d.ts.map +1 -0
- package/lib/typescript/components/SymbolLayer.d.ts +65 -0
- package/lib/typescript/components/SymbolLayer.d.ts.map +1 -0
- package/lib/typescript/components/Terrain.d.ts +20 -0
- package/lib/typescript/components/Terrain.d.ts.map +1 -0
- package/lib/typescript/requestAndroidLocationPermissions.d.ts +2 -0
- package/lib/typescript/requestAndroidLocationPermissions.d.ts.map +1 -0
- package/lib/typescript/types/index.d.ts +16 -0
- package/lib/typescript/types/index.d.ts.map +1 -0
- package/lib/typescript/utils/BridgeValue.d.ts +46 -0
- package/lib/typescript/utils/BridgeValue.d.ts.map +1 -0
- package/lib/typescript/utils/StyleValue.d.ts +10 -0
- package/lib/typescript/utils/StyleValue.d.ts.map +1 -0
- package/lib/typescript/utils/deprecation.d.ts +12 -0
- package/lib/typescript/utils/deprecation.d.ts.map +1 -0
- package/lib/typescript/utils/filterUtils.d.ts +2 -0
- package/lib/typescript/utils/filterUtils.d.ts.map +1 -0
- package/lib/typescript/utils/styleMap.d.ts +1489 -0
- package/lib/typescript/utils/styleMap.d.ts.map +1 -0
- package/lib/typescript/web/MapContext.d.ts +7 -0
- package/lib/typescript/web/MapContext.d.ts.map +1 -0
- package/lib/typescript/web/components/Camera.d.ts +18 -0
- package/lib/typescript/web/components/Camera.d.ts.map +1 -0
- package/lib/typescript/web/components/MapView.d.ts +20 -0
- package/lib/typescript/web/components/MapView.d.ts.map +1 -0
- package/lib/typescript/web/utils/Logger.d.ts +48 -0
- package/lib/typescript/web/utils/Logger.d.ts.map +1 -0
- package/package.json +38 -6
- package/plugin/jest.config.js +1 -0
- package/plugin/src/withMapbox.ts +365 -0
- package/plugin/tsconfig.json +9 -0
- package/.eslintrc.js +0 -111
- package/.gitattributes +0 -1
- package/.github/ISSUE_TEMPLATE/bug_report.yml +0 -112
- package/.github/ISSUE_TEMPLATE/bug_setup.md +0 -23
- package/.github/ISSUE_TEMPLATE/feature.md +0 -15
- package/.github/dependabot.yml +0 -42
- package/.github/label-actions.yml +0 -26
- package/.github/pull_request_template.md +0 -27
- package/.github/stale.yml +0 -11
- package/.github/workflows/android-actions.yml +0 -56
- package/.github/workflows/bump-version.yml +0 -54
- package/.github/workflows/ios-actions.yml +0 -81
- package/.github/workflows/label-actions.yml +0 -17
- package/.github/workflows/on-push.yml +0 -131
- package/.github/workflows/publish.yml +0 -29
- package/.husky/pre-commit +0 -5
- package/.nvmrc +0 -2
- package/.prettierrc.js +0 -4
- package/.sonarcloud.properties +0 -15
- package/CONTRIBUTING.md +0 -30
- package/README-v10.md +0 -86
- package/RELEASE.md +0 -28
- package/app.plugin.js +0 -1
- package/babel.config.js +0 -9
- package/docs/Annotation.md +0 -39
- package/docs/Annotations.md +0 -20
- package/docs/Atmosphere.md +0 -265
- package/docs/BackgroundLayer.md +0 -166
- package/docs/Callout.md +0 -15
- package/docs/Camera.md +0 -152
- package/docs/CircleLayer.md +0 -470
- package/docs/CustomHttpHeaders.md +0 -89
- package/docs/FillExtrusionLayer.md +0 -346
- package/docs/FillLayer.md +0 -310
- package/docs/GettingStarted.md +0 -87
- package/docs/HeadingIndicator.md +0 -10
- package/docs/HeatmapLayer.md +0 -215
- package/docs/ImageSource.md +0 -13
- package/docs/Images.md +0 -12
- package/docs/Light.md +0 -159
- package/docs/LineLayer.md +0 -606
- package/docs/Logger.md +0 -22
- package/docs/MapView.md +0 -228
- package/docs/MapboxGL.md +0 -83
- package/docs/MarkerView.md +0 -26
- package/docs/NativeUserLocation.md +0 -11
- package/docs/OfflineManager.md +0 -264
- package/docs/PointAnnotation.md +0 -42
- package/docs/RasterDemSource.md +0 -15
- package/docs/RasterLayer.md +0 -357
- package/docs/RasterSource.md +0 -19
- package/docs/ShapeSource.md +0 -106
- package/docs/SkyLayer.md +0 -259
- package/docs/Style.md +0 -12
- package/docs/StyleSheet.md +0 -226
- package/docs/SymbolLayer.md +0 -1659
- package/docs/Terrain.md +0 -77
- package/docs/UserLocation.md +0 -39
- package/docs/VectorSource.md +0 -49
- package/docs/docs.json +0 -6571
- package/docs/snapshotManager.md +0 -55
- package/scripts/.eslintrc.js +0 -12
- package/scripts/autogenHelpers/DocJSONBuilder.js +0 -458
- package/scripts/autogenHelpers/JSDocNodeTree.js +0 -134
- package/scripts/autogenHelpers/MarkdownBuilder.js +0 -38
- package/scripts/autogenHelpers/globals.js +0 -518
- package/scripts/autogenerate.js +0 -545
- package/scripts/download-style-spec.sh +0 -15
- package/scripts/templates/MapboxStyles.ts.ejs +0 -97
- package/scripts/templates/RCTMGLStyle.h.ejs +0 -34
- package/scripts/templates/RCTMGLStyle.m.ejs +0 -106
- package/scripts/templates/RCTMGLStyle.swift.ejs +0 -116
- package/scripts/templates/RCTMGLStyleFactory.java.ejs +0 -108
- package/scripts/templates/RCTMGLStyleFactoryv10.java.ejs +0 -116
- package/scripts/templates/component.md.ejs +0 -122
- package/scripts/templates/index.d.ts.ejs +0 -56
- package/scripts/templates/styleMap.ts.ejs +0 -118
- package/setup-jest.js +0 -125
- package/style-spec/v8.json +0 -6727
- package/tsconfig.json +0 -24
|
@@ -0,0 +1,740 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = exports.NATIVE_MODULE_NAME = exports.ANDROID_TEXTURE_NATIVE_MODULE_NAME = void 0;
|
|
7
|
+
var _react = _interopRequireDefault(require("react"));
|
|
8
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
9
|
+
var _reactNative = require("react-native");
|
|
10
|
+
var _debounce = require("debounce");
|
|
11
|
+
var _geoUtils = require("../utils/geoUtils");
|
|
12
|
+
var _utils = require("../utils");
|
|
13
|
+
var _filterUtils = require("../utils/filterUtils");
|
|
14
|
+
var _Logger = _interopRequireDefault(require("../utils/Logger"));
|
|
15
|
+
var _NativeBridgeComponent = _interopRequireDefault(require("./NativeBridgeComponent"));
|
|
16
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
17
|
+
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
18
|
+
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
19
|
+
const MapboxGL = _reactNative.NativeModules.MGLModule;
|
|
20
|
+
if (MapboxGL == null) {
|
|
21
|
+
console.error('Native part of Mapbox React Native libraries were not registered properly, double check our native installation guides.');
|
|
22
|
+
}
|
|
23
|
+
const NATIVE_MODULE_NAME = 'RCTMGLMapView';
|
|
24
|
+
exports.NATIVE_MODULE_NAME = NATIVE_MODULE_NAME;
|
|
25
|
+
const ANDROID_TEXTURE_NATIVE_MODULE_NAME = 'RCTMGLAndroidTextureMapView';
|
|
26
|
+
exports.ANDROID_TEXTURE_NATIVE_MODULE_NAME = ANDROID_TEXTURE_NATIVE_MODULE_NAME;
|
|
27
|
+
const styles = _reactNative.StyleSheet.create({
|
|
28
|
+
matchParent: {
|
|
29
|
+
flex: 1
|
|
30
|
+
}
|
|
31
|
+
});
|
|
32
|
+
const defaultStyleURL = MapboxGL.StyleURL.Street;
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* MapView backed by Mapbox Native GL
|
|
36
|
+
*/
|
|
37
|
+
class MapView extends (0, _NativeBridgeComponent.default)(_react.default.Component, NATIVE_MODULE_NAME) {
|
|
38
|
+
constructor(props) {
|
|
39
|
+
super(props);
|
|
40
|
+
this.logger = _Logger.default.sharedInstance();
|
|
41
|
+
this.logger.start();
|
|
42
|
+
this.state = {
|
|
43
|
+
isReady: null,
|
|
44
|
+
region: null,
|
|
45
|
+
width: 0,
|
|
46
|
+
height: 0,
|
|
47
|
+
isUserInteraction: false
|
|
48
|
+
};
|
|
49
|
+
this._onPress = this._onPress.bind(this);
|
|
50
|
+
this._onLongPress = this._onLongPress.bind(this);
|
|
51
|
+
this._onChange = this._onChange.bind(this);
|
|
52
|
+
this._onLayout = this._onLayout.bind(this);
|
|
53
|
+
|
|
54
|
+
// debounced map change methods
|
|
55
|
+
this._onDebouncedRegionWillChange = (0, _debounce.debounce)(this._onRegionWillChange.bind(this), props.regionWillChangeDebounceTime, true);
|
|
56
|
+
this._onDebouncedRegionDidChange = (0, _debounce.debounce)(this._onRegionDidChange.bind(this), props.regionDidChangeDebounceTime);
|
|
57
|
+
}
|
|
58
|
+
componentDidMount() {
|
|
59
|
+
this._setHandledMapChangedEvents(this.props);
|
|
60
|
+
}
|
|
61
|
+
componentWillUnmount() {
|
|
62
|
+
this._onDebouncedRegionWillChange.clear();
|
|
63
|
+
this._onDebouncedRegionDidChange.clear();
|
|
64
|
+
this.logger.stop();
|
|
65
|
+
}
|
|
66
|
+
UNSAFE_componentWillReceiveProps(nextProps) {
|
|
67
|
+
this._setHandledMapChangedEvents(nextProps);
|
|
68
|
+
}
|
|
69
|
+
_setHandledMapChangedEvents(props) {
|
|
70
|
+
if ((0, _utils.isAndroid)() || MapboxGL.MapboxV10) {
|
|
71
|
+
const events = [];
|
|
72
|
+
function addIfHasHandler(name) {
|
|
73
|
+
if (props[`on${name}`] != null) {
|
|
74
|
+
if (MapboxGL.EventTypes[name] == null) {
|
|
75
|
+
console.warn(`rnmapbox maps: ${name} is not supported`);
|
|
76
|
+
} else {
|
|
77
|
+
events.push(MapboxGL.EventTypes[name]);
|
|
78
|
+
return true;
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
return false;
|
|
82
|
+
}
|
|
83
|
+
addIfHasHandler('RegionWillChange');
|
|
84
|
+
addIfHasHandler('RegionIsChanging');
|
|
85
|
+
addIfHasHandler('RegionDidChange');
|
|
86
|
+
addIfHasHandler('UserLocationUpdate');
|
|
87
|
+
addIfHasHandler('WillStartLoadingMap');
|
|
88
|
+
addIfHasHandler('DidFinishLoadingMap');
|
|
89
|
+
addIfHasHandler('DidFailLoadingMap');
|
|
90
|
+
addIfHasHandler('WillStartRenderingFrame');
|
|
91
|
+
addIfHasHandler('DidFinishRenderingFrame');
|
|
92
|
+
addIfHasHandler('DidFinishRenderingFrameFully');
|
|
93
|
+
addIfHasHandler('WillStartRenderingMap');
|
|
94
|
+
addIfHasHandler('DidFinishRenderingMap');
|
|
95
|
+
addIfHasHandler('DidFinishRenderingMapFully');
|
|
96
|
+
addIfHasHandler('DidFinishLoadingStyle');
|
|
97
|
+
if (addIfHasHandler('MapIdle')) {
|
|
98
|
+
console.warn('onMapIdle is deprecated and will be removed in next beta - please use onRegionDidChange');
|
|
99
|
+
if (props.onRegionDidChange) {
|
|
100
|
+
console.warn('rnmapbox/maps: only one of MapView.onRegionDidChange or onMapIdle is supported');
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
if (addIfHasHandler('CameraChanged')) {
|
|
104
|
+
console.warn('onCameraChanged is deprecated and will be removed in next beta - please use onRegionIsChanging');
|
|
105
|
+
if (props.onRegionIsChanging) {
|
|
106
|
+
console.warn('rnmapbox/maps: only one of MapView.onRegionIsChanging or onCameraChanged is supported');
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
if (props.onRegionWillChange) {
|
|
110
|
+
console.warn('onRegionWillChange is deprecated and will be removed in v10 - please use onRegionIsChanging');
|
|
111
|
+
}
|
|
112
|
+
this._runNativeCommand('setHandledMapChangedEvents', this._nativeRef, [events]);
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
/**
|
|
117
|
+
* Converts a geographic coordinate to a point in the given view’s coordinate system.
|
|
118
|
+
*
|
|
119
|
+
* @example
|
|
120
|
+
* const pointInView = await this._map.getPointInView([-37.817070, 144.949901]);
|
|
121
|
+
*
|
|
122
|
+
* @param {Array<Number>} coordinate - A point expressed in the map view's coordinate system.
|
|
123
|
+
* @return {Array}
|
|
124
|
+
*/
|
|
125
|
+
async getPointInView(coordinate) {
|
|
126
|
+
const res = await this._runNativeCommand('getPointInView', this._nativeRef, [coordinate]);
|
|
127
|
+
return res.pointInView;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
/**
|
|
131
|
+
* Converts a point in the given view’s coordinate system to a geographic coordinate.
|
|
132
|
+
*
|
|
133
|
+
* @example
|
|
134
|
+
* const coordinate = await this._map.getCoordinateFromView([100, 100]);
|
|
135
|
+
*
|
|
136
|
+
* @param {Array<Number>} point - A point expressed in the given view’s coordinate system.
|
|
137
|
+
* @return {Array}
|
|
138
|
+
*/
|
|
139
|
+
async getCoordinateFromView(point) {
|
|
140
|
+
const res = await this._runNativeCommand('getCoordinateFromView', this._nativeRef, [point]);
|
|
141
|
+
return res.coordinateFromView;
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
/**
|
|
145
|
+
* The coordinate bounds (ne, sw) visible in the user’s viewport.
|
|
146
|
+
*
|
|
147
|
+
* @example
|
|
148
|
+
* const visibleBounds = await this._map.getVisibleBounds();
|
|
149
|
+
*
|
|
150
|
+
* @return {Array}
|
|
151
|
+
*/
|
|
152
|
+
async getVisibleBounds() {
|
|
153
|
+
const res = await this._runNativeCommand('getVisibleBounds', this._nativeRef);
|
|
154
|
+
return res.visibleBounds;
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
/**
|
|
158
|
+
* Returns an array of rendered map features that intersect with a given point.
|
|
159
|
+
*
|
|
160
|
+
* @example
|
|
161
|
+
* this._map.queryRenderedFeaturesAtPoint([30, 40], ['==', 'type', 'Point'], ['id1', 'id2'])
|
|
162
|
+
*
|
|
163
|
+
* @param {Array<Number>} coordinate - A point expressed in the map view’s coordinate system.
|
|
164
|
+
* @param {Array=} filter - 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.
|
|
165
|
+
* @param {Array=} layerIDs - A array of layer id's to filter the features by
|
|
166
|
+
* @return {FeatureCollection}
|
|
167
|
+
*/
|
|
168
|
+
async queryRenderedFeaturesAtPoint(coordinate) {
|
|
169
|
+
let filter = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
|
|
170
|
+
let layerIDs = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [];
|
|
171
|
+
if (!coordinate || coordinate.length < 2) {
|
|
172
|
+
throw new Error('Must pass in valid coordinate[lng, lat]');
|
|
173
|
+
}
|
|
174
|
+
const res = await this._runNativeCommand('queryRenderedFeaturesAtPoint', this._nativeRef, [coordinate, (0, _filterUtils.getFilter)(filter), layerIDs]);
|
|
175
|
+
if ((0, _utils.isAndroid)()) {
|
|
176
|
+
return JSON.parse(res.data);
|
|
177
|
+
}
|
|
178
|
+
return res.data;
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
/**
|
|
182
|
+
* Returns an array of rendered map features that intersect with the given rectangle,
|
|
183
|
+
* restricted to the given style layers and filtered by the given predicate. In v10,
|
|
184
|
+
* passing an empty array will query the entire visible bounds of the map.
|
|
185
|
+
*
|
|
186
|
+
* @example
|
|
187
|
+
* this._map.queryRenderedFeaturesInRect([30, 40, 20, 10], ['==', 'type', 'Point'], ['id1', 'id2'])
|
|
188
|
+
*
|
|
189
|
+
* @param {Array<Number>} bbox - A rectangle expressed in the map view’s coordinate system. For v10, this can be an empty array to query the visible map area.
|
|
190
|
+
* @param {Array=} filter - 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.
|
|
191
|
+
* @param {Array=} layerIDs - A array of layer id's to filter the features by
|
|
192
|
+
* @return {FeatureCollection}
|
|
193
|
+
*/
|
|
194
|
+
async queryRenderedFeaturesInRect(bbox) {
|
|
195
|
+
let filter = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
|
|
196
|
+
let layerIDs = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [];
|
|
197
|
+
if (bbox != null && (bbox.length === 4 || MapboxGL.MapboxV10 && bbox.length === 0)) {
|
|
198
|
+
const res = await this._runNativeCommand('queryRenderedFeaturesInRect', this._nativeRef, [bbox, (0, _filterUtils.getFilter)(filter), layerIDs]);
|
|
199
|
+
if ((0, _utils.isAndroid)()) {
|
|
200
|
+
return JSON.parse(res.data);
|
|
201
|
+
}
|
|
202
|
+
return res.data;
|
|
203
|
+
} else {
|
|
204
|
+
throw new Error('Must pass in a valid bounding box: [top, right, bottom, left]. An empty array [] is also acceptable in v10.');
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
/**
|
|
209
|
+
* Map camera will perform updates based on provided config. Deprecated use Camera#setCamera.
|
|
210
|
+
*/
|
|
211
|
+
setCamera() {
|
|
212
|
+
console.warn('MapView.setCamera is deprecated - please use Camera#setCamera');
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
/**
|
|
216
|
+
* Takes snapshot of map with current tiles and returns a URI to the image
|
|
217
|
+
* @param {Boolean} writeToDisk If true will create a temp file, otherwise it is in base64
|
|
218
|
+
* @return {String}
|
|
219
|
+
*/
|
|
220
|
+
async takeSnap() {
|
|
221
|
+
let writeToDisk = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
|
|
222
|
+
const res = await this._runNativeCommand('takeSnap', this._nativeRef, [writeToDisk]);
|
|
223
|
+
return res.uri;
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
/**
|
|
227
|
+
* Returns the current zoom of the map view.
|
|
228
|
+
*
|
|
229
|
+
* @example
|
|
230
|
+
* const zoom = await this._map.getZoom();
|
|
231
|
+
*
|
|
232
|
+
* @return {Number}
|
|
233
|
+
*/
|
|
234
|
+
|
|
235
|
+
async getZoom() {
|
|
236
|
+
const res = await this._runNativeCommand('getZoom', this._nativeRef);
|
|
237
|
+
return res.zoom;
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
/**
|
|
241
|
+
* Returns the map's geographical centerpoint
|
|
242
|
+
*
|
|
243
|
+
* @example
|
|
244
|
+
* const center = await this._map.getCenter();
|
|
245
|
+
*
|
|
246
|
+
* @return {Array<Number>} Coordinates
|
|
247
|
+
*/
|
|
248
|
+
async getCenter() {
|
|
249
|
+
const res = await this._runNativeCommand('getCenter', this._nativeRef);
|
|
250
|
+
return res.center;
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
/**
|
|
254
|
+
* Queries the currently loaded data for elevation at a geographical location.
|
|
255
|
+
* The elevation is returned in meters relative to mean sea-level.
|
|
256
|
+
* Returns null if terrain is disabled or if terrain data for the location hasn't been loaded yet.
|
|
257
|
+
*
|
|
258
|
+
* @param {Array<Number>} coordinate - the coordinates to query elevation at
|
|
259
|
+
* @return {Number}
|
|
260
|
+
*/
|
|
261
|
+
async queryTerrainElevation(coordinate) {
|
|
262
|
+
const res = await this._runNativeCommand('queryTerrainElevation', this._nativeRef, [coordinate]);
|
|
263
|
+
return res.data;
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
/**
|
|
267
|
+
* Sets the visibility of all the layers referencing the specified `sourceLayerId` and/or `sourceId`
|
|
268
|
+
*
|
|
269
|
+
* @example
|
|
270
|
+
* await this._map.setSourceVisibility(false, 'composite', 'building')
|
|
271
|
+
*
|
|
272
|
+
* @param {boolean} visible - Visibility of the layers
|
|
273
|
+
* @param {String} sourceId - Identifier of the target source (e.g. 'composite')
|
|
274
|
+
* @param {String=} sourceLayerId - Identifier of the target source-layer (e.g. 'building')
|
|
275
|
+
*/
|
|
276
|
+
setSourceVisibility(visible, sourceId) {
|
|
277
|
+
let sourceLayerId = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : undefined;
|
|
278
|
+
this._runNativeCommand('setSourceVisibility', this._nativeRef, [visible, sourceId, sourceLayerId]);
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
/**
|
|
282
|
+
* Show the attribution and telemetry action sheet.
|
|
283
|
+
* If you implement a custom attribution button, you should add this action to the button.
|
|
284
|
+
*/
|
|
285
|
+
showAttribution() {
|
|
286
|
+
return this._runNativeCommand('showAttribution', this._nativeRef);
|
|
287
|
+
}
|
|
288
|
+
_createStopConfig() {
|
|
289
|
+
let config = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
290
|
+
const stopConfig = {
|
|
291
|
+
mode: (0, _utils.isNumber)(config.mode) ? config.mode : MapboxGL.CameraModes.Ease,
|
|
292
|
+
pitch: config.pitch,
|
|
293
|
+
heading: config.heading,
|
|
294
|
+
duration: config.duration || 2000,
|
|
295
|
+
zoom: config.zoom
|
|
296
|
+
};
|
|
297
|
+
if (config.centerCoordinate) {
|
|
298
|
+
stopConfig.centerCoordinate = (0, _utils.toJSONString)((0, _geoUtils.makePoint)(config.centerCoordinate));
|
|
299
|
+
}
|
|
300
|
+
if (config.bounds && config.bounds.ne && config.bounds.sw) {
|
|
301
|
+
const {
|
|
302
|
+
ne,
|
|
303
|
+
sw,
|
|
304
|
+
paddingLeft,
|
|
305
|
+
paddingRight,
|
|
306
|
+
paddingTop,
|
|
307
|
+
paddingBottom
|
|
308
|
+
} = config.bounds;
|
|
309
|
+
stopConfig.bounds = (0, _utils.toJSONString)((0, _geoUtils.makeLatLngBounds)(ne, sw));
|
|
310
|
+
stopConfig.boundsPaddingTop = paddingTop || 0;
|
|
311
|
+
stopConfig.boundsPaddingRight = paddingRight || 0;
|
|
312
|
+
stopConfig.boundsPaddingBottom = paddingBottom || 0;
|
|
313
|
+
stopConfig.boundsPaddingLeft = paddingLeft || 0;
|
|
314
|
+
}
|
|
315
|
+
return stopConfig;
|
|
316
|
+
}
|
|
317
|
+
_onPress(e) {
|
|
318
|
+
if ((0, _utils.isFunction)(this.props.onPress)) {
|
|
319
|
+
this.props.onPress(e.nativeEvent.payload);
|
|
320
|
+
}
|
|
321
|
+
}
|
|
322
|
+
_onLongPress(e) {
|
|
323
|
+
if ((0, _utils.isFunction)(this.props.onLongPress)) {
|
|
324
|
+
this.props.onLongPress(e.nativeEvent.payload);
|
|
325
|
+
}
|
|
326
|
+
}
|
|
327
|
+
_onRegionWillChange(payload) {
|
|
328
|
+
if ((0, _utils.isFunction)(this.props.onRegionWillChange)) {
|
|
329
|
+
this.props.onRegionWillChange(payload);
|
|
330
|
+
}
|
|
331
|
+
this.setState({
|
|
332
|
+
isUserInteraction: payload.properties.isUserInteraction,
|
|
333
|
+
isAnimatingFromUserInteraction: payload.properties.isAnimatingFromUserInteraction
|
|
334
|
+
});
|
|
335
|
+
}
|
|
336
|
+
_onRegionDidChange(payload) {
|
|
337
|
+
if ((0, _utils.isFunction)(this.props.onRegionDidChange)) {
|
|
338
|
+
this.props.onRegionDidChange(payload);
|
|
339
|
+
}
|
|
340
|
+
this.setState({
|
|
341
|
+
region: payload
|
|
342
|
+
});
|
|
343
|
+
}
|
|
344
|
+
_onChange(e) {
|
|
345
|
+
const {
|
|
346
|
+
regionWillChangeDebounceTime,
|
|
347
|
+
regionDidChangeDebounceTime
|
|
348
|
+
} = this.props;
|
|
349
|
+
const {
|
|
350
|
+
type,
|
|
351
|
+
payload
|
|
352
|
+
} = e.nativeEvent;
|
|
353
|
+
let propName = '';
|
|
354
|
+
switch (type) {
|
|
355
|
+
case MapboxGL.EventTypes.RegionWillChange:
|
|
356
|
+
if (regionWillChangeDebounceTime > 0) {
|
|
357
|
+
this._onDebouncedRegionWillChange(payload);
|
|
358
|
+
} else {
|
|
359
|
+
propName = 'onRegionWillChange';
|
|
360
|
+
}
|
|
361
|
+
break;
|
|
362
|
+
case MapboxGL.EventTypes.RegionIsChanging:
|
|
363
|
+
propName = 'onRegionIsChanging';
|
|
364
|
+
break;
|
|
365
|
+
case MapboxGL.EventTypes.RegionDidChange:
|
|
366
|
+
if (regionDidChangeDebounceTime > 0) {
|
|
367
|
+
this._onDebouncedRegionDidChange(payload);
|
|
368
|
+
} else {
|
|
369
|
+
propName = 'onRegionDidChange';
|
|
370
|
+
}
|
|
371
|
+
break;
|
|
372
|
+
case MapboxGL.EventTypes.CameraChanged:
|
|
373
|
+
propName = 'onCameraChanged';
|
|
374
|
+
break;
|
|
375
|
+
case MapboxGL.EventTypes.MapIdle:
|
|
376
|
+
propName = 'onMapIdle';
|
|
377
|
+
break;
|
|
378
|
+
case MapboxGL.EventTypes.UserLocationUpdated:
|
|
379
|
+
propName = 'onUserLocationUpdate';
|
|
380
|
+
break;
|
|
381
|
+
case MapboxGL.EventTypes.WillStartLoadingMap:
|
|
382
|
+
propName = 'onWillStartLoadingMap';
|
|
383
|
+
break;
|
|
384
|
+
case MapboxGL.EventTypes.DidFinishLoadingMap:
|
|
385
|
+
propName = 'onDidFinishLoadingMap';
|
|
386
|
+
break;
|
|
387
|
+
case MapboxGL.EventTypes.DidFailLoadingMap:
|
|
388
|
+
propName = 'onDidFailLoadingMap';
|
|
389
|
+
break;
|
|
390
|
+
case MapboxGL.EventTypes.WillStartRenderingFrame:
|
|
391
|
+
propName = 'onWillStartRenderingFrame';
|
|
392
|
+
break;
|
|
393
|
+
case MapboxGL.EventTypes.DidFinishRenderingFrame:
|
|
394
|
+
propName = 'onDidFinishRenderingFrame';
|
|
395
|
+
break;
|
|
396
|
+
case MapboxGL.EventTypes.DidFinishRenderingFrameFully:
|
|
397
|
+
propName = 'onDidFinishRenderingFrameFully';
|
|
398
|
+
break;
|
|
399
|
+
case MapboxGL.EventTypes.WillStartRenderingMap:
|
|
400
|
+
propName = 'onWillStartRenderingMap';
|
|
401
|
+
break;
|
|
402
|
+
case MapboxGL.EventTypes.DidFinishRenderingMap:
|
|
403
|
+
propName = 'onDidFinishRenderingMap';
|
|
404
|
+
break;
|
|
405
|
+
case MapboxGL.EventTypes.DidFinishRenderingMapFully:
|
|
406
|
+
propName = 'onDidFinishRenderingMapFully';
|
|
407
|
+
break;
|
|
408
|
+
case MapboxGL.EventTypes.DidFinishLoadingStyle:
|
|
409
|
+
propName = 'onDidFinishLoadingStyle';
|
|
410
|
+
break;
|
|
411
|
+
default:
|
|
412
|
+
console.warn('Unhandled event callback type', type);
|
|
413
|
+
}
|
|
414
|
+
if (propName.length) {
|
|
415
|
+
this._handleOnChange(propName, payload);
|
|
416
|
+
}
|
|
417
|
+
}
|
|
418
|
+
_onLayout(e) {
|
|
419
|
+
this.setState({
|
|
420
|
+
isReady: true,
|
|
421
|
+
width: e.nativeEvent.layout.width,
|
|
422
|
+
height: e.nativeEvent.layout.height
|
|
423
|
+
});
|
|
424
|
+
}
|
|
425
|
+
_handleOnChange(propName, payload) {
|
|
426
|
+
if ((0, _utils.isFunction)(this.props[propName])) {
|
|
427
|
+
this.props[propName](payload);
|
|
428
|
+
}
|
|
429
|
+
}
|
|
430
|
+
_getCenterCoordinate() {
|
|
431
|
+
if (!this.props.centerCoordinate) {
|
|
432
|
+
return;
|
|
433
|
+
}
|
|
434
|
+
return (0, _utils.toJSONString)((0, _geoUtils.makePoint)(this.props.centerCoordinate));
|
|
435
|
+
}
|
|
436
|
+
_getVisibleCoordinateBounds() {
|
|
437
|
+
if (!this.props.visibleCoordinateBounds) {
|
|
438
|
+
return;
|
|
439
|
+
}
|
|
440
|
+
return (0, _utils.toJSONString)((0, _geoUtils.makeLatLngBounds)(this.props.visibleCoordinateBounds[0], this.props.visibleCoordinateBounds[1]));
|
|
441
|
+
}
|
|
442
|
+
_getContentInset() {
|
|
443
|
+
if (!this.props.contentInset) {
|
|
444
|
+
return;
|
|
445
|
+
}
|
|
446
|
+
if (!Array.isArray(this.props.contentInset)) {
|
|
447
|
+
return [this.props.contentInset];
|
|
448
|
+
}
|
|
449
|
+
return this.props.contentInset;
|
|
450
|
+
}
|
|
451
|
+
_setNativeRef(nativeRef) {
|
|
452
|
+
this._nativeRef = nativeRef;
|
|
453
|
+
super._runPendingNativeCommands(nativeRef);
|
|
454
|
+
}
|
|
455
|
+
setNativeProps(props) {
|
|
456
|
+
if (this._nativeRef) {
|
|
457
|
+
this._nativeRef.setNativeProps(props);
|
|
458
|
+
}
|
|
459
|
+
}
|
|
460
|
+
_setStyleURL(props) {
|
|
461
|
+
// user set a styleURL, no need to alter props
|
|
462
|
+
if (props.styleURL) {
|
|
463
|
+
return;
|
|
464
|
+
}
|
|
465
|
+
|
|
466
|
+
// user set styleJSON pass it to styleURL
|
|
467
|
+
if (props.styleJSON && !props.styleURL) {
|
|
468
|
+
props.styleURL = props.styleJSON;
|
|
469
|
+
}
|
|
470
|
+
|
|
471
|
+
// user neither set styleJSON nor styleURL
|
|
472
|
+
// set defaultStyleUrl
|
|
473
|
+
if (!props.styleJSON || !props.styleURL) {
|
|
474
|
+
props.styleURL = defaultStyleURL;
|
|
475
|
+
}
|
|
476
|
+
}
|
|
477
|
+
render() {
|
|
478
|
+
const props = {
|
|
479
|
+
...this.props,
|
|
480
|
+
contentInset: this._getContentInset(),
|
|
481
|
+
style: styles.matchParent
|
|
482
|
+
};
|
|
483
|
+
this._setStyleURL(props);
|
|
484
|
+
const callbacks = {
|
|
485
|
+
ref: nativeRef => this._setNativeRef(nativeRef),
|
|
486
|
+
onPress: this._onPress,
|
|
487
|
+
onLongPress: this._onLongPress,
|
|
488
|
+
onMapChange: this._onChange,
|
|
489
|
+
onAndroidCallback: (0, _utils.isAndroid)() ? this._onAndroidCallback : undefined
|
|
490
|
+
};
|
|
491
|
+
let mapView = null;
|
|
492
|
+
if ((0, _utils.isAndroid)() && !this.props.surfaceView && this.state.isReady) {
|
|
493
|
+
mapView = /*#__PURE__*/_react.default.createElement(RCTMGLAndroidTextureMapView, _extends({}, props, callbacks), this.props.children);
|
|
494
|
+
} else if (this.state.isReady) {
|
|
495
|
+
mapView = /*#__PURE__*/_react.default.createElement(RCTMGLMapView, _extends({}, props, callbacks), this.props.children);
|
|
496
|
+
}
|
|
497
|
+
return /*#__PURE__*/_react.default.createElement(_reactNative.View, {
|
|
498
|
+
onLayout: this._onLayout,
|
|
499
|
+
style: this.props.style,
|
|
500
|
+
testID: mapView ? null : this.props.testID
|
|
501
|
+
}, mapView);
|
|
502
|
+
}
|
|
503
|
+
}
|
|
504
|
+
_defineProperty(MapView, "propTypes", {
|
|
505
|
+
..._utils.viewPropTypes,
|
|
506
|
+
/**
|
|
507
|
+
* The distance from the edges of the map view’s frame to the edges of the map view’s logical viewport.
|
|
508
|
+
*/
|
|
509
|
+
contentInset: _propTypes.default.oneOfType([_propTypes.default.arrayOf(_propTypes.default.number), _propTypes.default.number]),
|
|
510
|
+
/**
|
|
511
|
+
* The projection used when rendering the map
|
|
512
|
+
*/
|
|
513
|
+
projection: _propTypes.default.oneOf(['mercator', 'globe']),
|
|
514
|
+
/**
|
|
515
|
+
* Style for wrapping React Native View
|
|
516
|
+
*/
|
|
517
|
+
style: _propTypes.default.any,
|
|
518
|
+
/**
|
|
519
|
+
* Style URL for map - notice, if non is set it _will_ default to `MapboxGL.StyleURL.Street`
|
|
520
|
+
*/
|
|
521
|
+
styleURL: _propTypes.default.string,
|
|
522
|
+
/**
|
|
523
|
+
* StyleJSON for map - according to TileJSON specs: https://github.com/mapbox/tilejson-spec
|
|
524
|
+
*/
|
|
525
|
+
styleJSON: _propTypes.default.string,
|
|
526
|
+
/**
|
|
527
|
+
* iOS: The preferred frame rate at which the map view is rendered.
|
|
528
|
+
* The default value for this property is MGLMapViewPreferredFramesPerSecondDefault,
|
|
529
|
+
* which will adaptively set the preferred frame rate based on the capability of
|
|
530
|
+
* the user’s device to maintain a smooth experience. This property can be set to arbitrary integer values.
|
|
531
|
+
*
|
|
532
|
+
* Android: The maximum frame rate at which the map view is rendered, but it can't exceed the ability of device hardware.
|
|
533
|
+
* This property can be set to arbitrary integer values.
|
|
534
|
+
*/
|
|
535
|
+
preferredFramesPerSecond: _propTypes.default.number,
|
|
536
|
+
/**
|
|
537
|
+
* Automatically change the language of the map labels to the system’s preferred language,
|
|
538
|
+
* this is not something that can be toggled on/off
|
|
539
|
+
*/
|
|
540
|
+
localizeLabels: _propTypes.default.bool,
|
|
541
|
+
/**
|
|
542
|
+
* Enable/Disable zoom on the map
|
|
543
|
+
*/
|
|
544
|
+
zoomEnabled: _propTypes.default.bool,
|
|
545
|
+
/**
|
|
546
|
+
* Enable/Disable scroll on the map
|
|
547
|
+
*/
|
|
548
|
+
scrollEnabled: _propTypes.default.bool,
|
|
549
|
+
/**
|
|
550
|
+
* Enable/Disable pitch on map
|
|
551
|
+
*/
|
|
552
|
+
pitchEnabled: _propTypes.default.bool,
|
|
553
|
+
/**
|
|
554
|
+
* Enable/Disable rotation on map
|
|
555
|
+
*/
|
|
556
|
+
rotateEnabled: _propTypes.default.bool,
|
|
557
|
+
/**
|
|
558
|
+
* The Mapbox terms of service, which governs the use of Mapbox-hosted vector tiles and styles,
|
|
559
|
+
* [requires](https://www.mapbox.com/help/how-attribution-works/) these copyright notices to accompany any map that features Mapbox-designed styles, OpenStreetMap data, or other Mapbox data such as satellite or terrain data.
|
|
560
|
+
* If that applies to this map view, do not hide this view or remove any notices from it.
|
|
561
|
+
*
|
|
562
|
+
* You are additionally [required](https://www.mapbox.com/help/how-mobile-apps-work/#telemetry) to provide users with the option to disable anonymous usage and location sharing (telemetry).
|
|
563
|
+
* If this view is hidden, you must implement this setting elsewhere in your app. See our website for [Android](https://www.mapbox.com/android-docs/map-sdk/overview/#telemetry-opt-out) and [iOS](https://www.mapbox.com/ios-sdk/#telemetry_opt_out) for implementation details.
|
|
564
|
+
*
|
|
565
|
+
* Enable/Disable attribution on map. For iOS you need to add MGLMapboxMetricsEnabledSettingShownInApp=YES
|
|
566
|
+
* to your Info.plist
|
|
567
|
+
*/
|
|
568
|
+
attributionEnabled: _propTypes.default.bool,
|
|
569
|
+
/**
|
|
570
|
+
* Adds attribution offset, e.g. `{top: 8, left: 8}` will put attribution button in top-left corner of the map. By default on Android, the attribution with information icon (i) will be on the bottom left, while on iOS the mapbox logo will be on bottom left with information icon (i) on bottom right. Read more about mapbox attribution [here](https://docs.mapbox.com/help/getting-started/attribution/)
|
|
571
|
+
*/
|
|
572
|
+
attributionPosition: _utils.ornamentPositionPropType,
|
|
573
|
+
/**
|
|
574
|
+
* MapView's tintColor
|
|
575
|
+
*/
|
|
576
|
+
tintColor: _propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.array]),
|
|
577
|
+
/**
|
|
578
|
+
* Enable/Disable the logo on the map.
|
|
579
|
+
*/
|
|
580
|
+
logoEnabled: _propTypes.default.bool,
|
|
581
|
+
/**
|
|
582
|
+
* Adds logo offset, e.g. `{top: 8, left: 8}` will put the logo in top-left corner of the map
|
|
583
|
+
*/
|
|
584
|
+
logoPosition: _utils.ornamentPositionPropType,
|
|
585
|
+
/**
|
|
586
|
+
* Enable/Disable the compass from appearing on the map
|
|
587
|
+
*/
|
|
588
|
+
compassEnabled: _propTypes.default.bool,
|
|
589
|
+
/**
|
|
590
|
+
* [`mapbox` (v10) implementation only] Enable/Disable if the compass should fade out when the map is pointing north
|
|
591
|
+
*/
|
|
592
|
+
compassFadeWhenNorth: _propTypes.default.bool,
|
|
593
|
+
/**
|
|
594
|
+
* [`mapbox` (v10) implementation only] Adds compass offset, e.g. `{top: 8, left: 8}` will put the compass in top-left corner of the map
|
|
595
|
+
*/
|
|
596
|
+
compassPosition: _utils.ornamentPositionPropType,
|
|
597
|
+
/**
|
|
598
|
+
* Change corner of map the compass starts at. 0: TopLeft, 1: TopRight, 2: BottomLeft, 3: BottomRight
|
|
599
|
+
*/
|
|
600
|
+
compassViewPosition: _propTypes.default.number,
|
|
601
|
+
/**
|
|
602
|
+
* Add margins to the compass with x and y values
|
|
603
|
+
*/
|
|
604
|
+
compassViewMargins: _propTypes.default.object,
|
|
605
|
+
/**
|
|
606
|
+
* [`mapbox` (v10) implementation only] Enable/Disable the scale bar from appearing on the map
|
|
607
|
+
*/
|
|
608
|
+
scaleBarEnabled: _propTypes.default.bool,
|
|
609
|
+
/**
|
|
610
|
+
* [`mapbox` (v10) implementation only] Adds scale bar offset, e.g. `{top: 8, left: 8}` will put the scale bar in top-left corner of the map
|
|
611
|
+
*/
|
|
612
|
+
scaleBarPosition: _utils.ornamentPositionPropType,
|
|
613
|
+
/**
|
|
614
|
+
* [Android only] Enable/Disable use of GLSurfaceView instead of TextureView.
|
|
615
|
+
*/
|
|
616
|
+
surfaceView: _propTypes.default.bool,
|
|
617
|
+
/**
|
|
618
|
+
* Map press listener, gets called when a user presses the map
|
|
619
|
+
*/
|
|
620
|
+
onPress: _propTypes.default.func,
|
|
621
|
+
/**
|
|
622
|
+
* Map long press listener, gets called when a user long presses the map
|
|
623
|
+
*/
|
|
624
|
+
onLongPress: _propTypes.default.func,
|
|
625
|
+
/**
|
|
626
|
+
* <v10 only
|
|
627
|
+
*
|
|
628
|
+
* This event is triggered whenever the currently displayed map region is about to change.
|
|
629
|
+
*
|
|
630
|
+
* @param {PointFeature} feature - The geojson point feature at the camera center, properties contains zoomLevel, visibleBounds
|
|
631
|
+
*/
|
|
632
|
+
onRegionWillChange: _propTypes.default.func,
|
|
633
|
+
/**
|
|
634
|
+
*
|
|
635
|
+
* This event is triggered whenever the currently displayed map region is changing.
|
|
636
|
+
*
|
|
637
|
+
* @param {PointFeature} feature - The geojson point feature at the camera center, properties contains zoomLevel, visibleBounds
|
|
638
|
+
*/
|
|
639
|
+
onRegionIsChanging: _propTypes.default.func,
|
|
640
|
+
/**
|
|
641
|
+
*
|
|
642
|
+
* This event is triggered whenever the currently displayed map region finished changing.
|
|
643
|
+
*
|
|
644
|
+
* @param {PointFeature} feature - The geojson point feature at the camera center, properties contains zoomLevel, visibleBounds
|
|
645
|
+
*/
|
|
646
|
+
onRegionDidChange: _propTypes.default.func,
|
|
647
|
+
/**
|
|
648
|
+
* iOS, v10 only, deprecated will be removed in next version - please use onRegionIsChanging.
|
|
649
|
+
*/
|
|
650
|
+
onCameraChanged: _propTypes.default.func,
|
|
651
|
+
/**
|
|
652
|
+
* iOS, v10 only, deprecated will be removed in next version - please use onRegionDidChange
|
|
653
|
+
*/
|
|
654
|
+
onMapIdle: _propTypes.default.func,
|
|
655
|
+
/**
|
|
656
|
+
* This event is triggered when the map is about to start loading a new map style.
|
|
657
|
+
*/
|
|
658
|
+
onWillStartLoadingMap: _propTypes.default.func,
|
|
659
|
+
/**
|
|
660
|
+
* This is triggered when the map has successfully loaded a new map style.
|
|
661
|
+
*/
|
|
662
|
+
onDidFinishLoadingMap: _propTypes.default.func,
|
|
663
|
+
/**
|
|
664
|
+
* This event is triggered when the map has failed to load a new map style.
|
|
665
|
+
*/
|
|
666
|
+
onDidFailLoadingMap: _propTypes.default.func,
|
|
667
|
+
/**
|
|
668
|
+
* This event is triggered when the map will start rendering a frame.
|
|
669
|
+
*/
|
|
670
|
+
onWillStartRenderingFrame: _propTypes.default.func,
|
|
671
|
+
/**
|
|
672
|
+
* This event is triggered when the map finished rendering a frame.
|
|
673
|
+
*/
|
|
674
|
+
onDidFinishRenderingFrame: _propTypes.default.func,
|
|
675
|
+
/**
|
|
676
|
+
* This event is triggered when the map fully finished rendering a frame.
|
|
677
|
+
*/
|
|
678
|
+
onDidFinishRenderingFrameFully: _propTypes.default.func,
|
|
679
|
+
/**
|
|
680
|
+
* This event is triggered when the map will start rendering the map.
|
|
681
|
+
*/
|
|
682
|
+
onWillStartRenderingMap: _propTypes.default.func,
|
|
683
|
+
/**
|
|
684
|
+
* This event is triggered when the map finished rendering the map.
|
|
685
|
+
*/
|
|
686
|
+
onDidFinishRenderingMap: _propTypes.default.func,
|
|
687
|
+
/**
|
|
688
|
+
* This event is triggered when the map fully finished rendering the map.
|
|
689
|
+
*/
|
|
690
|
+
onDidFinishRenderingMapFully: _propTypes.default.func,
|
|
691
|
+
/**
|
|
692
|
+
* This event is triggered when the user location is updated.
|
|
693
|
+
*/
|
|
694
|
+
onUserLocationUpdate: _propTypes.default.func,
|
|
695
|
+
/**
|
|
696
|
+
* This event is triggered when a style has finished loading.
|
|
697
|
+
*/
|
|
698
|
+
onDidFinishLoadingStyle: _propTypes.default.func,
|
|
699
|
+
/**
|
|
700
|
+
* The emitted frequency of regionwillchange events
|
|
701
|
+
*/
|
|
702
|
+
regionWillChangeDebounceTime: _propTypes.default.number,
|
|
703
|
+
/**
|
|
704
|
+
* The emitted frequency of regiondidchange events
|
|
705
|
+
*/
|
|
706
|
+
regionDidChangeDebounceTime: _propTypes.default.number
|
|
707
|
+
});
|
|
708
|
+
_defineProperty(MapView, "defaultProps", {
|
|
709
|
+
projection: 'mercator',
|
|
710
|
+
localizeLabels: false,
|
|
711
|
+
scrollEnabled: true,
|
|
712
|
+
pitchEnabled: true,
|
|
713
|
+
rotateEnabled: true,
|
|
714
|
+
attributionEnabled: true,
|
|
715
|
+
compassEnabled: false,
|
|
716
|
+
compassFadeWhenNorth: false,
|
|
717
|
+
logoEnabled: true,
|
|
718
|
+
scaleBarEnabled: true,
|
|
719
|
+
surfaceView: false,
|
|
720
|
+
regionWillChangeDebounceTime: 10,
|
|
721
|
+
regionDidChangeDebounceTime: 500
|
|
722
|
+
});
|
|
723
|
+
const RCTMGLMapView = (0, _reactNative.requireNativeComponent)(NATIVE_MODULE_NAME, MapView, {
|
|
724
|
+
nativeOnly: {
|
|
725
|
+
onMapChange: true,
|
|
726
|
+
onAndroidCallback: true
|
|
727
|
+
}
|
|
728
|
+
});
|
|
729
|
+
let RCTMGLAndroidTextureMapView;
|
|
730
|
+
if ((0, _utils.isAndroid)()) {
|
|
731
|
+
RCTMGLAndroidTextureMapView = (0, _reactNative.requireNativeComponent)(ANDROID_TEXTURE_NATIVE_MODULE_NAME, MapView, {
|
|
732
|
+
nativeOnly: {
|
|
733
|
+
onMapChange: true,
|
|
734
|
+
onAndroidCallback: true
|
|
735
|
+
}
|
|
736
|
+
});
|
|
737
|
+
}
|
|
738
|
+
var _default = MapView;
|
|
739
|
+
exports.default = _default;
|
|
740
|
+
//# sourceMappingURL=MapView.js.map
|