@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,112 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = exports.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 _utils = require("../utils");
|
|
11
|
+
var _AbstractSource = _interopRequireDefault(require("./AbstractSource"));
|
|
12
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
13
|
+
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); }
|
|
14
|
+
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; }
|
|
15
|
+
const MapboxGL = _reactNative.NativeModules.MGLModule;
|
|
16
|
+
const NATIVE_MODULE_NAME = 'RCTMGLRasterSource';
|
|
17
|
+
exports.NATIVE_MODULE_NAME = NATIVE_MODULE_NAME;
|
|
18
|
+
const isTileTemplateUrl = url => url && (url.includes('{z}') || url.includes('{bbox-') || url.includes('{quadkey}'));
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* RasterSource is a map content source that supplies raster image tiles to be shown on the map.
|
|
22
|
+
* The location of and metadata about the tiles are defined either by an option dictionary
|
|
23
|
+
* or by an external file that conforms to the TileJSON specification.
|
|
24
|
+
*/
|
|
25
|
+
class RasterSource extends _AbstractSource.default {
|
|
26
|
+
constructor(props) {
|
|
27
|
+
super(props);
|
|
28
|
+
if (isTileTemplateUrl(props.url)) {
|
|
29
|
+
console.warn(`RasterSource 'url' property contains a Tile URL Template, but is intended for a StyleJSON URL. Please migrate your VectorSource to use: \`tileUrlTemplates=["${props.url}"]\` instead.`);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
render() {
|
|
33
|
+
let {
|
|
34
|
+
url
|
|
35
|
+
} = this.props;
|
|
36
|
+
let {
|
|
37
|
+
tileUrlTemplates
|
|
38
|
+
} = this.props;
|
|
39
|
+
|
|
40
|
+
// Swapping url for tileUrlTemplates to provide backward compatibility
|
|
41
|
+
// when RasterSource supported only tile url as url prop
|
|
42
|
+
if (isTileTemplateUrl(url)) {
|
|
43
|
+
tileUrlTemplates = [url];
|
|
44
|
+
url = undefined;
|
|
45
|
+
}
|
|
46
|
+
const props = {
|
|
47
|
+
...this.props,
|
|
48
|
+
id: this.props.id,
|
|
49
|
+
url,
|
|
50
|
+
tileUrlTemplates,
|
|
51
|
+
minZoomLevel: this.props.minZoomLevel,
|
|
52
|
+
maxZoomLevel: this.props.maxZoomLevel,
|
|
53
|
+
tileSize: this.props.tileSize,
|
|
54
|
+
tms: this.props.tms,
|
|
55
|
+
attribution: this.props.attribution
|
|
56
|
+
};
|
|
57
|
+
return /*#__PURE__*/_react.default.createElement(RCTMGLRasterSource, _extends({
|
|
58
|
+
ref: this.setNativeRef
|
|
59
|
+
}, props), (0, _utils.cloneReactChildrenWithProps)(this.props.children, {
|
|
60
|
+
sourceID: this.props.id
|
|
61
|
+
}));
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
_defineProperty(RasterSource, "propTypes", {
|
|
65
|
+
..._utils.viewPropTypes,
|
|
66
|
+
/**
|
|
67
|
+
* A string that uniquely identifies the source.
|
|
68
|
+
*/
|
|
69
|
+
id: _propTypes.default.string.isRequired,
|
|
70
|
+
/**
|
|
71
|
+
* A URL to a TileJSON configuration file describing the source’s contents and other metadata.
|
|
72
|
+
*/
|
|
73
|
+
url: _propTypes.default.string,
|
|
74
|
+
/**
|
|
75
|
+
* An array of tile URL templates. If multiple endpoints are specified, clients may use any combination of endpoints.
|
|
76
|
+
* Example: https://example.com/raster-tiles/{z}/{x}/{y}.png
|
|
77
|
+
*/
|
|
78
|
+
tileUrlTemplates: _propTypes.default.arrayOf(_propTypes.default.string),
|
|
79
|
+
/**
|
|
80
|
+
* An unsigned integer that specifies the minimum zoom level at which to display tiles from the source.
|
|
81
|
+
* The value should be between 0 and 22, inclusive, and less than
|
|
82
|
+
* maxZoomLevel, if specified. The default value for this option is 0.
|
|
83
|
+
*/
|
|
84
|
+
minZoomLevel: _propTypes.default.number,
|
|
85
|
+
/**
|
|
86
|
+
* An unsigned integer that specifies the maximum zoom level at which to display tiles from the source.
|
|
87
|
+
* The value should be between 0 and 22, inclusive, and less than
|
|
88
|
+
* minZoomLevel, if specified. The default value for this option is 22.
|
|
89
|
+
*/
|
|
90
|
+
maxZoomLevel: _propTypes.default.number,
|
|
91
|
+
/**
|
|
92
|
+
* Size of the map tiles.
|
|
93
|
+
* Mapbox urls default to 256, all others default to 512.
|
|
94
|
+
*/
|
|
95
|
+
tileSize: _propTypes.default.number,
|
|
96
|
+
/**
|
|
97
|
+
* Influences the y direction of the tile coordinates. (tms inverts y axis)
|
|
98
|
+
*/
|
|
99
|
+
tms: _propTypes.default.bool,
|
|
100
|
+
/**
|
|
101
|
+
* An HTML or literal text string defining the buttons to be displayed in an action sheet when the
|
|
102
|
+
* source is part of a map view’s style and the map view’s attribution button is pressed.
|
|
103
|
+
*/
|
|
104
|
+
attribution: _propTypes.default.string
|
|
105
|
+
});
|
|
106
|
+
_defineProperty(RasterSource, "defaultProps", {
|
|
107
|
+
id: MapboxGL.StyleSource.DefaultSourceID
|
|
108
|
+
});
|
|
109
|
+
const RCTMGLRasterSource = (0, _reactNative.requireNativeComponent)(NATIVE_MODULE_NAME, RasterSource);
|
|
110
|
+
var _default = RasterSource;
|
|
111
|
+
exports.default = _default;
|
|
112
|
+
//# sourceMappingURL=RasterSource.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["MapboxGL","NativeModules","MGLModule","NATIVE_MODULE_NAME","isTileTemplateUrl","url","includes","RasterSource","AbstractSource","constructor","props","console","warn","render","tileUrlTemplates","undefined","id","minZoomLevel","maxZoomLevel","tileSize","tms","attribution","setNativeRef","cloneReactChildrenWithProps","children","sourceID","viewPropTypes","PropTypes","string","isRequired","arrayOf","number","bool","StyleSource","DefaultSourceID","RCTMGLRasterSource","requireNativeComponent"],"sourceRoot":"../../javascript","sources":["RasterSource.js"],"mappings":";;;;;;AAAA;AACA;AACA;AAEA;AAEA;AAA8C;AAA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AC,GAAG,EAAE,IAAI,CAACC;IAAa,GAAKZ,KAAK,GAClD,IAAAa,kCAA2B,EAAC,IAAI,CAACb,KAAK,CAACc,QAAQ,EAAE;MAChDC,QAAQ,EAAE,IAAI,CAACf,KAAK,CAACM;IACvB,CAAC,CAAC,CACiB;EAEzB;AACF;AAAC,gBA/FKT,YAAY,eACG;EACjB,GAAGmB,oBAAa;EAEhB;AACJ;AACA;EACIV,EAAE,EAAEW,kBAAS,CAACC,MAAM,CAACC,UAAU;EAE/B;AACJ;AACA;EACIxB,GAAG,EAAEsB,kBAAS,CAACC,MAAM;EAErB;AACJ;AACA;AACA;EACId,gBAAgB,EAAEa,kBAAS,CAACG,OAAO,CAACH,kBAAS,CAACC,MAAM,CAAC;EAErD;AACJ;AACA;AACA;AACA;EACIX,YAAY,EAAEU,kBAAS,CAACI,MAAM;EAE9B;AACJ;AACA;AACA;AACA;EACIb,YAAY,EAAES,kBAAS,CAACI,MAAM;EAE9B;AACJ;AACA;AACA;EACIZ,QAAQ,EAAEQ,kBAAS,CAACI,MAAM;EAE1B;AACJ;AACA;EACIX,GAAG,EAAEO,kBAAS,CAACK,IAAI;EAEnB;AACJ;AACA;AACA;EACIX,WAAW,EAAEM,kBAAS,CAACC;AACzB,CAAC;AAAA,gBAlDGrB,YAAY,kBAoDM;EACpBS,EAAE,EAAEhB,QAAQ,CAACiC,WAAW,CAACC;AAC3B,CAAC;AA2CH,MAAMC,kBAAkB,GAAG,IAAAC,mCAAsB,EAC/CjC,kBAAkB,EAClBI,YAAY,CACb;AAAC,eAEaA,YAAY;AAAA"}
|
|
@@ -0,0 +1,193 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.ShapeSource = exports.NATIVE_MODULE_NAME = void 0;
|
|
7
|
+
var _react = _interopRequireDefault(require("react"));
|
|
8
|
+
var _reactNative = require("react-native");
|
|
9
|
+
var _filterUtils = require("../utils/filterUtils");
|
|
10
|
+
var _utils = require("../utils");
|
|
11
|
+
var _deprecation = require("../utils/deprecation");
|
|
12
|
+
var _AbstractSource = _interopRequireDefault(require("./AbstractSource"));
|
|
13
|
+
var _NativeBridgeComponent = _interopRequireDefault(require("./NativeBridgeComponent"));
|
|
14
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
15
|
+
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; }
|
|
16
|
+
const MapboxGL = _reactNative.NativeModules.MGLModule;
|
|
17
|
+
const NATIVE_MODULE_NAME = 'RCTMGLShapeSource';
|
|
18
|
+
exports.NATIVE_MODULE_NAME = NATIVE_MODULE_NAME;
|
|
19
|
+
/**
|
|
20
|
+
* ShapeSource is a map content source that supplies vector shapes to be shown on the map.
|
|
21
|
+
* The shape may be an url or a GeoJSON object
|
|
22
|
+
*/
|
|
23
|
+
class ShapeSource extends (0, _NativeBridgeComponent.default)(_AbstractSource.default, NATIVE_MODULE_NAME) {
|
|
24
|
+
constructor(props) {
|
|
25
|
+
super(props);
|
|
26
|
+
}
|
|
27
|
+
_setNativeRef(nativeRef) {
|
|
28
|
+
this.setNativeRef(nativeRef);
|
|
29
|
+
super._runPendingNativeCommands(nativeRef);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* Returns all features from the source that match the query parameters whether the feature is currently
|
|
34
|
+
* rendered on the map.
|
|
35
|
+
*
|
|
36
|
+
* @example
|
|
37
|
+
* shapeSource.features()
|
|
38
|
+
*
|
|
39
|
+
* @param {Array=} filter - an optional filter statement to filter the returned Features.
|
|
40
|
+
* @return {FeatureCollection}
|
|
41
|
+
*/
|
|
42
|
+
async features() {
|
|
43
|
+
let filter = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
44
|
+
const res = await this._runNativeCommand('features', this._nativeRef, (0, _filterUtils.getFilter)(filter));
|
|
45
|
+
if ((0, _utils.isAndroid)()) {
|
|
46
|
+
return JSON.parse(res.data);
|
|
47
|
+
}
|
|
48
|
+
return res.data;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* Returns the zoom needed to expand the cluster.
|
|
53
|
+
*
|
|
54
|
+
* @example
|
|
55
|
+
* const zoom = await shapeSource.getClusterExpansionZoom(clusterId);
|
|
56
|
+
*
|
|
57
|
+
* @param {Feature} feature - The feature cluster to expand.
|
|
58
|
+
* @return {number}
|
|
59
|
+
*/
|
|
60
|
+
async getClusterExpansionZoom(feature) {
|
|
61
|
+
if (typeof feature === 'number') {
|
|
62
|
+
console.warn('Using cluster_id is deprecated and will be removed from the future releases. Please use cluster as an argument instead.');
|
|
63
|
+
const res = await this._runNativeCommand('getClusterExpansionZoomById', this._nativeRef, [feature]);
|
|
64
|
+
return res.data;
|
|
65
|
+
}
|
|
66
|
+
const res = await this._runNativeCommand('getClusterExpansionZoom', this._nativeRef, [JSON.stringify(feature)]);
|
|
67
|
+
return res.data;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* Returns the FeatureCollection from the cluster.
|
|
72
|
+
*
|
|
73
|
+
* @example
|
|
74
|
+
* const collection = await shapeSource.getClusterLeaves(clusterId, limit, offset);
|
|
75
|
+
*
|
|
76
|
+
* @param {GeoJSON.Feature} feature - The feature cluster to expand.
|
|
77
|
+
* @param {number} limit - The number of points to return.
|
|
78
|
+
* @param {number} offset - The amount of points to skip (for pagination).
|
|
79
|
+
* @return {FeatureCollection}
|
|
80
|
+
*/
|
|
81
|
+
async getClusterLeaves(feature, limit, offset) {
|
|
82
|
+
if (typeof feature === 'number') {
|
|
83
|
+
console.warn('Using cluster_id is deprecated and will be removed from the future releases. Please use cluster as an argument instead.');
|
|
84
|
+
const res = await this._runNativeCommand('getClusterLeavesById', this._nativeRef, [feature, limit, offset]);
|
|
85
|
+
if ((0, _utils.isAndroid)()) {
|
|
86
|
+
return JSON.parse(res.data);
|
|
87
|
+
}
|
|
88
|
+
return res.data;
|
|
89
|
+
}
|
|
90
|
+
const res = await this._runNativeCommand('getClusterLeaves', this._nativeRef, [JSON.stringify(feature), limit, offset]);
|
|
91
|
+
if ((0, _utils.isAndroid)()) {
|
|
92
|
+
return JSON.parse(res.data);
|
|
93
|
+
}
|
|
94
|
+
return res.data;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
/**
|
|
98
|
+
* Returns the FeatureCollection from the cluster (on the next zoom level).
|
|
99
|
+
*
|
|
100
|
+
* @example
|
|
101
|
+
* const collection = await shapeSource.getClusterChildren(clusterId);
|
|
102
|
+
*
|
|
103
|
+
* @param {GeoJSON.Feature} feature - The feature cluster to expand.
|
|
104
|
+
* @return {FeatureCollection}
|
|
105
|
+
*/
|
|
106
|
+
async getClusterChildren(feature) {
|
|
107
|
+
if (typeof feature === 'number') {
|
|
108
|
+
console.warn('Using cluster_id is deprecated and will be removed from the future releases. Please use cluster as an argument instead.');
|
|
109
|
+
const res = await this._runNativeCommand('getClusterChildrenById', this._nativeRef, [feature]);
|
|
110
|
+
if ((0, _utils.isAndroid)()) {
|
|
111
|
+
return JSON.parse(res.data);
|
|
112
|
+
}
|
|
113
|
+
return res.data;
|
|
114
|
+
}
|
|
115
|
+
const res = await this._runNativeCommand('getClusterChildren', this._nativeRef, [JSON.stringify(feature)]);
|
|
116
|
+
if ((0, _utils.isAndroid)()) {
|
|
117
|
+
return JSON.parse(res.data);
|
|
118
|
+
}
|
|
119
|
+
return res.data;
|
|
120
|
+
}
|
|
121
|
+
setNativeProps(props) {
|
|
122
|
+
const shallowProps = Object.assign({}, props);
|
|
123
|
+
|
|
124
|
+
// Adds support for Animated
|
|
125
|
+
if (shallowProps.shape && typeof shallowProps.shape !== 'string') {
|
|
126
|
+
shallowProps.shape = JSON.stringify(shallowProps.shape);
|
|
127
|
+
}
|
|
128
|
+
super.setNativeProps(shallowProps);
|
|
129
|
+
}
|
|
130
|
+
_getShape() {
|
|
131
|
+
if (!this.props.shape) {
|
|
132
|
+
return;
|
|
133
|
+
}
|
|
134
|
+
return (0, _utils.toJSONString)(this.props.shape);
|
|
135
|
+
}
|
|
136
|
+
onPress(event) {
|
|
137
|
+
var _this$props$onPress, _this$props;
|
|
138
|
+
const {
|
|
139
|
+
nativeEvent: {
|
|
140
|
+
payload: {
|
|
141
|
+
features,
|
|
142
|
+
coordinates,
|
|
143
|
+
point
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
} = event;
|
|
147
|
+
let newEvent = {
|
|
148
|
+
features,
|
|
149
|
+
coordinates,
|
|
150
|
+
point
|
|
151
|
+
};
|
|
152
|
+
newEvent = (0, _deprecation.copyPropertiesAsDeprecated)(event, newEvent, key => {
|
|
153
|
+
console.warn(`event.${key} is deprecated on ShapeSource#onPress, please use event.features`);
|
|
154
|
+
}, {
|
|
155
|
+
nativeEvent: origNativeEvent => ({
|
|
156
|
+
...origNativeEvent,
|
|
157
|
+
payload: features[0]
|
|
158
|
+
})
|
|
159
|
+
});
|
|
160
|
+
(_this$props$onPress = (_this$props = this.props).onPress) === null || _this$props$onPress === void 0 ? void 0 : _this$props$onPress.call(_this$props, newEvent);
|
|
161
|
+
}
|
|
162
|
+
render() {
|
|
163
|
+
const props = {
|
|
164
|
+
id: this.props.id,
|
|
165
|
+
url: this.props.url,
|
|
166
|
+
shape: this._getShape(),
|
|
167
|
+
hitbox: this.props.hitbox,
|
|
168
|
+
hasPressListener: (0, _utils.isFunction)(this.props.onPress),
|
|
169
|
+
onMapboxShapeSourcePress: this.onPress.bind(this),
|
|
170
|
+
cluster: this.props.cluster ? 1 : 0,
|
|
171
|
+
clusterRadius: this.props.clusterRadius,
|
|
172
|
+
clusterMaxZoomLevel: this.props.clusterMaxZoomLevel,
|
|
173
|
+
clusterProperties: this.props.clusterProperties,
|
|
174
|
+
maxZoomLevel: this.props.maxZoomLevel,
|
|
175
|
+
buffer: this.props.buffer,
|
|
176
|
+
tolerance: this.props.tolerance,
|
|
177
|
+
lineMetrics: this.props.lineMetrics,
|
|
178
|
+
onPress: undefined,
|
|
179
|
+
ref: nativeRef => this._setNativeRef(nativeRef),
|
|
180
|
+
onAndroidCallback: (0, _utils.isAndroid)() ? this._onAndroidCallback : undefined
|
|
181
|
+
};
|
|
182
|
+
return /*#__PURE__*/_react.default.createElement(RCTMGLShapeSource, props, (0, _utils.cloneReactChildrenWithProps)(this.props.children, {
|
|
183
|
+
sourceID: this.props.id
|
|
184
|
+
}));
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
exports.ShapeSource = ShapeSource;
|
|
188
|
+
_defineProperty(ShapeSource, "NATIVE_ASSETS_KEY", 'assets');
|
|
189
|
+
_defineProperty(ShapeSource, "defaultProps", {
|
|
190
|
+
id: MapboxGL.StyleSource.DefaultSourceID
|
|
191
|
+
});
|
|
192
|
+
const RCTMGLShapeSource = (0, _reactNative.requireNativeComponent)(NATIVE_MODULE_NAME);
|
|
193
|
+
//# sourceMappingURL=ShapeSource.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["MapboxGL","NativeModules","MGLModule","NATIVE_MODULE_NAME","ShapeSource","NativeBridgeComponent","AbstractSource","constructor","props","_setNativeRef","nativeRef","setNativeRef","_runPendingNativeCommands","features","filter","res","_runNativeCommand","_nativeRef","getFilter","isAndroid","JSON","parse","data","getClusterExpansionZoom","feature","console","warn","stringify","getClusterLeaves","limit","offset","getClusterChildren","setNativeProps","shallowProps","Object","assign","shape","_getShape","toJSONString","onPress","event","nativeEvent","payload","coordinates","point","newEvent","copyPropertiesAsDeprecated","key","origNativeEvent","render","id","url","hitbox","hasPressListener","isFunction","onMapboxShapeSourcePress","bind","cluster","clusterRadius","clusterMaxZoomLevel","clusterProperties","maxZoomLevel","buffer","tolerance","lineMetrics","undefined","ref","onAndroidCallback","_onAndroidCallback","cloneReactChildrenWithProps","children","sourceID","StyleSource","DefaultSourceID","RCTMGLShapeSource","requireNativeComponent"],"sourceRoot":"../../javascript","sources":["ShapeSource.tsx"],"mappings":";;;;;;AAAA;AACA;AAQA;AACA;AAMA;AAEA;AACA;AAA4D;AAAA;AAE5D,MAAMA,QAAQ,GAAGC,0BAAa,CAACC,SAAS;AAEjC,MAAMC,kBAAkB,GAAG,mBAAmB;AAAC;AAiItD;AACA;AACA;AACA;AACO,MAAMC,WAAW,SAAS,IAAAC,8BAAqB,EACpDC,uBAAc,EACdH,kBAAkB,CACnB,CAAC;EAOAI,WAAW,CAACC,KAAY,EAAE;IACxB,KAAK,CAACA,KAAK,CAAC;EACd;EAEAC,aAAa,CACXC,SAAiE,EACjE;IACA,IAAI,CAACC,YAAY,CAACD,SAAS,CAAC;IAC5B,KAAK,CAACE,yBAAyB,CAACF,SAAS,CAAC;EAC5C;;EAEA;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;EACE,MAAMG,QAAQ,GAA6B;IAAA,IAA5BC,MAAqB,uEAAG,EAAE;IACvC,MAAMC,GAAqB,GAAG,MAAM,IAAI,CAACC,iBAAiB,CACxD,UAAU,EACV,IAAI,CAACC,UAAU,EACf,IAAAC,sBAAS,EAACJ,MAAM,CAAC,CAClB;IAED,IAAI,IAAAK,gBAAS,GAAE,EAAE;MACf,OAAOC,IAAI,CAACC,KAAK,CAACN,GAAG,CAACO,IAAI,CAAC;IAC7B;IAEA,OAAOP,GAAG,CAACO,IAAI;EACjB;;EAEA;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;EACE,MAAMC,uBAAuB,CAC3BC,OAAiC,EAChB;IACjB,IAAI,OAAOA,OAAO,KAAK,QAAQ,EAAE;MAC/BC,OAAO,CAACC,IAAI,CACV,yHAAyH,CAC1H;MACD,MAAMX,GAAqB,GAAG,MAAM,IAAI,CAACC,iBAAiB,CACxD,6BAA6B,EAC7B,IAAI,CAACC,UAAU,EACf,CAACO,OAAO,CAAC,CACV;MACD,OAAOT,GAAG,CAACO,IAAI;IACj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zB,OAAO,EAAE0B,SAAS;MAClBC,GAAG,EACDxD,SAAiE,IAC9D,IAAI,CAACD,aAAa,CAACC,SAAS,CAAC;MAClCyD,iBAAiB,EAAE,IAAAhD,gBAAS,GAAE,GAAG,IAAI,CAACiD,kBAAkB,GAAGH;IAC7D,CAAC;IAED,oBACE,6BAAC,iBAAiB,EAAKzD,KAAK,EACzB,IAAA6D,kCAA2B,EAAC,IAAI,CAAC7D,KAAK,CAAC8D,QAAQ,EAAE;MAChDC,QAAQ,EAAE,IAAI,CAAC/D,KAAK,CAAC0C;IACvB,CAAC,CAAC,CACgB;EAExB;AACF;AAAC;AAAA,gBAtPY9C,WAAW,uBAIK,QAAQ;AAAA,gBAJxBA,WAAW,kBAMA;EACpB8C,EAAE,EAAElD,QAAQ,CAACwE,WAAW,CAACC;AAC3B,CAAC;AAsPH,MAAMC,iBAAoC,GACxC,IAAAC,mCAAsB,EAACxE,kBAAkB,CAAC"}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = exports.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 _utils = require("../utils");
|
|
11
|
+
var _styleMap = require("../utils/styleMap");
|
|
12
|
+
var _AbstractLayer = _interopRequireDefault(require("./AbstractLayer"));
|
|
13
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
14
|
+
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); }
|
|
15
|
+
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; }
|
|
16
|
+
const MapboxGL = _reactNative.NativeModules.MGLModule;
|
|
17
|
+
const NATIVE_MODULE_NAME = 'RCTMGLSkyLayer';
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* SkyLayer is a spherical dome around the map that is always rendered behind all other layers
|
|
21
|
+
*/
|
|
22
|
+
exports.NATIVE_MODULE_NAME = NATIVE_MODULE_NAME;
|
|
23
|
+
class SkyLayer extends _AbstractLayer.default {
|
|
24
|
+
render() {
|
|
25
|
+
return /*#__PURE__*/_react.default.createElement(RCTMGLSkyLayer, _extends({
|
|
26
|
+
testID: "rctmglSkyLayer",
|
|
27
|
+
ref: this.setNativeLayer
|
|
28
|
+
}, this.baseProps));
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
_defineProperty(SkyLayer, "propTypes", {
|
|
32
|
+
..._utils.viewPropTypes,
|
|
33
|
+
/**
|
|
34
|
+
* A string that uniquely identifies the source in the style to which it is added.
|
|
35
|
+
*/
|
|
36
|
+
id: _propTypes.default.string.isRequired,
|
|
37
|
+
/**
|
|
38
|
+
* The source from which to obtain the data to style.
|
|
39
|
+
* If the source has not yet been added to the current style, the behavior is undefined.
|
|
40
|
+
*/
|
|
41
|
+
sourceID: _propTypes.default.string,
|
|
42
|
+
/**
|
|
43
|
+
* Inserts a layer above aboveLayerID.
|
|
44
|
+
*/
|
|
45
|
+
aboveLayerID: _propTypes.default.string,
|
|
46
|
+
/**
|
|
47
|
+
* Inserts a layer below belowLayerID
|
|
48
|
+
*/
|
|
49
|
+
belowLayerID: _propTypes.default.string,
|
|
50
|
+
/**
|
|
51
|
+
* Inserts a layer at a specified index
|
|
52
|
+
*/
|
|
53
|
+
layerIndex: _propTypes.default.number,
|
|
54
|
+
/**
|
|
55
|
+
* Filter only the features in the source layer that satisfy a condition that you define
|
|
56
|
+
*/
|
|
57
|
+
filter: _propTypes.default.array,
|
|
58
|
+
/**
|
|
59
|
+
* Customizable style attributes
|
|
60
|
+
*/
|
|
61
|
+
style: _propTypes.default.oneOfType([_styleMap.SkyLayerStyleProp, _propTypes.default.arrayOf(_styleMap.SkyLayerStyleProp)])
|
|
62
|
+
});
|
|
63
|
+
_defineProperty(SkyLayer, "defaultProps", {
|
|
64
|
+
sourceID: MapboxGL.StyleSource.DefaultSourceID
|
|
65
|
+
});
|
|
66
|
+
const RCTMGLSkyLayer = (0, _reactNative.requireNativeComponent)(NATIVE_MODULE_NAME, SkyLayer, {
|
|
67
|
+
nativeOnly: {
|
|
68
|
+
reactStyle: true
|
|
69
|
+
}
|
|
70
|
+
});
|
|
71
|
+
var _default = SkyLayer;
|
|
72
|
+
exports.default = _default;
|
|
73
|
+
//# sourceMappingURL=SkyLayer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["MapboxGL","NativeModules","MGLModule","NATIVE_MODULE_NAME","SkyLayer","AbstractLayer","render","setNativeLayer","baseProps","viewPropTypes","id","PropTypes","string","isRequired","sourceID","aboveLayerID","belowLayerID","layerIndex","number","filter","array","style","oneOfType","SkyLayerStyleProp","arrayOf","StyleSource","DefaultSourceID","RCTMGLSkyLayer","requireNativeComponent","nativeOnly","reactStyle"],"sourceRoot":"../../javascript","sources":["SkyLayer.js"],"mappings":";;;;;;AAAA;AACA;AACA;AAEA;AACA;AAEA;AAA4C;AAAA;AAAA;AAE5C,MAAMA,QAAQ,GAAGC,0BAAa,CAACC,SAAS;AAEjC,MAAMC,kBAAkB,GAAG,gBAAgB;;AAElD;AACA;AACA;AAFA;AAGA,MAAMC,QAAQ,SAASC,sBAAa,CAAC;EAgDnCC,MAAM,GAAG;IACP,oBACE,6BAAC,cAAc;MACb,MAAM,EAAC,gBAAgB;MACvB,GAAG,EAAE,IAAI,CAACC;IAAe,GACrB,IAAI,CAACC,SAAS,EAClB;EAEN;AACF;AAAC,gBAzDKJ,QAAQ,eACO;EACjB,GAAGK,oBAAa;EAEhB;AACJ;AACA;EACIC,EAAE,EAAEC,kBAAS,CAACC,MAAM,CAACC,UAAU;EAE/B;AACJ;AACA;AACA;EACIC,QAAQ,EAAEH,kBAAS,CAACC,MAAM;EAE1B;AACJ;AACA;EACIG,YAAY,EAAEJ,kBAAS,CAACC,MAAM;EAE9B;AACJ;AACA;EACII,YAAY,EAAEL,kBAAS,CAACC,MAAM;EAE9B;AACJ;AACA;EACIK,UAAU,EAAEN,kBAAS,CAACO,MAAM;EAE5B;AACJ;AACA;EACIC,MAAM,EAAER,kBAAS,CAACS,KAAK;EAEvB;AACJ;AACA;EACIC,KAAK,EAAEV,kBAAS,CAACW,SAAS,CAAC,CACzBC,2BAAiB,EACjBZ,kBAAS,CAACa,OAAO,CAACD,2BAAiB,CAAC,CACrC;AACH,CAAC;AAAA,gBA1CGnB,QAAQ,kBA4CU;EACpBU,QAAQ,EAAEd,QAAQ,CAACyB,WAAW,CAACC;AACjC,CAAC;AAaH,MAAMC,cAAc,GAAG,IAAAC,mCAAsB,EAACzB,kBAAkB,EAAEC,QAAQ,EAAE;EAC1EyB,UAAU,EAAE;IAAEC,UAAU,EAAE;EAAK;AACjC,CAAC,CAAC;AAAC,eAEY1B,QAAQ;AAAA"}
|
|
@@ -0,0 +1,269 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
8
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
9
|
+
var _CircleLayer = _interopRequireDefault(require("./CircleLayer"));
|
|
10
|
+
var _RasterLayer = _interopRequireDefault(require("./RasterLayer"));
|
|
11
|
+
var _SymbolLayer = require("./SymbolLayer");
|
|
12
|
+
var _LineLayer = _interopRequireDefault(require("./LineLayer"));
|
|
13
|
+
var _FillLayer = _interopRequireDefault(require("./FillLayer"));
|
|
14
|
+
var _FillExtrusionLayer = _interopRequireDefault(require("./FillExtrusionLayer"));
|
|
15
|
+
var _BackgroundLayer = _interopRequireDefault(require("./BackgroundLayer"));
|
|
16
|
+
var _HeatmapLayer = _interopRequireDefault(require("./HeatmapLayer"));
|
|
17
|
+
var _VectorSource = _interopRequireDefault(require("./VectorSource"));
|
|
18
|
+
var _RasterSource = _interopRequireDefault(require("./RasterSource"));
|
|
19
|
+
var _ImageSource = _interopRequireDefault(require("./ImageSource"));
|
|
20
|
+
var _ShapeSource = require("./ShapeSource");
|
|
21
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
22
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
23
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
24
|
+
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); }
|
|
25
|
+
function toCamelCase(s) {
|
|
26
|
+
return s.replace(/([-_][a-z])/gi, $1 => {
|
|
27
|
+
return $1.toUpperCase().replace('-', '').replace('_', '');
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
// Patches the Mapbox Style Specification keys into the style props attributes:
|
|
32
|
+
// icon-allow-overlap -> iconAllowOverlap
|
|
33
|
+
function toCamelCaseKeys(oldObj) {
|
|
34
|
+
if (!oldObj) {
|
|
35
|
+
return {};
|
|
36
|
+
}
|
|
37
|
+
const newObj = {};
|
|
38
|
+
Object.keys(oldObj).forEach(key => {
|
|
39
|
+
const value = oldObj[key];
|
|
40
|
+
if (key.includes('-')) {
|
|
41
|
+
newObj[toCamelCase(key)] = value;
|
|
42
|
+
} else {
|
|
43
|
+
newObj[key] = value;
|
|
44
|
+
}
|
|
45
|
+
});
|
|
46
|
+
return newObj;
|
|
47
|
+
}
|
|
48
|
+
function getLayerComponentType(layer) {
|
|
49
|
+
const {
|
|
50
|
+
type
|
|
51
|
+
} = layer;
|
|
52
|
+
switch (type) {
|
|
53
|
+
case 'circle':
|
|
54
|
+
return _CircleLayer.default;
|
|
55
|
+
case 'symbol':
|
|
56
|
+
return _SymbolLayer.SymbolLayer;
|
|
57
|
+
case 'raster':
|
|
58
|
+
return _RasterLayer.default;
|
|
59
|
+
case 'line':
|
|
60
|
+
return _LineLayer.default;
|
|
61
|
+
case 'fill':
|
|
62
|
+
return _FillLayer.default;
|
|
63
|
+
case 'fill-extrusion':
|
|
64
|
+
return _FillExtrusionLayer.default;
|
|
65
|
+
case 'background':
|
|
66
|
+
return _BackgroundLayer.default;
|
|
67
|
+
case 'heatmap':
|
|
68
|
+
return _HeatmapLayer.default;
|
|
69
|
+
}
|
|
70
|
+
console.warn(`Mapbox layer type '${type}' is not supported/`);
|
|
71
|
+
return null;
|
|
72
|
+
}
|
|
73
|
+
function asLayerComponent(layer) {
|
|
74
|
+
const LayerComponent = getLayerComponentType(layer);
|
|
75
|
+
if (!LayerComponent) {
|
|
76
|
+
return null;
|
|
77
|
+
}
|
|
78
|
+
const style = {
|
|
79
|
+
...toCamelCaseKeys(layer.paint),
|
|
80
|
+
...toCamelCaseKeys(layer.layout)
|
|
81
|
+
};
|
|
82
|
+
const layerProps = {};
|
|
83
|
+
if (layer.source) {
|
|
84
|
+
layerProps.sourceID = layer.source;
|
|
85
|
+
}
|
|
86
|
+
if (layer['source-layer']) {
|
|
87
|
+
layerProps.sourceLayerID = layer['source-layer'];
|
|
88
|
+
}
|
|
89
|
+
if (layer.minzoom) {
|
|
90
|
+
layerProps.minZoomLevel = layer.minzoom;
|
|
91
|
+
}
|
|
92
|
+
if (layer.maxzoom) {
|
|
93
|
+
layerProps.maxZoomLevel = layer.maxzoom;
|
|
94
|
+
}
|
|
95
|
+
if (layer.filter) {
|
|
96
|
+
layerProps.filter = layer.filter;
|
|
97
|
+
}
|
|
98
|
+
if (Object.keys(style).length) {
|
|
99
|
+
layerProps.style = style;
|
|
100
|
+
}
|
|
101
|
+
return /*#__PURE__*/_react.default.createElement(LayerComponent, _extends({
|
|
102
|
+
key: layer.id,
|
|
103
|
+
id: layer.id
|
|
104
|
+
}, layerProps));
|
|
105
|
+
}
|
|
106
|
+
function getTileSourceProps(source) {
|
|
107
|
+
const sourceProps = {};
|
|
108
|
+
if (source.url) {
|
|
109
|
+
sourceProps.url = source.url;
|
|
110
|
+
}
|
|
111
|
+
if (source.tiles) {
|
|
112
|
+
sourceProps.tileUrlTemplates = source.tiles;
|
|
113
|
+
}
|
|
114
|
+
if (source.minzoom !== undefined) {
|
|
115
|
+
sourceProps.minZoomLevel = source.minzoom;
|
|
116
|
+
}
|
|
117
|
+
if (source.maxzoom !== undefined) {
|
|
118
|
+
sourceProps.maxZoomLevel = source.maxzoom;
|
|
119
|
+
}
|
|
120
|
+
if (source.attribution) {
|
|
121
|
+
sourceProps.attribution = source.attribution;
|
|
122
|
+
}
|
|
123
|
+
if (source.scheme && source.scheme === 'tms') {
|
|
124
|
+
sourceProps.tms = true;
|
|
125
|
+
}
|
|
126
|
+
return sourceProps;
|
|
127
|
+
}
|
|
128
|
+
function getVectorSource(id, source) {
|
|
129
|
+
const sourceProps = {
|
|
130
|
+
...getTileSourceProps(source)
|
|
131
|
+
};
|
|
132
|
+
return /*#__PURE__*/_react.default.createElement(_VectorSource.default, _extends({
|
|
133
|
+
key: id,
|
|
134
|
+
id: id
|
|
135
|
+
}, sourceProps));
|
|
136
|
+
}
|
|
137
|
+
function getRasterSource(id, source) {
|
|
138
|
+
const sourceProps = {
|
|
139
|
+
...getTileSourceProps(source)
|
|
140
|
+
};
|
|
141
|
+
if (source.tileSize) {
|
|
142
|
+
sourceProps.tileSize = source.tileSize;
|
|
143
|
+
}
|
|
144
|
+
return /*#__PURE__*/_react.default.createElement(_RasterSource.default, _extends({
|
|
145
|
+
key: id,
|
|
146
|
+
id: id
|
|
147
|
+
}, sourceProps));
|
|
148
|
+
}
|
|
149
|
+
function getImageSource(id, source) {
|
|
150
|
+
const sourceProps = {
|
|
151
|
+
url: source.url,
|
|
152
|
+
coordinates: source.coordinates
|
|
153
|
+
};
|
|
154
|
+
return /*#__PURE__*/_react.default.createElement(_ImageSource.default, _extends({
|
|
155
|
+
key: id,
|
|
156
|
+
id: id
|
|
157
|
+
}, sourceProps));
|
|
158
|
+
}
|
|
159
|
+
function getShapeSource(id, source) {
|
|
160
|
+
const sourceProps = {};
|
|
161
|
+
if (source.data && typeof source.data === 'string') {
|
|
162
|
+
sourceProps.url = source.data;
|
|
163
|
+
} else if (source.data && typeof source.data === 'object') {
|
|
164
|
+
sourceProps.shape = source.data;
|
|
165
|
+
}
|
|
166
|
+
if (source.cluster !== undefined) {
|
|
167
|
+
sourceProps.cluster = source.cluster;
|
|
168
|
+
}
|
|
169
|
+
if (source.clusterRadius !== undefined) {
|
|
170
|
+
sourceProps.clusterRadius = source.clusterRadius;
|
|
171
|
+
}
|
|
172
|
+
if (source.maxzoom !== undefined) {
|
|
173
|
+
sourceProps.maxZoomLevel = source.maxzoom;
|
|
174
|
+
}
|
|
175
|
+
if (source.clusterMaxZoom !== undefined) {
|
|
176
|
+
sourceProps.clusterMaxZoomLevel = source.clusterMaxZoom;
|
|
177
|
+
}
|
|
178
|
+
if (source.clusterProperties !== undefined) {
|
|
179
|
+
sourceProps.clusterProperties = source.clusterProperties;
|
|
180
|
+
}
|
|
181
|
+
if (source.buffer !== undefined) {
|
|
182
|
+
sourceProps.buffer = source.buffer;
|
|
183
|
+
}
|
|
184
|
+
if (source.tolerance !== undefined) {
|
|
185
|
+
sourceProps.tolerance = source.tolerance;
|
|
186
|
+
}
|
|
187
|
+
if (source.lineMetrics !== undefined) {
|
|
188
|
+
sourceProps.lineMetrics = source.lineMetrics;
|
|
189
|
+
}
|
|
190
|
+
return /*#__PURE__*/_react.default.createElement(_ShapeSource.ShapeSource, _extends({
|
|
191
|
+
key: id,
|
|
192
|
+
id: id
|
|
193
|
+
}, sourceProps));
|
|
194
|
+
}
|
|
195
|
+
function asSourceComponent(id, source) {
|
|
196
|
+
switch (source.type) {
|
|
197
|
+
case 'vector':
|
|
198
|
+
return getVectorSource(id, source);
|
|
199
|
+
case 'raster':
|
|
200
|
+
return getRasterSource(id, source);
|
|
201
|
+
case 'image':
|
|
202
|
+
return getImageSource(id, source);
|
|
203
|
+
case 'geojson':
|
|
204
|
+
return getShapeSource(id, source);
|
|
205
|
+
}
|
|
206
|
+
console.warn(`Mapbox source type '${source.type}' is not supported/`);
|
|
207
|
+
return null;
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
/**
|
|
211
|
+
* Style is a component that automatically adds sources / layers to the map using Mapbox GL Style Spec.
|
|
212
|
+
* 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.
|
|
213
|
+
* 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.
|
|
214
|
+
*/
|
|
215
|
+
const Style = props => {
|
|
216
|
+
const [fetchedJson, setFetchedJson] = (0, _react.useState)({});
|
|
217
|
+
const json = typeof props.json === 'object' ? props.json : fetchedJson;
|
|
218
|
+
|
|
219
|
+
// Fetch style when props.json is a URL
|
|
220
|
+
(0, _react.useEffect)(() => {
|
|
221
|
+
const abortController = new AbortController();
|
|
222
|
+
const fetchStyleJson = async () => {
|
|
223
|
+
try {
|
|
224
|
+
const response = await fetch(props.json, {
|
|
225
|
+
signal: abortController.signal
|
|
226
|
+
});
|
|
227
|
+
const responseJson = await response.json();
|
|
228
|
+
setFetchedJson(responseJson);
|
|
229
|
+
} catch (e) {
|
|
230
|
+
if (e.name === 'AbortError') {
|
|
231
|
+
return;
|
|
232
|
+
}
|
|
233
|
+
throw e;
|
|
234
|
+
}
|
|
235
|
+
};
|
|
236
|
+
if (typeof props.json === 'string') {
|
|
237
|
+
fetchStyleJson();
|
|
238
|
+
}
|
|
239
|
+
return function cleanup() {
|
|
240
|
+
abortController.abort();
|
|
241
|
+
};
|
|
242
|
+
}, [props.json]);
|
|
243
|
+
|
|
244
|
+
// Extract layer components from json
|
|
245
|
+
const layerComponents = (0, _react.useMemo)(() => {
|
|
246
|
+
if (!json.layers) {
|
|
247
|
+
return [];
|
|
248
|
+
}
|
|
249
|
+
return json.layers.map(asLayerComponent).filter(x => !!x);
|
|
250
|
+
}, [json.layers]);
|
|
251
|
+
|
|
252
|
+
// Extract source components from json
|
|
253
|
+
const sourceComponents = (0, _react.useMemo)(() => {
|
|
254
|
+
if (!json.sources || !Object.keys(json.sources)) {
|
|
255
|
+
return [];
|
|
256
|
+
}
|
|
257
|
+
return Object.keys(json.sources).map(id => asSourceComponent(id, json.sources[id])).filter(x => !!x);
|
|
258
|
+
}, [json.sources]);
|
|
259
|
+
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, sourceComponents, layerComponents);
|
|
260
|
+
};
|
|
261
|
+
Style.propTypes = {
|
|
262
|
+
/**
|
|
263
|
+
* A JSON object conforming to the schema described in the Mapbox Style Specification , or a URL to such JSON.
|
|
264
|
+
*/
|
|
265
|
+
json: _propTypes.default.any
|
|
266
|
+
};
|
|
267
|
+
var _default = Style;
|
|
268
|
+
exports.default = _default;
|
|
269
|
+
//# sourceMappingURL=Style.js.map
|