@rnmapbox/maps 10.0.0-beta.49 → 10.0.0-beta.54
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 +28 -5
- package/ios/RCTMGL/MGLModule.m +2 -1
- package/ios/RCTMGL-v10/MGLModule.m +5 -1
- package/ios/RCTMGL-v10/MGLModule.swift +24 -3
- package/javascript/components/AbstractLayer.tsx +5 -4
- package/javascript/components/Camera.tsx +1 -2
- package/javascript/components/LineLayer.tsx +91 -0
- package/javascript/components/SymbolLayer.tsx +1 -1
- package/javascript/index.js +2 -2
- package/javascript/requestAndroidLocationPermissions.ts +1 -2
- package/javascript/utils/{MapboxStyles.ts → MapboxStyles.d.ts} +2 -0
- package/javascript/utils/StyleValue.ts +4 -9
- 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 +36 -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 +27 -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/LineLayer.d.ts +65 -0
- package/lib/typescript/components/LineLayer.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 +39 -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/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/javascript/components/LineLayer.js +0 -94
- 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 @@
|
|
|
1
|
+
/build
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
/build
|
package/android/rctmgl/src/main/java-mapboxgl/common/com/mapbox/rctmgl/modules/RCTMGLModule.java
CHANGED
|
@@ -299,11 +299,12 @@ public class RCTMGLModule extends ReactContextBaseJavaModule {
|
|
|
299
299
|
}
|
|
300
300
|
|
|
301
301
|
@ReactMethod
|
|
302
|
-
public void setAccessToken(final String accessToken) {
|
|
302
|
+
public void setAccessToken(final String accessToken, Promise promise) {
|
|
303
303
|
mReactContext.runOnUiQueueThread(new Runnable() {
|
|
304
304
|
@Override
|
|
305
305
|
public void run() {
|
|
306
306
|
InstanceManagerImpl.getInstance(getReactApplicationContext(), accessToken);
|
|
307
|
+
promise.resolve(accessToken);
|
|
307
308
|
}
|
|
308
309
|
});
|
|
309
310
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
package com.mapbox.rctmgl.modules
|
|
2
2
|
|
|
3
3
|
import android.os.Handler
|
|
4
|
+
import com.facebook.react.bridge.Promise
|
|
4
5
|
import com.mapbox.maps.extension.style.layers.properties.generated.LineJoin
|
|
5
6
|
import com.mapbox.maps.ResourceOptionsManager.Companion.getDefault
|
|
6
7
|
import com.facebook.react.module.annotations.ReactModule
|
|
@@ -112,11 +113,12 @@ class RCTMGLModule(private val mReactContext: ReactApplicationContext) : ReactCo
|
|
|
112
113
|
}
|
|
113
114
|
|
|
114
115
|
@ReactMethod
|
|
115
|
-
fun setAccessToken(accessToken: String
|
|
116
|
+
fun setAccessToken(accessToken: String?, promise: Promise) {
|
|
116
117
|
mReactContext.runOnUiQueueThread(Runnable {
|
|
117
118
|
getDefault(
|
|
118
119
|
reactApplicationContext, accessToken
|
|
119
120
|
)
|
|
121
|
+
promise.resolve(accessToken)
|
|
120
122
|
})
|
|
121
123
|
}
|
|
122
124
|
|
package/index.d.ts
CHANGED
|
@@ -22,7 +22,10 @@ import {
|
|
|
22
22
|
FeatureCollection,
|
|
23
23
|
} from '@turf/helpers';
|
|
24
24
|
|
|
25
|
-
import type {
|
|
25
|
+
import type {
|
|
26
|
+
SymbolLayerStyleProps,
|
|
27
|
+
LineLayerStyleProps,
|
|
28
|
+
} from './javascript/utils/MapboxStyles';
|
|
26
29
|
import {
|
|
27
30
|
Camera as _Camera,
|
|
28
31
|
CameraStop as _CameraStop,
|
|
@@ -43,6 +46,10 @@ import {
|
|
|
43
46
|
SymbolLayer as _SymbolLayer,
|
|
44
47
|
Props as _SymbolLayerProps,
|
|
45
48
|
} from './javascript/components/SymbolLayer';
|
|
49
|
+
import {
|
|
50
|
+
LineLayer as _LineLayer,
|
|
51
|
+
Props as _LineLayerProps,
|
|
52
|
+
} from './javascript/components/LineLayer';
|
|
46
53
|
import {
|
|
47
54
|
ShapeSource as _ShapeSource,
|
|
48
55
|
Props as _ShapeSourceProps,
|
|
@@ -107,7 +114,7 @@ type NamedStyles<T> = {
|
|
|
107
114
|
[P in keyof T]:
|
|
108
115
|
| SymbolLayerStyleProps
|
|
109
116
|
| RasterLayerStyle
|
|
110
|
-
|
|
|
117
|
+
| LineLayerStyleProps
|
|
111
118
|
| FillLayerStyle
|
|
112
119
|
| FillExtrusionLayerStyle
|
|
113
120
|
| CircleLayerStyle
|
|
@@ -129,7 +136,7 @@ export type OnPressEvent = {
|
|
|
129
136
|
declare namespace MapboxGL {
|
|
130
137
|
function removeCustomHeader(headerName: string): void;
|
|
131
138
|
function addCustomHeader(headerName: string, headerValue: string): void;
|
|
132
|
-
function setAccessToken(accessToken: string | null):
|
|
139
|
+
function setAccessToken(accessToken: string | null): Promise<string | null>;
|
|
133
140
|
function setWellKnownTileServer(tileServer: string): void;
|
|
134
141
|
function getAccessToken(): Promise<string>;
|
|
135
142
|
function setTelemetryEnabled(telemetryEnabled: boolean): void;
|
|
@@ -152,6 +159,7 @@ declare namespace MapboxGL {
|
|
|
152
159
|
const MarkerView = _MarkerView;
|
|
153
160
|
const PointAnnotation = _PointAnnotation;
|
|
154
161
|
const SymbolLayer = _SymbolLayer;
|
|
162
|
+
const LineLayer = _LineLayer;
|
|
155
163
|
const ShapeSource = _ShapeSource;
|
|
156
164
|
type ShapeSource = _ShapeSource;
|
|
157
165
|
|
|
@@ -187,6 +195,21 @@ declare namespace MapboxGL {
|
|
|
187
195
|
constructor(shape: _AnimatedShape);
|
|
188
196
|
}
|
|
189
197
|
|
|
198
|
+
class _TileServers {
|
|
199
|
+
Mapbox: string;
|
|
200
|
+
MapLibre?: string;
|
|
201
|
+
MapTiler?: string;
|
|
202
|
+
}
|
|
203
|
+
const TileServers: _TileServers;
|
|
204
|
+
|
|
205
|
+
class _OfflinePackDownloadState {
|
|
206
|
+
Inactive: string | number;
|
|
207
|
+
Active: string | number;
|
|
208
|
+
Complete: string | number;
|
|
209
|
+
Unknown?: string | number;
|
|
210
|
+
}
|
|
211
|
+
const OfflinePackDownloadState: _OfflinePackDownloadState;
|
|
212
|
+
|
|
190
213
|
/**
|
|
191
214
|
* GeoUtils
|
|
192
215
|
*/
|
|
@@ -256,7 +279,7 @@ declare namespace MapboxGL {
|
|
|
256
279
|
// layers
|
|
257
280
|
class FillLayer extends Component<FillLayerProps> {}
|
|
258
281
|
class FillExtrusionLayer extends Component<FillExtrusionLayerProps> {}
|
|
259
|
-
class LineLayer extends Component<
|
|
282
|
+
class LineLayer extends Component<_LineLayerProps> {}
|
|
260
283
|
class CircleLayer extends Component<CircleLayerProps> {}
|
|
261
284
|
class SymbolLayer extends Component<_SymbolLayerProps> {}
|
|
262
285
|
class RasterLayer extends Component<RasterLayerProps> {}
|
|
@@ -737,8 +760,8 @@ export type TextVariableAnchorValues =
|
|
|
737
760
|
| 'bottom-left'
|
|
738
761
|
| 'bottom-right';
|
|
739
762
|
|
|
740
|
-
/** @deprecated Will be removed in next betas */
|
|
741
763
|
export type SymbolLayerStyle = SymbolLayerStyleProps;
|
|
764
|
+
export type LineLayerStyle = LineLayerStyleProps;
|
|
742
765
|
|
|
743
766
|
export interface HeatmapLayerStyle {
|
|
744
767
|
visibility?: Visibility | Expression;
|
package/ios/RCTMGL/MGLModule.m
CHANGED
|
@@ -263,7 +263,7 @@ RCT_EXPORT_MODULE();
|
|
|
263
263
|
};
|
|
264
264
|
}
|
|
265
265
|
|
|
266
|
-
RCT_EXPORT_METHOD(setAccessToken:(NSString *)accessToken)
|
|
266
|
+
RCT_EXPORT_METHOD(setAccessToken:(NSString *)accessToken resolver:(RCTPromiseResolveBlock)resolve rejecter:(RCTPromiseRejectBlock)reject)
|
|
267
267
|
{
|
|
268
268
|
#ifdef RNMBGL_USE_MAPLIBRE
|
|
269
269
|
if (accessToken.length > 0) {
|
|
@@ -272,6 +272,7 @@ RCT_EXPORT_METHOD(setAccessToken:(NSString *)accessToken)
|
|
|
272
272
|
#else
|
|
273
273
|
[MGLAccountManager setAccessToken:accessToken];
|
|
274
274
|
#endif
|
|
275
|
+
resolve(accessToken);
|
|
275
276
|
}
|
|
276
277
|
|
|
277
278
|
RCT_EXPORT_METHOD(setWellKnownTileServer:(NSString*)tileServer)
|
|
@@ -2,9 +2,13 @@
|
|
|
2
2
|
|
|
3
3
|
@interface RCT_EXTERN_MODULE(MGLModule, NSObject)
|
|
4
4
|
|
|
5
|
-
RCT_EXTERN_METHOD(setAccessToken:)
|
|
5
|
+
RCT_EXTERN_METHOD(setAccessToken:(NSString *)accessToken resolver:(RCTPromiseResolveBlock)resolve rejecter:(RCTPromiseRejectBlock)reject)
|
|
6
6
|
|
|
7
7
|
RCT_EXTERN_METHOD(addCustomHeader:(NSString *)headerName forHeaderValue:(NSString *) headerValue)
|
|
8
8
|
RCT_EXTERN_METHOD(removeCustomHeader:(NSString *)headerName)
|
|
9
9
|
|
|
10
|
+
RCT_EXTERN_METHOD(setTelemetryEnabled:(BOOL)telemetryEnabled)
|
|
11
|
+
RCT_EXTERN_METHOD(setWellKnownTileServer:(NSString *)tileServer)
|
|
12
|
+
|
|
13
|
+
|
|
10
14
|
@end
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import Foundation
|
|
2
2
|
import MapboxMaps
|
|
3
|
+
import MapboxMobileEvents
|
|
3
4
|
|
|
4
5
|
|
|
5
6
|
let DEFAULT_SOURCE_ID = "composite";
|
|
@@ -31,7 +32,11 @@ class MGLModule : NSObject {
|
|
|
31
32
|
"StyleSource":
|
|
32
33
|
["DefaultSourceID": DEFAULT_SOURCE_ID],
|
|
33
34
|
"LineJoin":
|
|
34
|
-
[
|
|
35
|
+
[
|
|
36
|
+
"Bevel": LineJoin.bevel.rawValue,
|
|
37
|
+
"Round": LineJoin.round.rawValue,
|
|
38
|
+
"Miter": LineJoin.miter.rawValue,
|
|
39
|
+
],
|
|
35
40
|
"LocationCallbackName":
|
|
36
41
|
["Update": RCT_MAPBOX_USER_LOCATION_UPDATE],
|
|
37
42
|
"CameraModes":
|
|
@@ -56,7 +61,9 @@ class MGLModule : NSObject {
|
|
|
56
61
|
[
|
|
57
62
|
"Error": RCTMGLOfflineModule.Callbacks.error.rawValue,
|
|
58
63
|
"Progress": RCTMGLOfflineModule.Callbacks.progress.rawValue
|
|
59
|
-
]
|
|
64
|
+
],
|
|
65
|
+
"TileServers":
|
|
66
|
+
["Mapbox": "mapbox"]
|
|
60
67
|
];
|
|
61
68
|
}
|
|
62
69
|
|
|
@@ -65,8 +72,12 @@ class MGLModule : NSObject {
|
|
|
65
72
|
return true
|
|
66
73
|
}
|
|
67
74
|
|
|
68
|
-
@objc func setAccessToken(
|
|
75
|
+
@objc func setAccessToken(
|
|
76
|
+
_ token: String,
|
|
77
|
+
resolver: RCTPromiseResolveBlock,
|
|
78
|
+
rejecter: RCTPromiseRejectBlock) {
|
|
69
79
|
MGLModule.accessToken = token
|
|
80
|
+
resolver(token)
|
|
70
81
|
}
|
|
71
82
|
|
|
72
83
|
@objc func addCustomHeader(_ headerName: String, forHeaderValue headerValue: String ) {
|
|
@@ -76,4 +87,14 @@ class MGLModule : NSObject {
|
|
|
76
87
|
@objc func removeCustomHeader(_ headerName: String) {
|
|
77
88
|
CustomHttpHeaders.shared.customHeaders[headerName] = nil
|
|
78
89
|
}
|
|
90
|
+
|
|
91
|
+
@objc func setTelemetryEnabled(_ telemetryEnabled: Bool) {
|
|
92
|
+
UserDefaults.mme_configuration().mme_isCollectionEnabled = telemetryEnabled
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
@objc func setWellKnownTileServer(_ tileServer: String) {
|
|
96
|
+
if tileServer != "mapbox" {
|
|
97
|
+
Logger.error("setWellKnownTileServer: \(tileServer) should be mapbox")
|
|
98
|
+
}
|
|
99
|
+
}
|
|
79
100
|
}
|
|
@@ -3,8 +3,8 @@ import React from 'react';
|
|
|
3
3
|
import { NativeMethods, processColor } from 'react-native';
|
|
4
4
|
|
|
5
5
|
import { getFilter } from '../utils/filterUtils';
|
|
6
|
+
import { AllLayerStyleProps, FilterExpression } from '../utils/MapboxStyles';
|
|
6
7
|
import { transformStyle } from '../utils/StyleValue';
|
|
7
|
-
import { AllLayerStyleProps, Expression } from '../utils/MapboxStyles';
|
|
8
8
|
|
|
9
9
|
type PropsBase = {
|
|
10
10
|
id: string;
|
|
@@ -14,8 +14,8 @@ type PropsBase = {
|
|
|
14
14
|
aboveLayerID?: string;
|
|
15
15
|
belowLayerID?: string;
|
|
16
16
|
layerIndex?: number;
|
|
17
|
-
filter?:
|
|
18
|
-
style
|
|
17
|
+
filter?: FilterExpression;
|
|
18
|
+
style?: AllLayerStyleProps;
|
|
19
19
|
};
|
|
20
20
|
|
|
21
21
|
class AbstractLayer<
|
|
@@ -52,9 +52,10 @@ class AbstractLayer<
|
|
|
52
52
|
if (styleType === 'color') {
|
|
53
53
|
return processColor;
|
|
54
54
|
}
|
|
55
|
+
return undefined;
|
|
55
56
|
}
|
|
56
57
|
|
|
57
|
-
getStyle(style: AllLayerStyleProps) {
|
|
58
|
+
getStyle(style: AllLayerStyleProps | undefined) {
|
|
58
59
|
return transformStyle(style);
|
|
59
60
|
}
|
|
60
61
|
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { Position } from '@turf/helpers';
|
|
1
2
|
import React, {
|
|
2
3
|
forwardRef,
|
|
3
4
|
memo,
|
|
@@ -7,7 +8,6 @@ import React, {
|
|
|
7
8
|
useRef,
|
|
8
9
|
} from 'react';
|
|
9
10
|
import { NativeModules, requireNativeComponent } from 'react-native';
|
|
10
|
-
import { Position } from '@turf/helpers';
|
|
11
11
|
|
|
12
12
|
import { MapboxGLEvent } from '../types';
|
|
13
13
|
import { makeLatLngBounds, makePoint } from '../utils/geoUtils';
|
|
@@ -234,7 +234,6 @@ export const Camera = memo(
|
|
|
234
234
|
followHeading,
|
|
235
235
|
defaultSettings,
|
|
236
236
|
allowUpdates = true,
|
|
237
|
-
triggerKey,
|
|
238
237
|
onUserTrackingModeChange,
|
|
239
238
|
} = props;
|
|
240
239
|
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { NativeModules, requireNativeComponent } from 'react-native';
|
|
3
|
+
|
|
4
|
+
import { FilterExpression, LineLayerStyleProps } from '../utils/MapboxStyles';
|
|
5
|
+
import { StyleValue } from '../utils/StyleValue';
|
|
6
|
+
|
|
7
|
+
import AbstractLayer from './AbstractLayer';
|
|
8
|
+
|
|
9
|
+
const MapboxGL = NativeModules.MGLModule;
|
|
10
|
+
|
|
11
|
+
export const NATIVE_MODULE_NAME = 'RCTMGLLineLayer';
|
|
12
|
+
|
|
13
|
+
export type Props = {
|
|
14
|
+
/**
|
|
15
|
+
* A string that uniquely identifies the source in the style to which it is added.
|
|
16
|
+
*/
|
|
17
|
+
id: string;
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* The source from which to obtain the data to style.
|
|
21
|
+
* If the source has not yet been added to the current style, the behavior is undefined.
|
|
22
|
+
* Inferred from parent source only if the layer is a direct child to it.
|
|
23
|
+
*/
|
|
24
|
+
sourceID?: string;
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Identifier of the layer within the source identified by the sourceID property from which the receiver obtains the data to style.
|
|
28
|
+
*/
|
|
29
|
+
sourceLayerID?: string;
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Inserts a layer above aboveLayerID.
|
|
33
|
+
*/
|
|
34
|
+
aboveLayerID?: string;
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* Inserts a layer below belowLayerID
|
|
38
|
+
*/
|
|
39
|
+
belowLayerID?: string;
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Inserts a layer at a specified index
|
|
43
|
+
*/
|
|
44
|
+
layerIndex?: number;
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* Filter only the features in the source layer that satisfy a condition that you define
|
|
48
|
+
*/
|
|
49
|
+
filter?: FilterExpression;
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* The minimum zoom level at which the layer gets parsed and appears.
|
|
53
|
+
*/
|
|
54
|
+
minZoomLevel?: number;
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* The maximum zoom level at which the layer gets parsed and appears.
|
|
58
|
+
*/
|
|
59
|
+
maxZoomLevel?: number;
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* Customizable style attributes
|
|
63
|
+
*/
|
|
64
|
+
style?: LineLayerStyleProps;
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
type NativeTypeProps = Omit<Props, 'style'> & {
|
|
68
|
+
reactStyle?: { [key: string]: StyleValue };
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* LineLayer is a style layer that renders one or more stroked polylines on the map.
|
|
73
|
+
*/
|
|
74
|
+
class LineLayer extends AbstractLayer<Props, NativeTypeProps> {
|
|
75
|
+
static defaultProps = {
|
|
76
|
+
sourceID: MapboxGL.StyleSource.DefaultSourceID,
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
render() {
|
|
80
|
+
const props = {
|
|
81
|
+
...this.baseProps,
|
|
82
|
+
sourceLayerID: this.props.sourceLayerID,
|
|
83
|
+
};
|
|
84
|
+
return <RCTMGLLineLayer ref={this.setNativeLayer} {...props} />;
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
const RCTMGLLineLayer =
|
|
89
|
+
requireNativeComponent<NativeTypeProps>(NATIVE_MODULE_NAME);
|
|
90
|
+
|
|
91
|
+
export default LineLayer;
|
package/javascript/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { NativeModules } from 'react-native';
|
|
2
2
|
|
|
3
|
-
import { Camera,
|
|
3
|
+
import { Camera, UserTrackingMode } from './components/Camera';
|
|
4
4
|
import { Atmosphere } from './components/Atmosphere';
|
|
5
5
|
import MapView from './components/MapView';
|
|
6
6
|
import Light from './components/Light';
|
|
@@ -45,7 +45,7 @@ const MapboxGL = { ...NativeModules.MGLModule };
|
|
|
45
45
|
|
|
46
46
|
// static methods
|
|
47
47
|
MapboxGL.requestAndroidLocationPermissions = requestAndroidLocationPermissions;
|
|
48
|
-
MapboxGL.UserTrackingModes =
|
|
48
|
+
MapboxGL.UserTrackingModes = UserTrackingMode;
|
|
49
49
|
|
|
50
50
|
// components
|
|
51
51
|
MapboxGL.MapView = MapView;
|
|
@@ -1,16 +1,11 @@
|
|
|
1
|
-
import {
|
|
2
|
-
Image,
|
|
3
|
-
ImageResolvedAssetSource,
|
|
4
|
-
processColor,
|
|
5
|
-
ProcessedColorValue,
|
|
6
|
-
} from 'react-native';
|
|
1
|
+
import { Image, processColor } from 'react-native';
|
|
7
2
|
|
|
8
|
-
import { getStyleType } from './styleMap';
|
|
9
3
|
import BridgeValue, {
|
|
10
|
-
type StyleValueJSON,
|
|
11
4
|
type RawValueType,
|
|
5
|
+
type StyleValueJSON,
|
|
12
6
|
} from './BridgeValue';
|
|
13
7
|
import { AllLayerStyleProps } from './MapboxStyles';
|
|
8
|
+
import { getStyleType } from './styleMap';
|
|
14
9
|
|
|
15
10
|
export type StyleValue = {
|
|
16
11
|
styletype: string;
|
|
@@ -18,7 +13,7 @@ export type StyleValue = {
|
|
|
18
13
|
};
|
|
19
14
|
|
|
20
15
|
export function transformStyle(
|
|
21
|
-
style: AllLayerStyleProps,
|
|
16
|
+
style: AllLayerStyleProps | undefined,
|
|
22
17
|
): undefined | { [key: string]: StyleValue } {
|
|
23
18
|
if (!style) {
|
|
24
19
|
return;
|
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = exports.AnimatedCoordinatesArray = void 0;
|
|
7
|
+
var _reactNative = require("react-native");
|
|
8
|
+
// see
|
|
9
|
+
// https://github.com/facebook/react-native/blob/master/Libraries/Animated/src/nodes/AnimatedWithChildren.js
|
|
10
|
+
const AnimatedWithChildren = Object.getPrototypeOf(_reactNative.Animated.ValueXY);
|
|
11
|
+
if (__DEV__) {
|
|
12
|
+
if (AnimatedWithChildren.name !== 'AnimatedWithChildren') {
|
|
13
|
+
console.error('AnimatedCoordinatesArray could not obtain AnimatedWithChildren base class');
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
const defaultConfig = {
|
|
17
|
+
useNativeDriver: false
|
|
18
|
+
};
|
|
19
|
+
class AnimatedCoordinatesArray extends AnimatedWithChildren {
|
|
20
|
+
constructor() {
|
|
21
|
+
super();
|
|
22
|
+
this.state = this.onInitialState(...arguments);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Subclasses can override to calculate initial state
|
|
27
|
+
*
|
|
28
|
+
* @param {*} args - to value from animate
|
|
29
|
+
* @returns {object} - the state object
|
|
30
|
+
*/
|
|
31
|
+
onInitialState(coordinatesArray) {
|
|
32
|
+
return {
|
|
33
|
+
coords: coordinatesArray.map(coord => [coord[0], coord[1]])
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Subclasses can override getValue to calculate value from state.
|
|
39
|
+
* Value is typically coordinates array, but can be anything
|
|
40
|
+
*
|
|
41
|
+
* @param {object} state - either state from initialState and/or from calculate
|
|
42
|
+
* @returns {object}
|
|
43
|
+
*/
|
|
44
|
+
onGetValue(state) {
|
|
45
|
+
return state.coords;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* Calculates state based on startingState and progress, returns a new state
|
|
50
|
+
*
|
|
51
|
+
* @param {object} state - state object from initialState and/or from calculate
|
|
52
|
+
* @param {number} progress - value between 0 and 1
|
|
53
|
+
* @returns {object} next state
|
|
54
|
+
*/
|
|
55
|
+
onCalculate(state, progress) {
|
|
56
|
+
const {
|
|
57
|
+
coords,
|
|
58
|
+
targetCoords
|
|
59
|
+
} = state;
|
|
60
|
+
const newF = progress;
|
|
61
|
+
const origF = 1.0 - newF;
|
|
62
|
+
|
|
63
|
+
// common
|
|
64
|
+
const commonLen = Math.min(coords.length, targetCoords.length);
|
|
65
|
+
const common = coords.slice(0, commonLen).map((origCoord, i) => [origCoord[0] * origF + targetCoords[i][0] * newF, origCoord[1] * origF + targetCoords[i][1] * newF]);
|
|
66
|
+
if (targetCoords.length > coords.length) {
|
|
67
|
+
// only in new (adding)
|
|
68
|
+
const addingOrig = coords.length > 0 ? coords[coords.length - 1] : targetCoords[0];
|
|
69
|
+
const adding = targetCoords.slice(commonLen, targetCoords.length).map(newCoord => [addingOrig[0] * origF + newCoord[0] * newF, addingOrig[1] * origF + newCoord[1] * newF]);
|
|
70
|
+
return {
|
|
71
|
+
coords: [...common, ...adding],
|
|
72
|
+
targetCoords
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
if (coords.length > targetCoords.length) {
|
|
76
|
+
// only in orig (dissapearing)
|
|
77
|
+
const dissapearingNew = targetCoords.length > 0 ? targetCoords[targetCoords.length - 1] : coords[0];
|
|
78
|
+
const dissapearing = coords.slice(commonLen, coords.length).map(origCoord => [origCoord[0] * origF + dissapearingNew[0] * newF, origCoord[1] * origF + dissapearingNew[1] * newF]);
|
|
79
|
+
return {
|
|
80
|
+
coords: [...common, ...dissapearing],
|
|
81
|
+
targetCoords
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
return {
|
|
85
|
+
coords: common,
|
|
86
|
+
targetCoords
|
|
87
|
+
};
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
/**
|
|
91
|
+
* Subclasses can override to start a new animation
|
|
92
|
+
*
|
|
93
|
+
* @param {*} toValue - to value from animate
|
|
94
|
+
* @param {*} actCoords - the current coordinates array to start from
|
|
95
|
+
* @returns {object} The state
|
|
96
|
+
*/
|
|
97
|
+
onStart(state, toValue) {
|
|
98
|
+
const targetCoords = toValue.map(coord => [coord[0], coord[1]]);
|
|
99
|
+
return {
|
|
100
|
+
...state,
|
|
101
|
+
targetCoords
|
|
102
|
+
};
|
|
103
|
+
}
|
|
104
|
+
animate(progressValue, progressAnimation, config) {
|
|
105
|
+
const {
|
|
106
|
+
toValue
|
|
107
|
+
} = config;
|
|
108
|
+
const onAnimationStart = animation => {
|
|
109
|
+
if (this.animation) {
|
|
110
|
+
// there was a started but not finsihed animation
|
|
111
|
+
const actProgress = this.progressValue.__getValue();
|
|
112
|
+
this.animation.stop();
|
|
113
|
+
this.state = this.onCalculate(this.state, actProgress);
|
|
114
|
+
this.progressValue.__removeChild(this);
|
|
115
|
+
this.progressValue = null;
|
|
116
|
+
this.animation = null;
|
|
117
|
+
}
|
|
118
|
+
this.progressValue = progressValue;
|
|
119
|
+
this.progressValue.__addChild(this);
|
|
120
|
+
this.animation = animation;
|
|
121
|
+
this.state = this.onStart(this.state, toValue);
|
|
122
|
+
};
|
|
123
|
+
const origAnimationStart = progressAnimation.start;
|
|
124
|
+
const newAnimation = progressAnimation;
|
|
125
|
+
newAnimation.start = function start() {
|
|
126
|
+
onAnimationStart(progressAnimation);
|
|
127
|
+
origAnimationStart(...arguments);
|
|
128
|
+
};
|
|
129
|
+
return newAnimation;
|
|
130
|
+
}
|
|
131
|
+
timing(config) {
|
|
132
|
+
const progressValue = new _reactNative.Animated.Value(0.0);
|
|
133
|
+
return this.animate(progressValue, _reactNative.Animated.timing(progressValue, {
|
|
134
|
+
...defaultConfig,
|
|
135
|
+
...config,
|
|
136
|
+
toValue: 1.0
|
|
137
|
+
}), config);
|
|
138
|
+
}
|
|
139
|
+
spring(config) {
|
|
140
|
+
const progressValue = new _reactNative.Animated.Value(0.0);
|
|
141
|
+
return this.animate(progressValue, _reactNative.Animated.spring(progressValue, {
|
|
142
|
+
...defaultConfig,
|
|
143
|
+
...config,
|
|
144
|
+
toValue: 1.0
|
|
145
|
+
}), config);
|
|
146
|
+
}
|
|
147
|
+
decay(config) {
|
|
148
|
+
const progressValue = new _reactNative.Animated.Value(0.0);
|
|
149
|
+
return this.animate(progressValue, _reactNative.Animated.decay(this.progressValue, {
|
|
150
|
+
...defaultConfig,
|
|
151
|
+
...config,
|
|
152
|
+
toValue: 1.0
|
|
153
|
+
}), config);
|
|
154
|
+
}
|
|
155
|
+
__getValue() {
|
|
156
|
+
if (!this.progressValue) {
|
|
157
|
+
return this.onGetValue(this.state);
|
|
158
|
+
}
|
|
159
|
+
return this.onGetValue(this.onCalculate(this.state, this.progressValue.__getValue()));
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
exports.AnimatedCoordinatesArray = AnimatedCoordinatesArray;
|
|
163
|
+
var _default = AnimatedCoordinatesArray;
|
|
164
|
+
exports.default = _default;
|
|
165
|
+
//# sourceMappingURL=AnimatedCoordinatesArray.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["AnimatedWithChildren","Object","getPrototypeOf","Animated","ValueXY","__DEV__","name","console","error","defaultConfig","useNativeDriver","AnimatedCoordinatesArray","constructor","state","onInitialState","coordinatesArray","coords","map","coord","onGetValue","onCalculate","progress","targetCoords","newF","origF","commonLen","Math","min","length","common","slice","origCoord","i","addingOrig","adding","newCoord","dissapearingNew","dissapearing","onStart","toValue","animate","progressValue","progressAnimation","config","onAnimationStart","animation","actProgress","__getValue","stop","__removeChild","__addChild","origAnimationStart","start","newAnimation","timing","Value","spring","decay"],"sourceRoot":"../../javascript","sources":["AnimatedCoordinatesArray.js"],"mappings":";;;;;;AAAA;AAEA;AACA;AACA,MAAMA,oBAAoB,GAAGC,MAAM,CAACC,cAAc,CAAC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