@maplibre/maplibre-react-native 10.0.0-beta.2 → 10.0.0-beta.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +12 -56
- package/android/build.gradle +120 -50
- package/android/gradle.properties +15 -0
- package/android/src/main/AndroidManifest.xml +4 -2
- package/android/src/main/AndroidManifestNew.xml +5 -0
- package/android/src/main/java/org/maplibre/reactnative/MLRNPackage.java +0 -5
- package/android/src/main/java/org/maplibre/reactnative/components/camera/MLRNCamera.java +37 -48
- package/android/src/main/java/org/maplibre/reactnative/components/location/LocationComponentManager.java +16 -9
- package/android/src/main/java/org/maplibre/reactnative/components/mapview/MLRNMapView.java +11 -13
- package/android/src/main/java/org/maplibre/reactnative/components/mapview/MLRNMapViewManager.java +4 -11
- package/android/src/main/java/org/maplibre/reactnative/components/styles/MLRNStyle.java +1 -4
- package/android/src/main/java/org/maplibre/reactnative/components/styles/MLRNStyleFactory.java +10 -11
- package/android/src/main/java/org/maplibre/reactnative/components/styles/sources/MLRNShapeSource.java +0 -66
- package/android/src/main/java/org/maplibre/reactnative/components/styles/sources/MLRNShapeSourceManager.java +0 -28
- package/android/src/main/java/org/maplibre/reactnative/location/LocationManager.java +7 -11
- package/android/src/main/java/org/maplibre/reactnative/location/engine/DefaultLocationEngineProvider.java +18 -0
- package/android/src/main/java/org/maplibre/reactnative/location/engine/LocationEngineProvidable.java +9 -0
- package/android/src/main/java/org/maplibre/reactnative/modules/MLRNModule.java +27 -148
- package/android/src/main/java/org/maplibre/reactnative/modules/MLRNOfflineModule.java +1 -3
- package/android/src/main/java/org/maplibre/reactnative/utils/GeoJSONUtils.java +123 -18
- package/android/src/main/location-engine-default/org/maplibre/reactnative/location/engine/LocationEngineProvider.java +12 -0
- package/android/src/main/location-engine-google/org/maplibre/reactnative/location/engine/GoogleLocationEngineImpl.java +151 -0
- package/android/src/main/location-engine-google/org/maplibre/reactnative/location/engine/GoogleLocationEngineProvider.java +24 -0
- package/android/src/main/location-engine-google/org/maplibre/reactnative/location/engine/LocationEngineProvider.java +12 -0
- package/app.plugin.js +1 -1
- package/ios/MLRN/MLRNBackgroundLayer.h +0 -1
- package/ios/MLRN/MLRNCamera.m +6 -7
- package/ios/MLRN/MLRNFillExtrusionLayer.h +0 -1
- package/ios/MLRN/MLRNFillLayer.h +0 -1
- package/ios/MLRN/MLRNFillLayer.m +1 -0
- package/ios/MLRN/MLRNLineLayer.h +0 -1
- package/ios/MLRN/MLRNMapView.h +1 -1
- package/ios/MLRN/MLRNMapView.m +7 -7
- package/ios/MLRN/MLRNMapViewManager.m +1 -1
- package/ios/MLRN/MLRNModule.m +8 -139
- package/ios/MLRN/MLRNRasterLayer.h +0 -1
- package/ios/MLRN/MLRNShapeSource.h +0 -11
- package/ios/MLRN/MLRNShapeSource.m +0 -38
- package/ios/MLRN/MLRNShapeSourceManager.m +0 -68
- package/ios/MLRN/MLRNStyle.m +0 -40
- package/ios/MLRN/MLRNSymbolLayer.h +1 -7
- package/ios/MLRN/MLRNSymbolLayer.m +1 -89
- package/ios/MLRN/MLRNSymbolLayerManager.m +0 -1
- package/lib/commonjs/MLRNModule.js +7 -5
- package/lib/commonjs/MLRNModule.js.map +1 -1
- package/lib/commonjs/MapLibreRN.js +74 -68
- package/lib/commonjs/MapLibreRN.js.map +1 -1
- package/lib/commonjs/components/Annotation.js +7 -9
- package/lib/commonjs/components/Annotation.js.map +1 -1
- package/lib/commonjs/components/BackgroundLayer.js +6 -8
- package/lib/commonjs/components/BackgroundLayer.js.map +1 -1
- package/lib/commonjs/components/Callout.js +2 -2
- package/lib/commonjs/components/Callout.js.map +1 -1
- package/lib/commonjs/components/Camera.js +111 -63
- package/lib/commonjs/components/Camera.js.map +1 -1
- package/lib/commonjs/components/CircleLayer.js +6 -8
- package/lib/commonjs/components/CircleLayer.js.map +1 -1
- package/lib/commonjs/components/FillExtrusionLayer.js +6 -8
- package/lib/commonjs/components/FillExtrusionLayer.js.map +1 -1
- package/lib/commonjs/components/FillLayer.js +6 -8
- package/lib/commonjs/components/FillLayer.js.map +1 -1
- package/lib/commonjs/components/HeadingIndicator.js +4 -4
- package/lib/commonjs/components/HeadingIndicator.js.map +1 -1
- package/lib/commonjs/components/HeatmapLayer.js +6 -8
- package/lib/commonjs/components/HeatmapLayer.js.map +1 -1
- package/lib/commonjs/components/ImageSource.js +4 -5
- package/lib/commonjs/components/ImageSource.js.map +1 -1
- package/lib/commonjs/components/Images.js +3 -7
- package/lib/commonjs/components/Images.js.map +1 -1
- package/lib/commonjs/components/Light.js +4 -6
- package/lib/commonjs/components/Light.js.map +1 -1
- package/lib/commonjs/components/LineLayer.js +6 -8
- package/lib/commonjs/components/LineLayer.js.map +1 -1
- package/lib/commonjs/components/MapView.js +69 -83
- package/lib/commonjs/components/MapView.js.map +1 -1
- package/lib/commonjs/components/MarkerView.js +4 -5
- package/lib/commonjs/components/MarkerView.js.map +1 -1
- package/lib/commonjs/components/NativeUserLocation.js +2 -2
- package/lib/commonjs/components/NativeUserLocation.js.map +1 -1
- package/lib/commonjs/components/PointAnnotation.js +7 -10
- package/lib/commonjs/components/PointAnnotation.js.map +1 -1
- package/lib/commonjs/components/RasterLayer.js +6 -8
- package/lib/commonjs/components/RasterLayer.js.map +1 -1
- package/lib/commonjs/components/RasterSource.js +8 -10
- package/lib/commonjs/components/RasterSource.js.map +1 -1
- package/lib/commonjs/components/ShapeSource.js +11 -45
- package/lib/commonjs/components/ShapeSource.js.map +1 -1
- package/lib/commonjs/components/SymbolLayer.js +8 -24
- package/lib/commonjs/components/SymbolLayer.js.map +1 -1
- package/lib/commonjs/components/UserLocation.js +21 -23
- package/lib/commonjs/components/UserLocation.js.map +1 -1
- package/lib/commonjs/components/VectorSource.js +9 -21
- package/lib/commonjs/components/VectorSource.js.map +1 -1
- package/lib/commonjs/hooks/useAbstractLayer.js +1 -1
- package/lib/commonjs/hooks/useAbstractLayer.js.map +1 -1
- package/lib/commonjs/hooks/useAbstractSource.js +1 -1
- package/lib/commonjs/hooks/useAbstractSource.js.map +1 -1
- package/lib/commonjs/hooks/useNativeBridge.js +2 -2
- package/lib/commonjs/hooks/useNativeBridge.js.map +1 -1
- package/lib/commonjs/hooks/useOnce.js +2 -2
- package/lib/commonjs/hooks/useOnce.js.map +1 -1
- package/lib/commonjs/index.js +3 -0
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/modules/location/{locationManager.js → LocationManager.js} +10 -10
- package/lib/commonjs/modules/location/LocationManager.js.map +1 -0
- package/lib/commonjs/modules/offline/OfflineCreatePackOptions.js +2 -2
- package/lib/commonjs/modules/offline/OfflineCreatePackOptions.js.map +1 -1
- package/lib/commonjs/modules/offline/{offlineManager.js → OfflineManager.js} +34 -36
- package/lib/commonjs/modules/offline/OfflineManager.js.map +1 -0
- package/lib/commonjs/modules/offline/OfflinePack.js +2 -2
- package/lib/commonjs/modules/offline/OfflinePack.js.map +1 -1
- package/lib/commonjs/modules/snapshot/{snapshotManager.js → SnapshotManager.js} +12 -14
- package/lib/commonjs/modules/snapshot/SnapshotManager.js.map +1 -0
- package/lib/commonjs/modules/snapshot/SnapshotOptions.js +3 -4
- package/lib/commonjs/modules/snapshot/SnapshotOptions.js.map +1 -1
- package/lib/commonjs/plugin/MapLibrePluginProps.js +2 -0
- package/lib/commonjs/plugin/MapLibrePluginProps.js.map +1 -0
- package/lib/commonjs/plugin/android.js +41 -0
- package/lib/commonjs/plugin/android.js.map +1 -0
- package/lib/commonjs/plugin/ios.js +131 -0
- package/lib/commonjs/plugin/ios.js.map +1 -0
- package/lib/commonjs/plugin/withMapLibre.js +31 -0
- package/lib/commonjs/plugin/withMapLibre.js.map +1 -0
- package/lib/commonjs/types/MapLibreRNStyles.js +6 -0
- package/lib/commonjs/types/MapLibreRNStyles.js.map +1 -0
- package/lib/commonjs/utils/BridgeValue.js +2 -2
- package/lib/commonjs/utils/BridgeValue.js.map +1 -1
- package/lib/commonjs/utils/Logger.js +2 -2
- package/lib/commonjs/utils/Logger.js.map +1 -1
- package/lib/commonjs/utils/StyleValue.js +4 -5
- package/lib/commonjs/utils/StyleValue.js.map +1 -1
- package/lib/commonjs/utils/animated/AbstractAnimatedCoordinates.js +2 -2
- package/lib/commonjs/utils/animated/AbstractAnimatedCoordinates.js.map +1 -1
- package/lib/commonjs/utils/animated/Animated.js +29 -31
- package/lib/commonjs/utils/animated/Animated.js.map +1 -1
- package/lib/commonjs/utils/animated/AnimatedCoordinatesArray.js +4 -5
- package/lib/commonjs/utils/animated/AnimatedCoordinatesArray.js.map +1 -1
- package/lib/commonjs/utils/animated/AnimatedExtractCoordinateFromArray.js +2 -2
- package/lib/commonjs/utils/animated/AnimatedExtractCoordinateFromArray.js.map +1 -1
- package/lib/commonjs/utils/animated/AnimatedPoint.js +1 -2
- package/lib/commonjs/utils/animated/AnimatedPoint.js.map +1 -1
- package/lib/commonjs/utils/animated/AnimatedRouteCoordinatesArray.js +4 -4
- package/lib/commonjs/utils/animated/AnimatedRouteCoordinatesArray.js.map +1 -1
- package/lib/commonjs/utils/animated/AnimatedShape.js +2 -2
- package/lib/commonjs/utils/animated/AnimatedShape.js.map +1 -1
- package/lib/commonjs/utils/getStylePropertyType.js +252 -0
- package/lib/commonjs/utils/getStylePropertyType.js.map +1 -0
- package/lib/module/MLRNModule.js +3 -2
- package/lib/module/MLRNModule.js.map +1 -1
- package/lib/module/MapLibreRN.js +40 -32
- package/lib/module/MapLibreRN.js.map +1 -1
- package/lib/module/components/Annotation.js +5 -6
- package/lib/module/components/Annotation.js.map +1 -1
- package/lib/module/components/BackgroundLayer.js +4 -6
- package/lib/module/components/BackgroundLayer.js.map +1 -1
- package/lib/module/components/Callout.js +2 -3
- package/lib/module/components/Callout.js.map +1 -1
- package/lib/module/components/Camera.js +112 -64
- package/lib/module/components/Camera.js.map +1 -1
- package/lib/module/components/CircleLayer.js +4 -6
- package/lib/module/components/CircleLayer.js.map +1 -1
- package/lib/module/components/FillExtrusionLayer.js +4 -6
- package/lib/module/components/FillExtrusionLayer.js.map +1 -1
- package/lib/module/components/FillLayer.js +4 -6
- package/lib/module/components/FillLayer.js.map +1 -1
- package/lib/module/components/HeadingIndicator.js +2 -3
- package/lib/module/components/HeadingIndicator.js.map +1 -1
- package/lib/module/components/HeatmapLayer.js +4 -6
- package/lib/module/components/HeatmapLayer.js.map +1 -1
- package/lib/module/components/ImageSource.js +2 -3
- package/lib/module/components/ImageSource.js.map +1 -1
- package/lib/module/components/Images.js +3 -8
- package/lib/module/components/Images.js.map +1 -1
- package/lib/module/components/Light.js +2 -4
- package/lib/module/components/Light.js.map +1 -1
- package/lib/module/components/LineLayer.js +4 -6
- package/lib/module/components/LineLayer.js.map +1 -1
- package/lib/module/components/MapView.js +65 -79
- package/lib/module/components/MapView.js.map +1 -1
- package/lib/module/components/MarkerView.js +2 -3
- package/lib/module/components/MarkerView.js.map +1 -1
- package/lib/module/components/NativeUserLocation.js +1 -2
- package/lib/module/components/NativeUserLocation.js.map +1 -1
- package/lib/module/components/PointAnnotation.js +5 -7
- package/lib/module/components/PointAnnotation.js.map +1 -1
- package/lib/module/components/RasterLayer.js +4 -6
- package/lib/module/components/RasterLayer.js.map +1 -1
- package/lib/module/components/RasterSource.js +5 -7
- package/lib/module/components/RasterSource.js.map +1 -1
- package/lib/module/components/ShapeSource.js +9 -42
- package/lib/module/components/ShapeSource.js.map +1 -1
- package/lib/module/components/SymbolLayer.js +7 -23
- package/lib/module/components/SymbolLayer.js.map +1 -1
- package/lib/module/components/UserLocation.js +14 -15
- package/lib/module/components/UserLocation.js.map +1 -1
- package/lib/module/components/VectorSource.js +6 -17
- package/lib/module/components/VectorSource.js.map +1 -1
- package/lib/module/hooks/useAbstractLayer.js +1 -1
- package/lib/module/hooks/useAbstractLayer.js.map +1 -1
- package/lib/module/hooks/useAbstractSource.js +1 -1
- package/lib/module/hooks/useAbstractSource.js.map +1 -1
- package/lib/module/hooks/useNativeBridge.js +1 -2
- package/lib/module/hooks/useNativeBridge.js.map +1 -1
- package/lib/module/hooks/useNativeRef.js.map +1 -1
- package/lib/module/hooks/useOnce.js +1 -2
- package/lib/module/hooks/useOnce.js.map +1 -1
- package/lib/module/index.js +4 -0
- package/lib/module/index.js.map +1 -1
- package/lib/module/modules/location/{locationManager.js → LocationManager.js} +10 -9
- package/lib/module/modules/location/LocationManager.js.map +1 -0
- package/lib/module/modules/offline/OfflineCreatePackOptions.js +1 -2
- package/lib/module/modules/offline/OfflineCreatePackOptions.js.map +1 -1
- package/lib/module/modules/offline/{offlineManager.js → OfflineManager.js} +30 -30
- package/lib/module/modules/offline/OfflineManager.js.map +1 -0
- package/lib/module/modules/offline/OfflinePack.js +1 -2
- package/lib/module/modules/offline/OfflinePack.js.map +1 -1
- package/lib/module/modules/snapshot/{snapshotManager.js → SnapshotManager.js} +10 -10
- package/lib/module/modules/snapshot/{snapshotManager.js.map → SnapshotManager.js.map} +1 -1
- package/lib/module/modules/snapshot/SnapshotOptions.js +2 -3
- package/lib/module/modules/snapshot/SnapshotOptions.js.map +1 -1
- package/lib/module/plugin/MapLibrePluginProps.js +2 -0
- package/lib/module/plugin/MapLibrePluginProps.js.map +1 -0
- package/lib/module/plugin/android.js +34 -0
- package/lib/module/plugin/android.js.map +1 -0
- package/lib/module/plugin/ios.js +123 -0
- package/lib/module/plugin/ios.js.map +1 -0
- package/lib/module/plugin/withMapLibre.js +27 -0
- package/lib/module/plugin/withMapLibre.js.map +1 -0
- package/lib/module/types/MapLibreRNStyles.js +4 -0
- package/lib/module/types/MapLibreRNStyles.js.map +1 -0
- package/lib/module/utils/BridgeValue.js +1 -1
- package/lib/module/utils/BridgeValue.js.map +1 -1
- package/lib/module/utils/Logger.js +1 -2
- package/lib/module/utils/Logger.js.map +1 -1
- package/lib/module/utils/StyleValue.js +3 -3
- package/lib/module/utils/StyleValue.js.map +1 -1
- package/lib/module/utils/animated/AbstractAnimatedCoordinates.js +1 -2
- package/lib/module/utils/animated/AbstractAnimatedCoordinates.js.map +1 -1
- package/lib/module/utils/animated/Animated.js +14 -15
- package/lib/module/utils/animated/Animated.js.map +1 -1
- package/lib/module/utils/animated/AnimatedCoordinatesArray.js +2 -3
- package/lib/module/utils/animated/AnimatedCoordinatesArray.js.map +1 -1
- package/lib/module/utils/animated/AnimatedExtractCoordinateFromArray.js +1 -1
- package/lib/module/utils/animated/AnimatedExtractCoordinateFromArray.js.map +1 -1
- package/lib/module/utils/animated/AnimatedPoint.js +0 -1
- package/lib/module/utils/animated/AnimatedPoint.js.map +1 -1
- package/lib/module/utils/animated/AnimatedRouteCoordinatesArray.js +2 -2
- package/lib/module/utils/animated/AnimatedRouteCoordinatesArray.js.map +1 -1
- package/lib/module/utils/animated/AnimatedShape.js +1 -2
- package/lib/module/utils/animated/AnimatedShape.js.map +1 -1
- package/lib/module/utils/getStylePropertyType.js +248 -0
- package/lib/module/utils/getStylePropertyType.js.map +1 -0
- package/lib/typescript/commonjs/src/MLRNModule.d.ts +3 -7
- package/lib/typescript/commonjs/src/MLRNModule.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/MapLibreRN.d.ts +44 -34
- package/lib/typescript/commonjs/src/MapLibreRN.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/components/Annotation.d.ts +6 -6
- package/lib/typescript/commonjs/src/components/Annotation.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/components/BackgroundLayer.d.ts +3 -5
- package/lib/typescript/commonjs/src/components/BackgroundLayer.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/components/Callout.d.ts +3 -4
- package/lib/typescript/commonjs/src/components/Callout.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/components/Camera.d.ts +4 -4
- package/lib/typescript/commonjs/src/components/Camera.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/components/CircleLayer.d.ts +3 -5
- package/lib/typescript/commonjs/src/components/CircleLayer.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/components/FillExtrusionLayer.d.ts +3 -5
- package/lib/typescript/commonjs/src/components/FillExtrusionLayer.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/components/FillLayer.d.ts +3 -5
- package/lib/typescript/commonjs/src/components/FillLayer.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/components/HeadingIndicator.d.ts +2 -3
- package/lib/typescript/commonjs/src/components/HeadingIndicator.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/components/HeatmapLayer.d.ts +3 -5
- package/lib/typescript/commonjs/src/components/HeatmapLayer.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/components/ImageSource.d.ts +3 -4
- package/lib/typescript/commonjs/src/components/ImageSource.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/components/Images.d.ts +5 -5
- package/lib/typescript/commonjs/src/components/Images.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/components/Light.d.ts +4 -5
- package/lib/typescript/commonjs/src/components/Light.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/components/LineLayer.d.ts +3 -5
- package/lib/typescript/commonjs/src/components/LineLayer.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/components/MapView.d.ts +12 -16
- package/lib/typescript/commonjs/src/components/MapView.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/components/MarkerView.d.ts +3 -3
- package/lib/typescript/commonjs/src/components/MarkerView.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/components/NativeUserLocation.d.ts +2 -3
- package/lib/typescript/commonjs/src/components/NativeUserLocation.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/components/PointAnnotation.d.ts +7 -8
- package/lib/typescript/commonjs/src/components/PointAnnotation.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/components/RasterLayer.d.ts +3 -5
- package/lib/typescript/commonjs/src/components/RasterLayer.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/components/RasterSource.d.ts +4 -4
- package/lib/typescript/commonjs/src/components/RasterSource.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/components/ShapeSource.d.ts +8 -16
- package/lib/typescript/commonjs/src/components/ShapeSource.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/components/SymbolLayer.d.ts +3 -10
- package/lib/typescript/commonjs/src/components/SymbolLayer.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/components/UserLocation.d.ts +6 -6
- package/lib/typescript/commonjs/src/components/UserLocation.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/components/VectorSource.d.ts +4 -8
- package/lib/typescript/commonjs/src/components/VectorSource.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/hooks/useAbstractLayer.d.ts +5 -4
- package/lib/typescript/commonjs/src/hooks/useAbstractLayer.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/hooks/useAbstractSource.d.ts +4 -3
- package/lib/typescript/commonjs/src/hooks/useAbstractSource.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/hooks/useNativeBridge.d.ts +5 -5
- package/lib/typescript/commonjs/src/hooks/useNativeBridge.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/hooks/useNativeRef.d.ts +2 -2
- package/lib/typescript/commonjs/src/hooks/useNativeRef.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/hooks/useOnce.d.ts +1 -2
- package/lib/typescript/commonjs/src/hooks/useOnce.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/index.d.ts +3 -0
- package/lib/typescript/commonjs/src/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/location/LocationManager.d.ts +33 -0
- package/lib/typescript/commonjs/src/modules/location/LocationManager.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/modules/offline/OfflineCreatePackOptions.d.ts +1 -2
- package/lib/typescript/commonjs/src/modules/offline/OfflineCreatePackOptions.d.ts.map +1 -1
- package/lib/typescript/{module/src/modules/offline/offlineManager.d.ts → commonjs/src/modules/offline/OfflineManager.d.ts} +27 -37
- package/lib/typescript/commonjs/src/modules/offline/OfflineManager.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/modules/offline/OfflinePack.d.ts +3 -4
- package/lib/typescript/commonjs/src/modules/offline/OfflinePack.d.ts.map +1 -1
- package/lib/typescript/{module/src/modules/snapshot/snapshotManager.d.ts → commonjs/src/modules/snapshot/SnapshotManager.d.ts} +9 -9
- package/lib/typescript/commonjs/src/modules/snapshot/SnapshotManager.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/modules/snapshot/SnapshotOptions.d.ts +1 -1
- package/lib/typescript/commonjs/src/modules/snapshot/SnapshotOptions.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/plugin/MapLibrePluginProps.d.ts +77 -0
- package/lib/typescript/commonjs/src/plugin/MapLibrePluginProps.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/plugin/android.d.ts +16 -0
- package/lib/typescript/commonjs/src/plugin/android.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/plugin/ios.d.ts +17 -0
- package/lib/typescript/commonjs/src/plugin/ios.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/plugin/withMapLibre.d.ts +5 -0
- package/lib/typescript/commonjs/src/plugin/withMapLibre.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/types/MapLibreRNStyles.d.ts +960 -0
- package/lib/typescript/commonjs/src/types/MapLibreRNStyles.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/utils/BridgeValue.d.ts +1 -1
- package/lib/typescript/commonjs/src/utils/BridgeValue.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/utils/Logger.d.ts +2 -2
- package/lib/typescript/commonjs/src/utils/Logger.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/utils/StyleValue.d.ts +2 -2
- package/lib/typescript/commonjs/src/utils/StyleValue.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/utils/animated/AbstractAnimatedCoordinates.d.ts +2 -2
- package/lib/typescript/commonjs/src/utils/animated/AbstractAnimatedCoordinates.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/utils/animated/Animated.d.ts +19 -19
- package/lib/typescript/commonjs/src/utils/animated/Animated.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/utils/animated/AnimatedCoordinatesArray.d.ts +3 -3
- package/lib/typescript/commonjs/src/utils/animated/AnimatedCoordinatesArray.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/utils/animated/AnimatedExtractCoordinateFromArray.d.ts +1 -1
- package/lib/typescript/commonjs/src/utils/animated/AnimatedExtractCoordinateFromArray.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/utils/animated/AnimatedPoint.d.ts +1 -1
- package/lib/typescript/commonjs/src/utils/animated/AnimatedPoint.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/utils/animated/AnimatedRouteCoordinatesArray.d.ts +2 -2
- package/lib/typescript/commonjs/src/utils/animated/AnimatedRouteCoordinatesArray.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/utils/animated/AnimatedShape.d.ts +5 -5
- package/lib/typescript/commonjs/src/utils/animated/AnimatedShape.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/utils/filterUtils.d.ts +1 -1
- package/lib/typescript/commonjs/src/utils/filterUtils.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/utils/getStylePropertyType.d.ts +35 -0
- package/lib/typescript/commonjs/src/utils/getStylePropertyType.d.ts.map +1 -0
- package/lib/typescript/module/src/MLRNModule.d.ts +3 -7
- package/lib/typescript/module/src/MLRNModule.d.ts.map +1 -1
- package/lib/typescript/module/src/MapLibreRN.d.ts +44 -34
- package/lib/typescript/module/src/MapLibreRN.d.ts.map +1 -1
- package/lib/typescript/module/src/components/Annotation.d.ts +6 -6
- package/lib/typescript/module/src/components/Annotation.d.ts.map +1 -1
- package/lib/typescript/module/src/components/BackgroundLayer.d.ts +3 -5
- package/lib/typescript/module/src/components/BackgroundLayer.d.ts.map +1 -1
- package/lib/typescript/module/src/components/Callout.d.ts +3 -4
- package/lib/typescript/module/src/components/Callout.d.ts.map +1 -1
- package/lib/typescript/module/src/components/Camera.d.ts +4 -4
- package/lib/typescript/module/src/components/Camera.d.ts.map +1 -1
- package/lib/typescript/module/src/components/CircleLayer.d.ts +3 -5
- package/lib/typescript/module/src/components/CircleLayer.d.ts.map +1 -1
- package/lib/typescript/module/src/components/FillExtrusionLayer.d.ts +3 -5
- package/lib/typescript/module/src/components/FillExtrusionLayer.d.ts.map +1 -1
- package/lib/typescript/module/src/components/FillLayer.d.ts +3 -5
- package/lib/typescript/module/src/components/FillLayer.d.ts.map +1 -1
- package/lib/typescript/module/src/components/HeadingIndicator.d.ts +2 -3
- package/lib/typescript/module/src/components/HeadingIndicator.d.ts.map +1 -1
- package/lib/typescript/module/src/components/HeatmapLayer.d.ts +3 -5
- package/lib/typescript/module/src/components/HeatmapLayer.d.ts.map +1 -1
- package/lib/typescript/module/src/components/ImageSource.d.ts +3 -4
- package/lib/typescript/module/src/components/ImageSource.d.ts.map +1 -1
- package/lib/typescript/module/src/components/Images.d.ts +5 -5
- package/lib/typescript/module/src/components/Images.d.ts.map +1 -1
- package/lib/typescript/module/src/components/Light.d.ts +4 -5
- package/lib/typescript/module/src/components/Light.d.ts.map +1 -1
- package/lib/typescript/module/src/components/LineLayer.d.ts +3 -5
- package/lib/typescript/module/src/components/LineLayer.d.ts.map +1 -1
- package/lib/typescript/module/src/components/MapView.d.ts +12 -16
- package/lib/typescript/module/src/components/MapView.d.ts.map +1 -1
- package/lib/typescript/module/src/components/MarkerView.d.ts +3 -3
- package/lib/typescript/module/src/components/MarkerView.d.ts.map +1 -1
- package/lib/typescript/module/src/components/NativeUserLocation.d.ts +2 -3
- package/lib/typescript/module/src/components/NativeUserLocation.d.ts.map +1 -1
- package/lib/typescript/module/src/components/PointAnnotation.d.ts +7 -8
- package/lib/typescript/module/src/components/PointAnnotation.d.ts.map +1 -1
- package/lib/typescript/module/src/components/RasterLayer.d.ts +3 -5
- package/lib/typescript/module/src/components/RasterLayer.d.ts.map +1 -1
- package/lib/typescript/module/src/components/RasterSource.d.ts +4 -4
- package/lib/typescript/module/src/components/RasterSource.d.ts.map +1 -1
- package/lib/typescript/module/src/components/ShapeSource.d.ts +8 -16
- package/lib/typescript/module/src/components/ShapeSource.d.ts.map +1 -1
- package/lib/typescript/module/src/components/SymbolLayer.d.ts +3 -10
- package/lib/typescript/module/src/components/SymbolLayer.d.ts.map +1 -1
- package/lib/typescript/module/src/components/UserLocation.d.ts +6 -6
- package/lib/typescript/module/src/components/UserLocation.d.ts.map +1 -1
- package/lib/typescript/module/src/components/VectorSource.d.ts +4 -8
- package/lib/typescript/module/src/components/VectorSource.d.ts.map +1 -1
- package/lib/typescript/module/src/hooks/useAbstractLayer.d.ts +5 -4
- package/lib/typescript/module/src/hooks/useAbstractLayer.d.ts.map +1 -1
- package/lib/typescript/module/src/hooks/useAbstractSource.d.ts +4 -3
- package/lib/typescript/module/src/hooks/useAbstractSource.d.ts.map +1 -1
- package/lib/typescript/module/src/hooks/useNativeBridge.d.ts +5 -5
- package/lib/typescript/module/src/hooks/useNativeBridge.d.ts.map +1 -1
- package/lib/typescript/module/src/hooks/useNativeRef.d.ts +2 -2
- package/lib/typescript/module/src/hooks/useNativeRef.d.ts.map +1 -1
- package/lib/typescript/module/src/hooks/useOnce.d.ts +1 -2
- package/lib/typescript/module/src/hooks/useOnce.d.ts.map +1 -1
- package/lib/typescript/module/src/index.d.ts +3 -0
- package/lib/typescript/module/src/index.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/location/LocationManager.d.ts +33 -0
- package/lib/typescript/module/src/modules/location/LocationManager.d.ts.map +1 -0
- package/lib/typescript/module/src/modules/offline/OfflineCreatePackOptions.d.ts +1 -2
- package/lib/typescript/module/src/modules/offline/OfflineCreatePackOptions.d.ts.map +1 -1
- package/lib/typescript/{commonjs/src/modules/offline/offlineManager.d.ts → module/src/modules/offline/OfflineManager.d.ts} +27 -37
- package/lib/typescript/module/src/modules/offline/OfflineManager.d.ts.map +1 -0
- package/lib/typescript/module/src/modules/offline/OfflinePack.d.ts +3 -4
- package/lib/typescript/module/src/modules/offline/OfflinePack.d.ts.map +1 -1
- package/lib/typescript/{commonjs/src/modules/snapshot/snapshotManager.d.ts → module/src/modules/snapshot/SnapshotManager.d.ts} +9 -9
- package/lib/typescript/module/src/modules/snapshot/SnapshotManager.d.ts.map +1 -0
- package/lib/typescript/module/src/modules/snapshot/SnapshotOptions.d.ts +1 -1
- package/lib/typescript/module/src/modules/snapshot/SnapshotOptions.d.ts.map +1 -1
- package/lib/typescript/module/src/plugin/MapLibrePluginProps.d.ts +77 -0
- package/lib/typescript/module/src/plugin/MapLibrePluginProps.d.ts.map +1 -0
- package/lib/typescript/module/src/plugin/android.d.ts +16 -0
- package/lib/typescript/module/src/plugin/android.d.ts.map +1 -0
- package/lib/typescript/module/src/plugin/ios.d.ts +17 -0
- package/lib/typescript/module/src/plugin/ios.d.ts.map +1 -0
- package/lib/typescript/module/src/plugin/withMapLibre.d.ts +5 -0
- package/lib/typescript/module/src/plugin/withMapLibre.d.ts.map +1 -0
- package/lib/typescript/module/src/types/MapLibreRNStyles.d.ts +960 -0
- package/lib/typescript/module/src/types/MapLibreRNStyles.d.ts.map +1 -0
- package/lib/typescript/module/src/utils/BridgeValue.d.ts +1 -1
- package/lib/typescript/module/src/utils/BridgeValue.d.ts.map +1 -1
- package/lib/typescript/module/src/utils/Logger.d.ts +2 -2
- package/lib/typescript/module/src/utils/Logger.d.ts.map +1 -1
- package/lib/typescript/module/src/utils/StyleValue.d.ts +2 -2
- package/lib/typescript/module/src/utils/StyleValue.d.ts.map +1 -1
- package/lib/typescript/module/src/utils/animated/AbstractAnimatedCoordinates.d.ts +2 -2
- package/lib/typescript/module/src/utils/animated/AbstractAnimatedCoordinates.d.ts.map +1 -1
- package/lib/typescript/module/src/utils/animated/Animated.d.ts +19 -19
- package/lib/typescript/module/src/utils/animated/Animated.d.ts.map +1 -1
- package/lib/typescript/module/src/utils/animated/AnimatedCoordinatesArray.d.ts +3 -3
- package/lib/typescript/module/src/utils/animated/AnimatedCoordinatesArray.d.ts.map +1 -1
- package/lib/typescript/module/src/utils/animated/AnimatedExtractCoordinateFromArray.d.ts +1 -1
- package/lib/typescript/module/src/utils/animated/AnimatedExtractCoordinateFromArray.d.ts.map +1 -1
- package/lib/typescript/module/src/utils/animated/AnimatedPoint.d.ts +1 -1
- package/lib/typescript/module/src/utils/animated/AnimatedPoint.d.ts.map +1 -1
- package/lib/typescript/module/src/utils/animated/AnimatedRouteCoordinatesArray.d.ts +2 -2
- package/lib/typescript/module/src/utils/animated/AnimatedRouteCoordinatesArray.d.ts.map +1 -1
- package/lib/typescript/module/src/utils/animated/AnimatedShape.d.ts +5 -5
- package/lib/typescript/module/src/utils/animated/AnimatedShape.d.ts.map +1 -1
- package/lib/typescript/module/src/utils/filterUtils.d.ts +1 -1
- package/lib/typescript/module/src/utils/filterUtils.d.ts.map +1 -1
- package/lib/typescript/module/src/utils/getStylePropertyType.d.ts +35 -0
- package/lib/typescript/module/src/utils/getStylePropertyType.d.ts.map +1 -0
- package/maplibre-react-native.podspec +15 -14
- package/package.json +17 -14
- package/src/MLRNModule.ts +24 -10
- package/src/MapLibreRN.ts +66 -49
- package/src/components/Annotation.tsx +12 -14
- package/src/components/BackgroundLayer.tsx +7 -9
- package/src/components/Callout.tsx +8 -10
- package/src/components/Camera.tsx +154 -78
- package/src/components/CircleLayer.tsx +7 -9
- package/src/components/FillExtrusionLayer.tsx +7 -9
- package/src/components/FillLayer.tsx +7 -9
- package/src/components/HeadingIndicator.tsx +2 -6
- package/src/components/HeatmapLayer.tsx +7 -9
- package/src/components/ImageSource.tsx +4 -6
- package/src/components/Images.tsx +8 -19
- package/src/components/Light.tsx +5 -7
- package/src/components/LineLayer.tsx +7 -9
- package/src/components/MapView.tsx +85 -105
- package/src/components/MarkerView.tsx +4 -6
- package/src/components/NativeUserLocation.tsx +1 -4
- package/src/components/PointAnnotation.tsx +10 -11
- package/src/components/RasterLayer.tsx +7 -9
- package/src/components/RasterSource.tsx +7 -9
- package/src/components/ShapeSource.tsx +22 -95
- package/src/components/SymbolLayer.tsx +12 -41
- package/src/components/UserLocation.tsx +21 -22
- package/src/components/VectorSource.tsx +12 -35
- package/src/hooks/useAbstractLayer.ts +8 -8
- package/src/hooks/useAbstractSource.ts +6 -6
- package/src/hooks/useNativeBridge.ts +9 -6
- package/src/hooks/useNativeRef.ts +2 -2
- package/src/hooks/useOnce.ts +3 -3
- package/src/index.ts +3 -0
- package/src/modules/location/{locationManager.ts → LocationManager.ts} +16 -15
- package/src/modules/offline/OfflineCreatePackOptions.ts +1 -3
- package/src/modules/offline/{offlineManager.ts → OfflineManager.ts} +32 -45
- package/src/modules/offline/OfflinePack.ts +3 -5
- package/src/modules/snapshot/{snapshotManager.ts → SnapshotManager.ts} +9 -9
- package/src/modules/snapshot/SnapshotOptions.ts +2 -4
- package/src/plugin/MapLibrePluginProps.ts +83 -0
- package/src/plugin/android.ts +64 -0
- package/src/plugin/ios.ts +166 -0
- package/src/plugin/withMapLibre.ts +30 -0
- package/src/{utils/MapLibreRNStyles.d.ts → types/MapLibreRNStyles.ts} +86 -406
- package/src/utils/BridgeValue.ts +1 -1
- package/src/utils/Logger.ts +1 -3
- package/src/utils/StyleValue.ts +6 -5
- package/src/utils/animated/AbstractAnimatedCoordinates.ts +3 -3
- package/src/utils/animated/Animated.ts +23 -21
- package/src/utils/animated/AnimatedCoordinatesArray.ts +3 -4
- package/src/utils/animated/AnimatedExtractCoordinateFromArray.ts +1 -1
- package/src/utils/animated/AnimatedPoint.ts +0 -2
- package/src/utils/animated/AnimatedRouteCoordinatesArray.ts +3 -2
- package/src/utils/animated/AnimatedShape.ts +4 -6
- package/src/utils/filterUtils.ts +1 -1
- package/src/utils/getStylePropertyType.ts +265 -0
- package/android/src/main/res/values/strings.xml +0 -3
- package/lib/commonjs/components/Style.js +0 -266
- package/lib/commonjs/components/Style.js.map +0 -1
- package/lib/commonjs/modules/location/locationManager.js.map +0 -1
- package/lib/commonjs/modules/offline/offlineManager.js.map +0 -1
- package/lib/commonjs/modules/snapshot/snapshotManager.js.map +0 -1
- package/lib/commonjs/types/StyleURL.js +0 -11
- package/lib/commonjs/types/StyleURL.js.map +0 -1
- package/lib/commonjs/utils/MapLibreRNStyles.d.js +0 -181
- package/lib/commonjs/utils/MapLibreRNStyles.d.js.map +0 -1
- package/lib/commonjs/utils/deprecation.js +0 -31
- package/lib/commonjs/utils/deprecation.js.map +0 -1
- package/lib/commonjs/utils/styleMap.js +0 -255
- package/lib/commonjs/utils/styleMap.js.map +0 -1
- package/lib/module/components/Style.js +0 -261
- package/lib/module/components/Style.js.map +0 -1
- package/lib/module/modules/location/locationManager.js.map +0 -1
- package/lib/module/modules/offline/offlineManager.js.map +0 -1
- package/lib/module/types/StyleURL.js +0 -7
- package/lib/module/types/StyleURL.js.map +0 -1
- package/lib/module/utils/MapLibreRNStyles.d.js +0 -180
- package/lib/module/utils/MapLibreRNStyles.d.js.map +0 -1
- package/lib/module/utils/deprecation.js +0 -27
- package/lib/module/utils/deprecation.js.map +0 -1
- package/lib/module/utils/styleMap.js +0 -249
- package/lib/module/utils/styleMap.js.map +0 -1
- package/lib/typescript/commonjs/jest.config.d.ts +0 -2
- package/lib/typescript/commonjs/jest.config.d.ts.map +0 -1
- package/lib/typescript/commonjs/src/components/Style.d.ts +0 -81
- package/lib/typescript/commonjs/src/components/Style.d.ts.map +0 -1
- package/lib/typescript/commonjs/src/modules/location/locationManager.d.ts +0 -64
- package/lib/typescript/commonjs/src/modules/location/locationManager.d.ts.map +0 -1
- package/lib/typescript/commonjs/src/modules/offline/offlineManager.d.ts.map +0 -1
- package/lib/typescript/commonjs/src/modules/snapshot/snapshotManager.d.ts.map +0 -1
- package/lib/typescript/commonjs/src/types/StyleURL.d.ts +0 -4
- package/lib/typescript/commonjs/src/types/StyleURL.d.ts.map +0 -1
- package/lib/typescript/commonjs/src/utils/deprecation.d.ts +0 -6
- package/lib/typescript/commonjs/src/utils/deprecation.d.ts.map +0 -1
- package/lib/typescript/commonjs/src/utils/styleMap.d.ts +0 -231
- package/lib/typescript/commonjs/src/utils/styleMap.d.ts.map +0 -1
- package/lib/typescript/module/jest.config.d.ts +0 -2
- package/lib/typescript/module/jest.config.d.ts.map +0 -1
- package/lib/typescript/module/src/components/Style.d.ts +0 -81
- package/lib/typescript/module/src/components/Style.d.ts.map +0 -1
- package/lib/typescript/module/src/modules/location/locationManager.d.ts +0 -64
- package/lib/typescript/module/src/modules/location/locationManager.d.ts.map +0 -1
- package/lib/typescript/module/src/modules/offline/offlineManager.d.ts.map +0 -1
- package/lib/typescript/module/src/modules/snapshot/snapshotManager.d.ts.map +0 -1
- package/lib/typescript/module/src/types/StyleURL.d.ts +0 -4
- package/lib/typescript/module/src/types/StyleURL.d.ts.map +0 -1
- package/lib/typescript/module/src/utils/deprecation.d.ts +0 -6
- package/lib/typescript/module/src/utils/deprecation.d.ts.map +0 -1
- package/lib/typescript/module/src/utils/styleMap.d.ts +0 -231
- package/lib/typescript/module/src/utils/styleMap.d.ts.map +0 -1
- package/plugin/build/withMapLibre.d.ts +0 -12
- package/plugin/build/withMapLibre.js +0 -148
- package/src/components/Style.tsx +0 -371
- package/src/types/StyleURL.ts +0 -3
- package/src/utils/deprecation.ts +0 -31
- package/src/utils/styleMap.ts +0 -265
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import {
|
|
2
2
|
Component,
|
|
3
|
-
type ReactElement,
|
|
4
3
|
forwardRef,
|
|
5
4
|
memo,
|
|
5
|
+
type ReactNode,
|
|
6
6
|
useImperativeHandle,
|
|
7
7
|
useRef,
|
|
8
8
|
} from "react";
|
|
@@ -13,8 +13,12 @@ import {
|
|
|
13
13
|
requireNativeComponent,
|
|
14
14
|
} from "react-native";
|
|
15
15
|
|
|
16
|
-
import useNativeBridge from "../hooks/useNativeBridge";
|
|
16
|
+
import { useNativeBridge } from "../hooks/useNativeBridge";
|
|
17
17
|
import { type BaseProps } from "../types/BaseProps";
|
|
18
|
+
import {
|
|
19
|
+
type ExpressionField,
|
|
20
|
+
type FilterExpression,
|
|
21
|
+
} from "../types/MapLibreRNStyles";
|
|
18
22
|
import { type OnPressEvent } from "../types/OnPressEvent";
|
|
19
23
|
import {
|
|
20
24
|
cloneReactChildrenWithProps,
|
|
@@ -22,16 +26,10 @@ import {
|
|
|
22
26
|
isFunction,
|
|
23
27
|
toJSONString,
|
|
24
28
|
} from "../utils";
|
|
25
|
-
import {
|
|
26
|
-
type ExpressionField,
|
|
27
|
-
type FilterExpression,
|
|
28
|
-
} from "../utils/MapLibreRNStyles";
|
|
29
|
-
import { copyPropertiesAsDeprecated } from "../utils/deprecation";
|
|
30
29
|
import { getFilter } from "../utils/filterUtils";
|
|
31
30
|
|
|
32
|
-
const
|
|
31
|
+
const MLRNModule = NativeModules.MLRNModule;
|
|
33
32
|
export const NATIVE_MODULE_NAME = "MLRNShapeSource";
|
|
34
|
-
export const SHAPE_SOURCE_NATIVE_ASSETS_KEY = "assets";
|
|
35
33
|
|
|
36
34
|
interface NativeProps {
|
|
37
35
|
shape?: string;
|
|
@@ -81,7 +79,7 @@ export interface ShapeSourceProps extends BaseProps {
|
|
|
81
79
|
* it accumulates the property value from clusters/points the cluster contains
|
|
82
80
|
* `map_expression` produces the value of a single point
|
|
83
81
|
*
|
|
84
|
-
*
|
|
82
|
+
* @example `{ "resultingSum": [["+", ["accumulated"], ["get", "resultingSum"]], ["get", "scalerank"]] }`
|
|
85
83
|
*
|
|
86
84
|
*/
|
|
87
85
|
clusterProperties?: { [propertyName: string]: ExpressionField };
|
|
@@ -111,18 +109,11 @@ export interface ShapeSourceProps extends BaseProps {
|
|
|
111
109
|
*/
|
|
112
110
|
lineMetrics?: boolean;
|
|
113
111
|
/**
|
|
114
|
-
* Source press listener, gets called when a user presses one of the children layers only
|
|
115
|
-
* if that layer has a higher z-index than another source layers
|
|
116
|
-
*
|
|
117
|
-
* @param {Object} event
|
|
118
|
-
* @param {Object[]} event.features - the geojson features that have hit by the press (might be multiple)
|
|
119
|
-
* @param {Object} event.coordinates - the coordinates of the click
|
|
120
|
-
* @param {Object} event.point - the point of the click
|
|
121
|
-
* @return void
|
|
112
|
+
* Source press listener, gets called when a user presses one of the children layers only if that layer has a higher z-index than another source layers.
|
|
122
113
|
*/
|
|
123
114
|
onPress?: (event: OnPressEvent) => void;
|
|
124
115
|
/**
|
|
125
|
-
* Overrides the default touch hitbox(44x44 pixels) for the source layers
|
|
116
|
+
* Overrides the default touch hitbox (44x44 pixels) for the source layers
|
|
126
117
|
*/
|
|
127
118
|
hitbox?: {
|
|
128
119
|
/**
|
|
@@ -135,20 +126,24 @@ export interface ShapeSourceProps extends BaseProps {
|
|
|
135
126
|
height: number;
|
|
136
127
|
};
|
|
137
128
|
|
|
138
|
-
children?:
|
|
129
|
+
children?: ReactNode;
|
|
139
130
|
}
|
|
140
131
|
|
|
141
132
|
export interface ShapeSourceRef {
|
|
142
133
|
features(filter?: FilterExpression): Promise<GeoJSON.FeatureCollection>;
|
|
134
|
+
|
|
143
135
|
getClusterExpansionZoom(feature: GeoJSON.Feature): Promise<number>;
|
|
136
|
+
|
|
144
137
|
getClusterLeaves(
|
|
145
138
|
feature: GeoJSON.Feature,
|
|
146
139
|
limit: number,
|
|
147
140
|
offset: number,
|
|
148
141
|
): Promise<GeoJSON.FeatureCollection>;
|
|
142
|
+
|
|
149
143
|
getClusterChildren(
|
|
150
144
|
feature: GeoJSON.Feature,
|
|
151
145
|
): Promise<GeoJSON.FeatureCollection>;
|
|
146
|
+
|
|
152
147
|
setNativeProps: (props: NativeProps) => void;
|
|
153
148
|
onPress: (event: NativeSyntheticEvent<{ payload: OnPressEvent }>) => void;
|
|
154
149
|
|
|
@@ -160,11 +155,11 @@ export interface ShapeSourceRef {
|
|
|
160
155
|
* ShapeSource is a map content source that supplies vector shapes to be shown on the map.
|
|
161
156
|
* The shape may be a url or a GeoJSON object
|
|
162
157
|
*/
|
|
163
|
-
const ShapeSource = memo(
|
|
158
|
+
export const ShapeSource = memo(
|
|
164
159
|
forwardRef<ShapeSourceRef, ShapeSourceProps>(
|
|
165
160
|
(
|
|
166
161
|
{
|
|
167
|
-
id: shapeId =
|
|
162
|
+
id: shapeId = MLRNModule.StyleSource.DefaultSourceID,
|
|
168
163
|
...props
|
|
169
164
|
}: ShapeSourceProps,
|
|
170
165
|
ref,
|
|
@@ -252,18 +247,6 @@ const ShapeSource = memo(
|
|
|
252
247
|
async function getClusterExpansionZoom(
|
|
253
248
|
feature: GeoJSON.Feature,
|
|
254
249
|
): Promise<number> {
|
|
255
|
-
if (typeof feature === "number") {
|
|
256
|
-
console.warn(
|
|
257
|
-
"Using cluster_id is deprecated and will be removed from the future releases. Please use cluster as an argument instead.",
|
|
258
|
-
);
|
|
259
|
-
const res: { data: number } = await _runNativeCommand(
|
|
260
|
-
"getClusterExpansionZoomById",
|
|
261
|
-
_nativeRef.current,
|
|
262
|
-
[feature],
|
|
263
|
-
);
|
|
264
|
-
return res.data;
|
|
265
|
-
}
|
|
266
|
-
|
|
267
250
|
const res: { data: number } = await _runNativeCommand(
|
|
268
251
|
"getClusterExpansionZoom",
|
|
269
252
|
_nativeRef.current,
|
|
@@ -277,24 +260,6 @@ const ShapeSource = memo(
|
|
|
277
260
|
limit: number,
|
|
278
261
|
offset: number,
|
|
279
262
|
): Promise<GeoJSON.FeatureCollection> {
|
|
280
|
-
if (typeof feature === "number") {
|
|
281
|
-
console.warn(
|
|
282
|
-
"Using cluster_id is deprecated and will be removed from the future releases. Please use cluster as an argument instead.",
|
|
283
|
-
);
|
|
284
|
-
const res: { data: string | GeoJSON.FeatureCollection } =
|
|
285
|
-
await _runNativeCommand(
|
|
286
|
-
"getClusterLeavesById",
|
|
287
|
-
_nativeRef.current,
|
|
288
|
-
[feature, limit, offset],
|
|
289
|
-
);
|
|
290
|
-
|
|
291
|
-
if (isAndroid()) {
|
|
292
|
-
return JSON.parse(res.data as string);
|
|
293
|
-
}
|
|
294
|
-
|
|
295
|
-
return res.data as GeoJSON.FeatureCollection;
|
|
296
|
-
}
|
|
297
|
-
|
|
298
263
|
const res: { data: string | GeoJSON.FeatureCollection } =
|
|
299
264
|
await _runNativeCommand("getClusterLeaves", _nativeRef.current, [
|
|
300
265
|
JSON.stringify(feature),
|
|
@@ -312,24 +277,6 @@ const ShapeSource = memo(
|
|
|
312
277
|
async function getClusterChildren(
|
|
313
278
|
feature: GeoJSON.Feature,
|
|
314
279
|
): Promise<GeoJSON.FeatureCollection> {
|
|
315
|
-
if (typeof feature === "number") {
|
|
316
|
-
console.warn(
|
|
317
|
-
"Using cluster_id is deprecated and will be removed from the future releases. Please use cluster as an argument instead.",
|
|
318
|
-
);
|
|
319
|
-
const res: { data: string | GeoJSON.FeatureCollection } =
|
|
320
|
-
await _runNativeCommand(
|
|
321
|
-
"getClusterChildrenById",
|
|
322
|
-
_nativeRef.current,
|
|
323
|
-
[feature],
|
|
324
|
-
);
|
|
325
|
-
|
|
326
|
-
if (isAndroid()) {
|
|
327
|
-
return JSON.parse(res.data as string);
|
|
328
|
-
}
|
|
329
|
-
|
|
330
|
-
return res.data as GeoJSON.FeatureCollection;
|
|
331
|
-
}
|
|
332
|
-
|
|
333
280
|
const res: { data: string | GeoJSON.FeatureCollection } =
|
|
334
281
|
await _runNativeCommand("getClusterChildren", _nativeRef.current, [
|
|
335
282
|
JSON.stringify(feature),
|
|
@@ -372,31 +319,13 @@ const ShapeSource = memo(
|
|
|
372
319
|
payload: { features, coordinates, point },
|
|
373
320
|
},
|
|
374
321
|
} = event;
|
|
375
|
-
let newEvent = {
|
|
376
|
-
features,
|
|
377
|
-
coordinates,
|
|
378
|
-
point,
|
|
379
|
-
};
|
|
380
|
-
newEvent = copyPropertiesAsDeprecated(
|
|
381
|
-
event,
|
|
382
|
-
newEvent,
|
|
383
|
-
(key: string): void => {
|
|
384
|
-
console.warn(
|
|
385
|
-
`event.${key} is deprecated on ShapeSource#onPress, please use event.features`,
|
|
386
|
-
);
|
|
387
|
-
},
|
|
388
|
-
{
|
|
389
|
-
nativeEvent: (
|
|
390
|
-
origNativeEvent: NativeSyntheticEvent<{ payload: OnPressEvent }>,
|
|
391
|
-
) => ({
|
|
392
|
-
...origNativeEvent,
|
|
393
|
-
payload: features[0],
|
|
394
|
-
}),
|
|
395
|
-
},
|
|
396
|
-
);
|
|
397
322
|
|
|
398
323
|
if (props.onPress) {
|
|
399
|
-
props.onPress(
|
|
324
|
+
props.onPress({
|
|
325
|
+
features,
|
|
326
|
+
coordinates,
|
|
327
|
+
point,
|
|
328
|
+
});
|
|
400
329
|
}
|
|
401
330
|
}
|
|
402
331
|
|
|
@@ -432,5 +361,3 @@ const ShapeSource = memo(
|
|
|
432
361
|
);
|
|
433
362
|
|
|
434
363
|
const MLRNShapeSource = requireNativeComponent<NativeProps>(NATIVE_MODULE_NAME);
|
|
435
|
-
|
|
436
|
-
export default ShapeSource;
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { View, NativeModules, requireNativeComponent } from "react-native";
|
|
1
|
+
import { NativeModules, requireNativeComponent } from "react-native";
|
|
3
2
|
|
|
4
|
-
import
|
|
3
|
+
import {
|
|
4
|
+
useAbstractLayer,
|
|
5
5
|
type BaseLayerProps,
|
|
6
6
|
type NativeBaseProps,
|
|
7
7
|
} from "../hooks/useAbstractLayer";
|
|
8
8
|
import { type BaseProps } from "../types/BaseProps";
|
|
9
|
-
import { type
|
|
9
|
+
import { type SymbolLayerStyle } from "../types/MapLibreRNStyles";
|
|
10
10
|
|
|
11
|
-
const
|
|
11
|
+
const MLRNModule = NativeModules.MLRNModule;
|
|
12
12
|
|
|
13
13
|
export const NATIVE_MODULE_NAME = "MLRNSymbolLayer";
|
|
14
14
|
|
|
@@ -16,26 +16,20 @@ export interface SymbolLayerProps extends BaseProps, BaseLayerProps {
|
|
|
16
16
|
/**
|
|
17
17
|
* Customizable style attributes
|
|
18
18
|
*/
|
|
19
|
-
style?:
|
|
20
|
-
|
|
21
|
-
/**
|
|
22
|
-
* @deprecated passed children used to create an image with id of symbol in style and also set the iconImageName property accordingly.
|
|
23
|
-
* This is now deprecated, use Image component instead.
|
|
24
|
-
*/
|
|
25
|
-
children?: ReactElement | ReactElement[];
|
|
19
|
+
style?: SymbolLayerStyle;
|
|
26
20
|
}
|
|
27
21
|
|
|
28
|
-
interface NativeProps
|
|
29
|
-
|
|
30
|
-
}
|
|
22
|
+
interface NativeProps
|
|
23
|
+
extends Omit<SymbolLayerProps, "style">,
|
|
24
|
+
NativeBaseProps {}
|
|
31
25
|
|
|
32
26
|
const MLRNSymbolLayer = requireNativeComponent<NativeProps>(NATIVE_MODULE_NAME);
|
|
33
27
|
|
|
34
28
|
/**
|
|
35
29
|
* SymbolLayer is a style layer that renders icon and text labels at points or along lines on the map.
|
|
36
30
|
*/
|
|
37
|
-
const SymbolLayer
|
|
38
|
-
sourceID =
|
|
31
|
+
export const SymbolLayer = ({
|
|
32
|
+
sourceID = MLRNModule.StyleSource.DefaultSourceID,
|
|
39
33
|
...props
|
|
40
34
|
}: SymbolLayerProps) => {
|
|
41
35
|
const { baseProps, setNativeLayer } = useAbstractLayer<
|
|
@@ -46,32 +40,9 @@ const SymbolLayer: React.FC<SymbolLayerProps> = ({
|
|
|
46
40
|
sourceID,
|
|
47
41
|
});
|
|
48
42
|
|
|
49
|
-
const _shouldSnapshot = (): boolean => {
|
|
50
|
-
let isSnapshot = false;
|
|
51
|
-
|
|
52
|
-
if (Children.count(props.children) <= 0) {
|
|
53
|
-
return isSnapshot;
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
Children.forEach(props.children, (child) => {
|
|
57
|
-
if (child?.type === View) {
|
|
58
|
-
isSnapshot = true;
|
|
59
|
-
}
|
|
60
|
-
});
|
|
61
|
-
|
|
62
|
-
return isSnapshot;
|
|
63
|
-
};
|
|
64
|
-
|
|
65
43
|
const updatedProps = {
|
|
66
44
|
...baseProps,
|
|
67
|
-
snapshot: _shouldSnapshot(),
|
|
68
45
|
};
|
|
69
46
|
|
|
70
|
-
return
|
|
71
|
-
<MLRNSymbolLayer ref={setNativeLayer} {...updatedProps}>
|
|
72
|
-
{props.children}
|
|
73
|
-
</MLRNSymbolLayer>
|
|
74
|
-
);
|
|
47
|
+
return <MLRNSymbolLayer ref={setNativeLayer} {...updatedProps} />;
|
|
75
48
|
};
|
|
76
|
-
|
|
77
|
-
export default SymbolLayer;
|
|
@@ -1,25 +1,26 @@
|
|
|
1
1
|
import {
|
|
2
2
|
forwardRef,
|
|
3
3
|
memo,
|
|
4
|
-
type
|
|
4
|
+
type ReactNode,
|
|
5
5
|
useEffect,
|
|
6
6
|
useImperativeHandle,
|
|
7
7
|
useRef,
|
|
8
8
|
useState,
|
|
9
9
|
} from "react";
|
|
10
10
|
|
|
11
|
-
import Annotation from "./Annotation";
|
|
12
|
-
import CircleLayer from "./CircleLayer";
|
|
13
|
-
import HeadingIndicator from "./HeadingIndicator";
|
|
14
|
-
import NativeUserLocation from "./NativeUserLocation";
|
|
15
|
-
import
|
|
11
|
+
import { Annotation } from "./Annotation";
|
|
12
|
+
import { CircleLayer } from "./CircleLayer";
|
|
13
|
+
import { HeadingIndicator } from "./HeadingIndicator";
|
|
14
|
+
import { NativeUserLocation } from "./NativeUserLocation";
|
|
15
|
+
import {
|
|
16
16
|
type Location,
|
|
17
|
-
|
|
18
|
-
|
|
17
|
+
LocationManager,
|
|
18
|
+
} from "../modules/location/LocationManager";
|
|
19
|
+
import { type CircleLayerStyle } from "../types/MapLibreRNStyles";
|
|
19
20
|
|
|
20
21
|
const mapboxBlue = "rgba(51, 181, 229, 100)";
|
|
21
22
|
|
|
22
|
-
const layerStyles: Record<string,
|
|
23
|
+
const layerStyles: Record<string, CircleLayerStyle> = {
|
|
23
24
|
pluse: {
|
|
24
25
|
circleRadius: 15,
|
|
25
26
|
circleColor: mapboxBlue,
|
|
@@ -41,7 +42,7 @@ const layerStyles: Record<string, CircleLayerStyleProps> = {
|
|
|
41
42
|
export const normalIcon = (
|
|
42
43
|
showsUserHeadingIndicator?: boolean,
|
|
43
44
|
heading?: number,
|
|
44
|
-
)
|
|
45
|
+
) => [
|
|
45
46
|
<CircleLayer
|
|
46
47
|
key="mapboxUserLocationPluseCircle"
|
|
47
48
|
id="mapboxUserLocationPluseCircle"
|
|
@@ -114,7 +115,7 @@ interface UserLocationProps {
|
|
|
114
115
|
*
|
|
115
116
|
* NOTE: Forking maintainer does not understand the above comment.
|
|
116
117
|
*/
|
|
117
|
-
children?:
|
|
118
|
+
children?: ReactNode;
|
|
118
119
|
}
|
|
119
120
|
|
|
120
121
|
interface UserLocationState {
|
|
@@ -134,7 +135,7 @@ export interface UserLocationRef {
|
|
|
134
135
|
_onLocationUpdate: (location: Location | null) => void;
|
|
135
136
|
}
|
|
136
137
|
|
|
137
|
-
const UserLocation = memo(
|
|
138
|
+
export const UserLocation = memo(
|
|
138
139
|
forwardRef<UserLocationRef, UserLocationProps>(
|
|
139
140
|
(
|
|
140
141
|
{
|
|
@@ -163,19 +164,19 @@ const UserLocation = memo(
|
|
|
163
164
|
ref,
|
|
164
165
|
(): UserLocationRef => ({
|
|
165
166
|
/**
|
|
166
|
-
* Whether to start or stop listening to the
|
|
167
|
+
* Whether to start or stop listening to the LocationManager
|
|
167
168
|
*
|
|
168
169
|
* Notice, that listening will start automatically when
|
|
169
170
|
* either `onUpdate` or `visible` are set
|
|
170
171
|
*
|
|
171
172
|
* @async
|
|
172
|
-
* @param {
|
|
173
|
+
* @param {{running: boolean}} running - Object with key `running` and `boolean` value
|
|
173
174
|
* @return {Promise<void>}
|
|
174
175
|
*/
|
|
175
176
|
setLocationManager,
|
|
176
177
|
/**
|
|
177
178
|
*
|
|
178
|
-
* If
|
|
179
|
+
* If LocationManager should be running
|
|
179
180
|
*
|
|
180
181
|
* @return {boolean}
|
|
181
182
|
*/
|
|
@@ -194,7 +195,7 @@ const UserLocation = memo(
|
|
|
194
195
|
return;
|
|
195
196
|
}
|
|
196
197
|
|
|
197
|
-
|
|
198
|
+
LocationManager.setMinDisplacement(minDisplacement ?? 0);
|
|
198
199
|
});
|
|
199
200
|
|
|
200
201
|
return (): void => {
|
|
@@ -205,7 +206,7 @@ const UserLocation = memo(
|
|
|
205
206
|
}, []);
|
|
206
207
|
|
|
207
208
|
useEffect(() => {
|
|
208
|
-
|
|
209
|
+
LocationManager.setMinDisplacement(minDisplacement ?? 0);
|
|
209
210
|
}, [minDisplacement]);
|
|
210
211
|
|
|
211
212
|
useEffect(() => {
|
|
@@ -227,11 +228,11 @@ const UserLocation = memo(
|
|
|
227
228
|
locationManagerRunning.current = running;
|
|
228
229
|
|
|
229
230
|
if (running) {
|
|
230
|
-
|
|
231
|
-
const location = await
|
|
231
|
+
LocationManager.addListener(_onLocationUpdate);
|
|
232
|
+
const location = await LocationManager.getLastKnownLocation();
|
|
232
233
|
_onLocationUpdate(location);
|
|
233
234
|
} else {
|
|
234
|
-
|
|
235
|
+
LocationManager.removeListener(_onLocationUpdate);
|
|
235
236
|
}
|
|
236
237
|
}
|
|
237
238
|
}
|
|
@@ -303,5 +304,3 @@ const UserLocation = memo(
|
|
|
303
304
|
},
|
|
304
305
|
),
|
|
305
306
|
);
|
|
306
|
-
|
|
307
|
-
export default UserLocation;
|
|
@@ -1,21 +1,20 @@
|
|
|
1
1
|
import { featureCollection } from "@turf/helpers";
|
|
2
|
-
import { forwardRef, memo, useImperativeHandle } from "react";
|
|
2
|
+
import { forwardRef, memo, type ReactNode, useImperativeHandle } from "react";
|
|
3
3
|
import {
|
|
4
4
|
NativeModules,
|
|
5
5
|
type NativeSyntheticEvent,
|
|
6
6
|
requireNativeComponent,
|
|
7
7
|
} from "react-native";
|
|
8
8
|
|
|
9
|
-
import useAbstractSource from "../hooks/useAbstractSource";
|
|
10
|
-
import useNativeBridge from "../hooks/useNativeBridge";
|
|
9
|
+
import { useAbstractSource } from "../hooks/useAbstractSource";
|
|
10
|
+
import { useNativeBridge } from "../hooks/useNativeBridge";
|
|
11
11
|
import { type BaseProps } from "../types/BaseProps";
|
|
12
|
+
import { type FilterExpression } from "../types/MapLibreRNStyles";
|
|
12
13
|
import { type OnPressEvent } from "../types/OnPressEvent";
|
|
13
14
|
import { cloneReactChildrenWithProps, isFunction, isAndroid } from "../utils";
|
|
14
|
-
import { type FilterExpression } from "../utils/MapLibreRNStyles";
|
|
15
|
-
import { copyPropertiesAsDeprecated } from "../utils/deprecation";
|
|
16
15
|
import { getFilter } from "../utils/filterUtils";
|
|
17
16
|
|
|
18
|
-
const
|
|
17
|
+
const MLRNModule = NativeModules.MLRNModule;
|
|
19
18
|
|
|
20
19
|
export const NATIVE_MODULE_NAME = "MLRNVectorSource";
|
|
21
20
|
|
|
@@ -57,11 +56,6 @@ interface VectorSourceProps extends BaseProps {
|
|
|
57
56
|
/**
|
|
58
57
|
* Source press listener, gets called when a user presses one of the children layers only
|
|
59
58
|
* if that layer has a higher z-index than another source layers
|
|
60
|
-
*
|
|
61
|
-
* @param {Object} event
|
|
62
|
-
* @param {Object[]} event.features - the geojson features that have hit by the press (might be multiple)
|
|
63
|
-
* @param {Object} event.coordinates - the coordinates of the click
|
|
64
|
-
* @param {Object} event.point - the point of the click
|
|
65
59
|
*/
|
|
66
60
|
onPress?: (event: OnPressEvent) => void;
|
|
67
61
|
/**
|
|
@@ -78,7 +72,7 @@ interface VectorSourceProps extends BaseProps {
|
|
|
78
72
|
height: number;
|
|
79
73
|
};
|
|
80
74
|
|
|
81
|
-
children?:
|
|
75
|
+
children?: ReactNode;
|
|
82
76
|
}
|
|
83
77
|
|
|
84
78
|
type NativeProps = VectorSourceProps;
|
|
@@ -90,11 +84,11 @@ const MLRNVectorSource =
|
|
|
90
84
|
* VectorSource is a map content source that supplies tiled vector data in Mapbox Vector Tile format to be shown on the map.
|
|
91
85
|
* The location of and metadata about the tiles are defined either by an option dictionary or by an external file that conforms to the TileJSON specification.
|
|
92
86
|
*/
|
|
93
|
-
const VectorSource = memo(
|
|
87
|
+
export const VectorSource = memo(
|
|
94
88
|
forwardRef(
|
|
95
89
|
(
|
|
96
90
|
{
|
|
97
|
-
id =
|
|
91
|
+
id = MLRNModule.StyleSource.DefaultSourceID,
|
|
98
92
|
...props
|
|
99
93
|
}: VectorSourceProps,
|
|
100
94
|
ref,
|
|
@@ -160,33 +154,18 @@ const VectorSource = memo(
|
|
|
160
154
|
if (!onPress) {
|
|
161
155
|
return;
|
|
162
156
|
}
|
|
157
|
+
|
|
163
158
|
const {
|
|
164
159
|
nativeEvent: {
|
|
165
160
|
payload: { features, coordinates, point },
|
|
166
161
|
},
|
|
167
162
|
} = event;
|
|
168
|
-
|
|
163
|
+
|
|
164
|
+
onPress({
|
|
169
165
|
features,
|
|
170
166
|
coordinates,
|
|
171
167
|
point,
|
|
172
|
-
};
|
|
173
|
-
newEvent = copyPropertiesAsDeprecated(
|
|
174
|
-
event,
|
|
175
|
-
newEvent,
|
|
176
|
-
(key: string) => {
|
|
177
|
-
console.warn(
|
|
178
|
-
`event.${key} is deprecated on VectorSource#onPress, please use event.features`,
|
|
179
|
-
);
|
|
180
|
-
},
|
|
181
|
-
{
|
|
182
|
-
nativeEvent: (origNativeEvent: OnPressEvent) => ({
|
|
183
|
-
...origNativeEvent,
|
|
184
|
-
payload: features[0],
|
|
185
|
-
}),
|
|
186
|
-
},
|
|
187
|
-
);
|
|
188
|
-
|
|
189
|
-
onPress(newEvent);
|
|
168
|
+
});
|
|
190
169
|
};
|
|
191
170
|
|
|
192
171
|
const allProps = {
|
|
@@ -214,5 +193,3 @@ const VectorSource = memo(
|
|
|
214
193
|
},
|
|
215
194
|
),
|
|
216
195
|
);
|
|
217
|
-
|
|
218
|
-
export default VectorSource;
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { useMemo, useRef } from "react";
|
|
1
|
+
import { type Component, useMemo, useRef } from "react";
|
|
2
2
|
import { processColor, type NativeMethods } from "react-native";
|
|
3
3
|
|
|
4
4
|
import { type BaseProps } from "../types/BaseProps";
|
|
5
5
|
import {
|
|
6
|
-
type
|
|
6
|
+
type AllLayerStyle,
|
|
7
7
|
type ExpressionField,
|
|
8
8
|
type ExpressionName,
|
|
9
9
|
type FilterExpression,
|
|
10
|
-
} from "../
|
|
10
|
+
} from "../types/MapLibreRNStyles";
|
|
11
11
|
import { type StyleValue, transformStyle } from "../utils/StyleValue";
|
|
12
12
|
import { getFilter } from "../utils/filterUtils";
|
|
13
13
|
|
|
@@ -53,14 +53,14 @@ export interface BaseLayerProps {
|
|
|
53
53
|
/**
|
|
54
54
|
* Customizable style attributes
|
|
55
55
|
*/
|
|
56
|
-
style?:
|
|
56
|
+
style?: AllLayerStyle;
|
|
57
57
|
}
|
|
58
58
|
|
|
59
59
|
export interface NativeBaseProps {
|
|
60
60
|
reactStyle?: { [key: string]: StyleValue };
|
|
61
61
|
}
|
|
62
62
|
|
|
63
|
-
export
|
|
63
|
+
export function useAbstractLayer<
|
|
64
64
|
Props extends BaseProps,
|
|
65
65
|
NativeProps extends NativeBaseProps,
|
|
66
66
|
>(
|
|
@@ -68,13 +68,13 @@ export default function useAbstractLayer<
|
|
|
68
68
|
): {
|
|
69
69
|
baseProps: Props & BaseLayerProps;
|
|
70
70
|
setNativeLayer: (
|
|
71
|
-
instance: (
|
|
71
|
+
instance: (Component<NativeProps> & Readonly<NativeMethods>) | null,
|
|
72
72
|
) => void;
|
|
73
73
|
getStyleTypeFormatter: (styleType: string) => typeof processColor | undefined;
|
|
74
74
|
setNativeProps: (nativeProps: { [key: string]: unknown }) => void;
|
|
75
75
|
} {
|
|
76
76
|
const nativeLayer = useRef<
|
|
77
|
-
(
|
|
77
|
+
(Component<NativeProps> & Readonly<NativeMethods>) | null
|
|
78
78
|
>(null);
|
|
79
79
|
|
|
80
80
|
const baseProps = useMemo(() => {
|
|
@@ -94,7 +94,7 @@ export default function useAbstractLayer<
|
|
|
94
94
|
}, [props]);
|
|
95
95
|
|
|
96
96
|
const setNativeLayer = (
|
|
97
|
-
instance: (
|
|
97
|
+
instance: (Component<NativeProps> & Readonly<NativeMethods>) | null,
|
|
98
98
|
): void => {
|
|
99
99
|
nativeLayer.current = instance;
|
|
100
100
|
};
|
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
import { useRef } from "react";
|
|
1
|
+
import { Component, useRef } from "react";
|
|
2
2
|
import { type NativeMethods } from "react-native";
|
|
3
3
|
|
|
4
|
-
export
|
|
4
|
+
export function useAbstractSource<NativePropsType extends object>(): {
|
|
5
5
|
_nativeRef:
|
|
6
|
-
| (
|
|
6
|
+
| (Component<NativePropsType> & Readonly<NativeMethods>)
|
|
7
7
|
| undefined;
|
|
8
8
|
setNativeRef: (
|
|
9
|
-
instance:
|
|
9
|
+
instance: Component<NativePropsType> & Readonly<NativeMethods>,
|
|
10
10
|
) => void;
|
|
11
11
|
setNativeProps: (nativeProps: NativePropsType) => void;
|
|
12
12
|
} {
|
|
13
13
|
const _nativeRef = useRef<
|
|
14
|
-
(
|
|
14
|
+
(Component<NativePropsType> & Readonly<NativeMethods>) | undefined
|
|
15
15
|
>(undefined);
|
|
16
16
|
|
|
17
17
|
const setNativeRef = (
|
|
18
|
-
instance:
|
|
18
|
+
instance: Component<NativePropsType> & Readonly<NativeMethods>,
|
|
19
19
|
): void => {
|
|
20
20
|
_nativeRef.current = instance;
|
|
21
21
|
};
|
|
@@ -1,4 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
Component,
|
|
3
|
+
type MutableRefObject,
|
|
4
|
+
type SyntheticEvent,
|
|
5
|
+
useRef,
|
|
6
|
+
} from "react";
|
|
2
7
|
|
|
3
8
|
import { runNativeCommand, isAndroid, type NativeArg } from "../utils";
|
|
4
9
|
|
|
@@ -12,8 +17,8 @@ let callbackIncrement = 0;
|
|
|
12
17
|
type UseNativeBridge = {
|
|
13
18
|
_nativeModuleName: string;
|
|
14
19
|
_onAndroidCallback: (e: SyntheticEvent<Element, RNMLEvent>) => void;
|
|
15
|
-
_callbackMap:
|
|
16
|
-
_preRefMapMethodQueue:
|
|
20
|
+
_callbackMap: MutableRefObject<Map<string, any>>;
|
|
21
|
+
_preRefMapMethodQueue: MutableRefObject<any[]>;
|
|
17
22
|
_addAddAndroidCallback: <ReturnType>(
|
|
18
23
|
id: string,
|
|
19
24
|
resolve: (value: ReturnType) => void,
|
|
@@ -30,7 +35,7 @@ type UseNativeBridge = {
|
|
|
30
35
|
) => Promise<ReturnType>;
|
|
31
36
|
};
|
|
32
37
|
|
|
33
|
-
const useNativeBridge: (moduleName: string) => UseNativeBridge = (
|
|
38
|
+
export const useNativeBridge: (moduleName: string) => UseNativeBridge = (
|
|
34
39
|
_nativeModuleName: string,
|
|
35
40
|
) => {
|
|
36
41
|
const _callbackMap = useRef<Map<string, any>>(new Map());
|
|
@@ -121,5 +126,3 @@ const useNativeBridge: (moduleName: string) => UseNativeBridge = (
|
|
|
121
126
|
_runNativeCommand,
|
|
122
127
|
};
|
|
123
128
|
};
|
|
124
|
-
|
|
125
|
-
export default useNativeBridge;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Component, useRef } from "react";
|
|
1
|
+
import { Component, type RefObject, useRef } from "react";
|
|
2
2
|
import { type NativeMethods } from "react-native";
|
|
3
3
|
|
|
4
4
|
export type NativeRef<NativeProps> = Component<NativeProps> &
|
|
@@ -7,7 +7,7 @@ export type NativeRef<NativeProps> = Component<NativeProps> &
|
|
|
7
7
|
/**
|
|
8
8
|
* Separate module which allows to be mocked in tests.
|
|
9
9
|
*/
|
|
10
|
-
export function useNativeRef<NativeProps = object>():
|
|
10
|
+
export function useNativeRef<NativeProps = object>(): RefObject<
|
|
11
11
|
NativeRef<NativeProps>
|
|
12
12
|
> {
|
|
13
13
|
return useRef<NativeRef<NativeProps>>(null);
|
package/src/hooks/useOnce.ts
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { useRef } from "react";
|
|
2
2
|
|
|
3
|
-
const useOnce: (callback: () => void) => void = (
|
|
3
|
+
export const useOnce: (callback: () => void) => void = (
|
|
4
|
+
callback: () => void,
|
|
5
|
+
) => {
|
|
4
6
|
const once = useRef(false);
|
|
5
7
|
|
|
6
8
|
if (!once.current) {
|
|
@@ -8,5 +10,3 @@ const useOnce: (callback: () => void) => void = (callback: () => void) => {
|
|
|
8
10
|
callback();
|
|
9
11
|
}
|
|
10
12
|
};
|
|
11
|
-
|
|
12
|
-
export default useOnce;
|