@rnmapbox/maps 10.1.39 → 10.1.41-rc.2
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/build.gradle +14 -2
- package/android/src/main/java/com/rnmapbox/rnmbx/components/annotation/RNMBXMarkerView.kt +1 -1
- package/android/src/main/java/com/rnmapbox/rnmbx/components/annotation/RNMBXMarkerViewManager.kt +11 -1
- package/android/src/main/java/com/rnmapbox/rnmbx/components/annotation/RNMBXPointAnnotationManager.kt +7 -1
- package/android/src/main/java/com/rnmapbox/rnmbx/components/camera/RNMBXCameraManager.kt +25 -4
- package/android/src/main/java/com/rnmapbox/rnmbx/components/camera/RNMBXCameraModule.kt +65 -2
- package/android/src/main/java/com/rnmapbox/rnmbx/components/camera/RNMBXViewport.kt +4 -4
- package/android/src/main/java/com/rnmapbox/rnmbx/components/images/RNMBXImagesManager.kt +30 -4
- package/android/src/main/java/com/rnmapbox/rnmbx/components/location/RNMBXCustomLocationProviderManager.kt +4 -0
- package/android/src/main/java/com/rnmapbox/rnmbx/components/location/RNMBXNativeUserLocation.kt +1 -1
- package/android/src/main/java/com/rnmapbox/rnmbx/components/location/RNMBXNativeUserLocationManager.kt +8 -2
- package/android/src/main/java/com/rnmapbox/rnmbx/components/mapview/RNMBXMapViewManager.kt +59 -10
- package/android/src/main/java/com/rnmapbox/rnmbx/components/styles/RNMBXStyleImportManager.kt +6 -1
- package/android/src/main/java/com/rnmapbox/rnmbx/components/styles/RNMBXStyleValue.kt +9 -5
- package/android/src/main/java/com/rnmapbox/rnmbx/components/styles/layers/RNMBXModelLayer.kt +5 -1
- package/android/src/main/java/com/rnmapbox/rnmbx/components/styles/layers/RNMBXModelLayerManager.kt +1 -0
- package/android/src/main/java/com/rnmapbox/rnmbx/components/styles/sources/RNMBXRasterSourceManager.kt +3 -2
- package/android/src/main/java/com/rnmapbox/rnmbx/components/styles/sources/RNMBXShapeSourceManager.kt +19 -4
- package/android/src/main/java/com/rnmapbox/rnmbx/components/styles/sources/RNMBXTileSourceManager.kt +8 -3
- package/android/src/main/java/com/rnmapbox/rnmbx/components/styles/sources/RNMBXVectorSourceManager.kt +7 -1
- package/android/src/main/java/com/rnmapbox/rnmbx/modules/RNMBXLocationModule.kt +7 -5
- package/android/src/main/java/com/rnmapbox/rnmbx/utils/extensions/Dynamic.kt +27 -3
- package/android/src/main/mapbox-v11-compat/v10/com/rnmapbox/rnmbx/v11compat/Annotation.kt +5 -1
- package/android/src/main/old-arch/com/rnmapbox/rnmbx/NativeRNMBXCameraModuleSpec.java +8 -0
- package/ios/RNMBX/RNMBXCamera.swift +64 -3
- package/ios/RNMBX/RNMBXCameraModule.mm +26 -1
- package/ios/RNMBX/RNMBXMarkerViewComponentView.mm +11 -16
- package/ios/RNMBX/RNMBXShapeSource.swift +2 -4
- package/ios/RNMBX/RNMBXShapeSourceComponentView.mm +1 -1
- package/ios/RNMBX/RNMBXShapeSourceViewManager.m +1 -1
- package/ios/RNMBX/RNMBXVectorSourceComponentView.mm +1 -1
- package/ios/install.md +1 -1
- package/lib/commonjs/components/Camera.js +29 -1
- package/lib/commonjs/components/Camera.js.map +1 -1
- package/lib/commonjs/components/NativeBridgeComponent.js +41 -0
- package/lib/commonjs/components/NativeBridgeComponent.js.map +1 -0
- package/lib/commonjs/modules/location/locationManager.js +3 -1
- package/lib/commonjs/modules/location/locationManager.js.map +1 -1
- package/lib/commonjs/plugin/build/generateCode.js +5 -6
- package/lib/commonjs/plugin/install.md +2 -2
- package/lib/commonjs/specs/NativeMapViewModule.js +10 -0
- package/lib/commonjs/specs/NativeMapViewModule.js.map +1 -0
- package/lib/commonjs/specs/NativeRNMBXCameraModule.js +10 -0
- package/lib/commonjs/specs/NativeRNMBXCameraModule.js.map +1 -0
- package/lib/commonjs/specs/NativeRNMBXChangeLineOffsetsShapeAnimatorModule.js +10 -0
- package/lib/commonjs/specs/NativeRNMBXChangeLineOffsetsShapeAnimatorModule.js.map +1 -0
- package/lib/commonjs/specs/NativeRNMBXImageModule.js +10 -0
- package/lib/commonjs/specs/NativeRNMBXImageModule.js.map +1 -0
- package/lib/commonjs/specs/NativeRNMBXLocationModule.js +9 -0
- package/lib/commonjs/specs/NativeRNMBXLocationModule.js.map +1 -0
- package/lib/commonjs/specs/NativeRNMBXMovePointShapeAnimatorModule.js +10 -0
- package/lib/commonjs/specs/NativeRNMBXMovePointShapeAnimatorModule.js.map +1 -0
- package/lib/commonjs/specs/NativeRNMBXPointAnnotationModule.js +10 -0
- package/lib/commonjs/specs/NativeRNMBXPointAnnotationModule.js.map +1 -0
- package/lib/commonjs/specs/NativeRNMBXShapeSourceModule.js +10 -0
- package/lib/commonjs/specs/NativeRNMBXShapeSourceModule.js.map +1 -0
- package/lib/commonjs/specs/NativeRNMBXTileStoreModule.js +11 -0
- package/lib/commonjs/specs/NativeRNMBXTileStoreModule.js.map +1 -0
- package/lib/commonjs/specs/NativeRNMBXViewportModule.js +10 -0
- package/lib/commonjs/specs/NativeRNMBXViewportModule.js.map +1 -0
- package/lib/commonjs/utils/NativeCommands.js +50 -0
- package/lib/commonjs/utils/NativeCommands.js.map +1 -0
- package/lib/{module/utils/nativeRef.ts → commonjs/utils/nativeRef.js} +8 -9
- package/lib/commonjs/utils/nativeRef.js.map +1 -0
- package/lib/module/components/Camera.js +29 -1
- package/lib/module/components/Camera.js.map +1 -1
- package/lib/module/components/NativeBridgeComponent.js +37 -0
- package/lib/module/components/NativeBridgeComponent.js.map +1 -0
- package/lib/module/modules/location/locationManager.js +3 -1
- package/lib/module/modules/location/locationManager.js.map +1 -1
- package/lib/module/specs/NativeMapViewModule.js +7 -0
- package/lib/module/specs/NativeMapViewModule.js.map +1 -0
- package/lib/module/specs/NativeRNMBXCameraModule.js +8 -0
- package/lib/module/specs/NativeRNMBXCameraModule.js.map +1 -0
- package/lib/module/specs/NativeRNMBXChangeLineOffsetsShapeAnimatorModule.js +8 -0
- package/lib/module/specs/NativeRNMBXChangeLineOffsetsShapeAnimatorModule.js.map +1 -0
- package/lib/module/specs/NativeRNMBXImageModule.js +7 -0
- package/lib/module/specs/NativeRNMBXImageModule.js.map +1 -0
- package/lib/module/specs/NativeRNMBXLocationModule.js +5 -0
- package/lib/module/specs/NativeRNMBXLocationModule.js.map +1 -0
- package/lib/module/specs/NativeRNMBXMovePointShapeAnimatorModule.js +8 -0
- package/lib/module/specs/NativeRNMBXMovePointShapeAnimatorModule.js.map +1 -0
- package/lib/module/specs/NativeRNMBXPointAnnotationModule.js +7 -0
- package/lib/module/specs/NativeRNMBXPointAnnotationModule.js.map +1 -0
- package/lib/module/specs/NativeRNMBXShapeSourceModule.js +7 -0
- package/lib/module/specs/NativeRNMBXShapeSourceModule.js.map +1 -0
- package/lib/module/specs/NativeRNMBXTileStoreModule.js +10 -0
- package/lib/module/specs/NativeRNMBXTileStoreModule.js.map +1 -0
- package/lib/module/specs/NativeRNMBXViewportModule.js +8 -0
- package/lib/module/specs/NativeRNMBXViewportModule.js.map +1 -0
- package/lib/module/utils/NativeCommands.js +45 -0
- package/lib/module/utils/NativeCommands.js.map +1 -0
- package/lib/{commonjs/utils/nativeRef.ts → module/utils/nativeRef.js} +4 -9
- package/lib/module/utils/nativeRef.js.map +1 -0
- package/lib/typescript/src/Mapbox.d.ts +0 -1
- package/lib/typescript/src/Mapbox.d.ts.map +1 -1
- package/lib/typescript/src/RNMBXModule.d.ts +1 -1
- package/lib/typescript/src/RNMBXModule.d.ts.map +1 -1
- package/lib/typescript/src/components/AbstractLayer.d.ts.map +1 -1
- package/lib/typescript/src/components/Camera.d.ts +20 -0
- package/lib/typescript/src/components/Camera.d.ts.map +1 -1
- package/lib/typescript/src/components/HeadingIndicator.d.ts.map +1 -1
- package/lib/typescript/src/components/Light.d.ts.map +1 -1
- package/lib/typescript/src/components/MapView.d.ts +4 -3
- package/lib/typescript/src/components/MapView.d.ts.map +1 -1
- package/lib/typescript/src/components/NativeBridgeComponent.d.ts +4 -4
- package/lib/typescript/src/components/NativeBridgeComponent.d.ts.map +1 -1
- package/lib/typescript/src/components/PointAnnotation.d.ts +4 -3
- package/lib/typescript/src/components/PointAnnotation.d.ts.map +1 -1
- package/lib/typescript/src/components/ShapeSource.d.ts +4 -3
- package/lib/typescript/src/components/ShapeSource.d.ts.map +1 -1
- package/lib/typescript/src/components/Style.d.ts.map +1 -1
- package/lib/typescript/src/modules/location/locationManager.d.ts.map +1 -1
- package/lib/typescript/src/specs/NativeMapViewModule.d.ts +0 -1
- package/lib/typescript/src/specs/NativeMapViewModule.d.ts.map +1 -1
- package/lib/typescript/src/specs/NativeRNMBXCameraModule.d.ts +3 -3
- package/lib/typescript/src/specs/NativeRNMBXCameraModule.d.ts.map +1 -1
- package/lib/typescript/src/specs/NativeRNMBXChangeLineOffsetsShapeAnimatorModule.d.ts +0 -1
- package/lib/typescript/src/specs/NativeRNMBXChangeLineOffsetsShapeAnimatorModule.d.ts.map +1 -1
- package/lib/typescript/src/specs/NativeRNMBXImageModule.d.ts +0 -1
- package/lib/typescript/src/specs/NativeRNMBXImageModule.d.ts.map +1 -1
- package/lib/typescript/src/specs/NativeRNMBXLocationModule.d.ts +0 -1
- package/lib/typescript/src/specs/NativeRNMBXLocationModule.d.ts.map +1 -1
- package/lib/typescript/src/specs/NativeRNMBXMovePointShapeAnimatorModule.d.ts +0 -1
- package/lib/typescript/src/specs/NativeRNMBXMovePointShapeAnimatorModule.d.ts.map +1 -1
- package/lib/typescript/src/specs/NativeRNMBXPointAnnotationModule.d.ts +0 -1
- package/lib/typescript/src/specs/NativeRNMBXPointAnnotationModule.d.ts.map +1 -1
- package/lib/typescript/src/specs/NativeRNMBXShapeSourceModule.d.ts +0 -1
- package/lib/typescript/src/specs/NativeRNMBXShapeSourceModule.d.ts.map +1 -1
- package/lib/typescript/src/specs/NativeRNMBXTileStoreModule.d.ts +0 -1
- package/lib/typescript/src/specs/NativeRNMBXTileStoreModule.d.ts.map +1 -1
- package/lib/typescript/src/specs/NativeRNMBXViewportModule.d.ts +0 -1
- package/lib/typescript/src/specs/NativeRNMBXViewportModule.d.ts.map +1 -1
- package/lib/typescript/src/specs/RNMBXAtmosphereNativeComponent.d.ts.map +1 -1
- package/lib/typescript/src/specs/RNMBXBackgroundLayerNativeComponent.d.ts +0 -1
- package/lib/typescript/src/specs/RNMBXBackgroundLayerNativeComponent.d.ts.map +1 -1
- package/lib/typescript/src/specs/RNMBXCalloutNativeComponent.d.ts.map +1 -1
- package/lib/typescript/src/specs/RNMBXCameraNativeComponent.d.ts +0 -1
- package/lib/typescript/src/specs/RNMBXCameraNativeComponent.d.ts.map +1 -1
- package/lib/typescript/src/specs/RNMBXCircleLayerNativeComponent.d.ts +0 -1
- package/lib/typescript/src/specs/RNMBXCircleLayerNativeComponent.d.ts.map +1 -1
- package/lib/typescript/src/specs/RNMBXCustomLocationProviderNativeComponent.d.ts +0 -1
- package/lib/typescript/src/specs/RNMBXCustomLocationProviderNativeComponent.d.ts.map +1 -1
- package/lib/typescript/src/specs/RNMBXFillExtrusionLayerNativeComponent.d.ts +0 -1
- package/lib/typescript/src/specs/RNMBXFillExtrusionLayerNativeComponent.d.ts.map +1 -1
- package/lib/typescript/src/specs/RNMBXFillLayerNativeComponent.d.ts +0 -1
- package/lib/typescript/src/specs/RNMBXFillLayerNativeComponent.d.ts.map +1 -1
- package/lib/typescript/src/specs/RNMBXHeatmapLayerNativeComponent.d.ts +0 -1
- package/lib/typescript/src/specs/RNMBXHeatmapLayerNativeComponent.d.ts.map +1 -1
- package/lib/typescript/src/specs/RNMBXImageNativeComponent.d.ts +0 -1
- package/lib/typescript/src/specs/RNMBXImageNativeComponent.d.ts.map +1 -1
- package/lib/typescript/src/specs/RNMBXImageSourceNativeComponent.d.ts.map +1 -1
- package/lib/typescript/src/specs/RNMBXImagesNativeComponent.d.ts +0 -1
- package/lib/typescript/src/specs/RNMBXImagesNativeComponent.d.ts.map +1 -1
- package/lib/typescript/src/specs/RNMBXLightNativeComponent.d.ts.map +1 -1
- package/lib/typescript/src/specs/RNMBXLineLayerNativeComponent.d.ts +0 -1
- package/lib/typescript/src/specs/RNMBXLineLayerNativeComponent.d.ts.map +1 -1
- package/lib/typescript/src/specs/RNMBXMapViewNativeComponent.d.ts +0 -1
- package/lib/typescript/src/specs/RNMBXMapViewNativeComponent.d.ts.map +1 -1
- package/lib/typescript/src/specs/RNMBXMarkerViewContentNativeComponent.d.ts.map +1 -1
- package/lib/typescript/src/specs/RNMBXMarkerViewNativeComponent.d.ts +0 -1
- package/lib/typescript/src/specs/RNMBXMarkerViewNativeComponent.d.ts.map +1 -1
- package/lib/typescript/src/specs/RNMBXModelLayerNativeComponent.d.ts +0 -1
- package/lib/typescript/src/specs/RNMBXModelLayerNativeComponent.d.ts.map +1 -1
- package/lib/typescript/src/specs/RNMBXModelsNativeComponent.d.ts.map +1 -1
- package/lib/typescript/src/specs/RNMBXNativeUserLocationNativeComponent.d.ts.map +1 -1
- package/lib/typescript/src/specs/RNMBXPointAnnotationNativeComponent.d.ts +0 -1
- package/lib/typescript/src/specs/RNMBXPointAnnotationNativeComponent.d.ts.map +1 -1
- package/lib/typescript/src/specs/RNMBXRasterDemSourceNativeComponent.d.ts +0 -1
- package/lib/typescript/src/specs/RNMBXRasterDemSourceNativeComponent.d.ts.map +1 -1
- package/lib/typescript/src/specs/RNMBXRasterLayerNativeComponent.d.ts +0 -1
- package/lib/typescript/src/specs/RNMBXRasterLayerNativeComponent.d.ts.map +1 -1
- package/lib/typescript/src/specs/RNMBXRasterSourceNativeComponent.d.ts +0 -1
- package/lib/typescript/src/specs/RNMBXRasterSourceNativeComponent.d.ts.map +1 -1
- package/lib/typescript/src/specs/RNMBXShapeSourceNativeComponent.d.ts +0 -1
- package/lib/typescript/src/specs/RNMBXShapeSourceNativeComponent.d.ts.map +1 -1
- package/lib/typescript/src/specs/RNMBXSkyLayerNativeComponent.d.ts +0 -1
- package/lib/typescript/src/specs/RNMBXSkyLayerNativeComponent.d.ts.map +1 -1
- package/lib/typescript/src/specs/RNMBXStyleImportNativeComponent.d.ts.map +1 -1
- package/lib/typescript/src/specs/RNMBXSymbolLayerNativeComponent.d.ts +0 -1
- package/lib/typescript/src/specs/RNMBXSymbolLayerNativeComponent.d.ts.map +1 -1
- package/lib/typescript/src/specs/RNMBXTerrainNativeComponent.d.ts.map +1 -1
- package/lib/typescript/src/specs/RNMBXVectorSourceNativeComponent.d.ts +0 -1
- package/lib/typescript/src/specs/RNMBXVectorSourceNativeComponent.d.ts.map +1 -1
- package/lib/typescript/src/specs/RNMBXViewportNativeComponent.d.ts +0 -1
- package/lib/typescript/src/specs/RNMBXViewportNativeComponent.d.ts.map +1 -1
- package/lib/typescript/src/specs/codegenUtils.d.ts +1 -2
- package/lib/typescript/src/specs/codegenUtils.d.ts.map +1 -1
- package/lib/typescript/src/utils/BridgeValue.d.ts.map +1 -1
- package/lib/typescript/src/utils/NativeCommands.d.ts +0 -1
- package/lib/typescript/src/utils/NativeCommands.d.ts.map +1 -1
- package/lib/typescript/src/utils/getAnnotationsLayerID.d.ts +1 -1
- package/lib/typescript/src/utils/getAnnotationsLayerID.d.ts.map +1 -1
- package/lib/typescript/src/web/MapContext.d.ts +1 -1
- package/lib/typescript/src/web/MapContext.d.ts.map +1 -1
- package/lib/typescript/src/web/components/Camera.d.ts +2 -2
- package/lib/typescript/src/web/components/Camera.d.ts.map +1 -1
- package/package.json +5 -5
- package/plugin/build/generateCode.js +5 -6
- package/plugin/install.md +2 -2
- package/rnmapbox-maps.podspec +1 -1
- package/src/components/Camera.tsx +83 -1
- package/src/modules/location/locationManager.ts +3 -1
- package/src/specs/NativeRNMBXCameraModule.ts +16 -3
- package/src/specs/codegenUtils.ts +1 -1
- package/src/web/components/Camera.tsx +1 -1
- package/CHANGELOG.md +0 -390
- package/android/.gitignore +0 -9
- package/android/.npmignore +0 -9
- package/lib/commonjs/components/NativeBridgeComponent.tsx +0 -67
- package/lib/commonjs/specs/NativeMapViewModule.ts +0 -54
- package/lib/commonjs/specs/NativeRNMBXCameraModule.ts +0 -36
- package/lib/commonjs/specs/NativeRNMBXChangeLineOffsetsShapeAnimatorModule.ts +0 -37
- package/lib/commonjs/specs/NativeRNMBXImageModule.ts +0 -10
- package/lib/commonjs/specs/NativeRNMBXLocationModule.ts +0 -32
- package/lib/commonjs/specs/NativeRNMBXMovePointShapeAnimatorModule.ts +0 -20
- package/lib/commonjs/specs/NativeRNMBXPointAnnotationModule.ts +0 -12
- package/lib/commonjs/specs/NativeRNMBXShapeSourceModule.ts +0 -23
- package/lib/commonjs/specs/NativeRNMBXTileStoreModule.ts +0 -27
- package/lib/commonjs/specs/NativeRNMBXViewportModule.ts +0 -41
- package/lib/commonjs/utils/NativeCommands.ts +0 -89
- package/lib/module/components/NativeBridgeComponent.tsx +0 -67
- package/lib/module/specs/NativeMapViewModule.ts +0 -54
- package/lib/module/specs/NativeRNMBXCameraModule.ts +0 -36
- package/lib/module/specs/NativeRNMBXChangeLineOffsetsShapeAnimatorModule.ts +0 -37
- package/lib/module/specs/NativeRNMBXImageModule.ts +0 -10
- package/lib/module/specs/NativeRNMBXLocationModule.ts +0 -32
- package/lib/module/specs/NativeRNMBXMovePointShapeAnimatorModule.ts +0 -20
- package/lib/module/specs/NativeRNMBXPointAnnotationModule.ts +0 -12
- package/lib/module/specs/NativeRNMBXShapeSourceModule.ts +0 -23
- package/lib/module/specs/NativeRNMBXTileStoreModule.ts +0 -27
- package/lib/module/specs/NativeRNMBXViewportModule.ts +0 -41
- package/lib/module/utils/NativeCommands.ts +0 -89
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
/* eslint-disable @typescript-eslint/ban-types */
|
|
2
|
-
import type { TurboModule } from 'react-native/Libraries/TurboModule/RCTExport';
|
|
3
|
-
import { Int32 } from 'react-native/Libraries/Types/CodegenTypes';
|
|
4
|
-
import { TurboModuleRegistry } from 'react-native';
|
|
5
|
-
|
|
6
|
-
export interface Spec extends TurboModule {
|
|
7
|
-
getClusterExpansionZoom: (
|
|
8
|
-
viewRef: Int32 | null,
|
|
9
|
-
featureJSON: string,
|
|
10
|
-
) => Promise<Object>;
|
|
11
|
-
getClusterLeaves: (
|
|
12
|
-
viewRef: Int32 | null,
|
|
13
|
-
featureJSON: string,
|
|
14
|
-
number: Int32,
|
|
15
|
-
offset: Int32,
|
|
16
|
-
) => Promise<Object>;
|
|
17
|
-
getClusterChildren: (
|
|
18
|
-
viewRef: Int32 | null,
|
|
19
|
-
featureJSON: string,
|
|
20
|
-
) => Promise<Object>;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
export default TurboModuleRegistry.getEnforcing<Spec>('RNMBXShapeSourceModule');
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import type { TurboModule } from 'react-native/Libraries/TurboModule/RCTExport';
|
|
2
|
-
import { Int32 } from 'react-native/Libraries/Types/CodegenTypes';
|
|
3
|
-
import { TurboModuleRegistry } from 'react-native';
|
|
4
|
-
|
|
5
|
-
// eslint-disable-next-line @typescript-eslint/ban-types, @typescript-eslint/no-unused-vars
|
|
6
|
-
type ObjectOr<T> = Object;
|
|
7
|
-
|
|
8
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
9
|
-
type StringOr<_T> = string;
|
|
10
|
-
|
|
11
|
-
type Domain = 'Maps' | 'Navigation' | 'Search' | 'ADAS';
|
|
12
|
-
|
|
13
|
-
type Tag = Int32;
|
|
14
|
-
|
|
15
|
-
type Value = { value: string | number };
|
|
16
|
-
|
|
17
|
-
export interface Spec extends TurboModule {
|
|
18
|
-
shared(path?: string): Promise<Tag>;
|
|
19
|
-
setOption(
|
|
20
|
-
tag: Tag,
|
|
21
|
-
key: string,
|
|
22
|
-
domain: StringOr<Domain>,
|
|
23
|
-
value: ObjectOr<Value>,
|
|
24
|
-
): Promise<void>;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
export default TurboModuleRegistry.getEnforcing<Spec>('RNMBXTileStoreModule');
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import type { TurboModule } from 'react-native/Libraries/TurboModule/RCTExport';
|
|
2
|
-
import { Int32 } from 'react-native/Libraries/Types/CodegenTypes';
|
|
3
|
-
import { TurboModuleRegistry } from 'react-native';
|
|
4
|
-
|
|
5
|
-
type StateInfo =
|
|
6
|
-
| {
|
|
7
|
-
kind: 'idle';
|
|
8
|
-
}
|
|
9
|
-
| {
|
|
10
|
-
kind: 'state';
|
|
11
|
-
status: string;
|
|
12
|
-
}
|
|
13
|
-
| {
|
|
14
|
-
kind: 'transition';
|
|
15
|
-
toState: string;
|
|
16
|
-
transition: string;
|
|
17
|
-
};
|
|
18
|
-
|
|
19
|
-
// eslint-disable-next-line @typescript-eslint/ban-types, @typescript-eslint/no-unused-vars
|
|
20
|
-
type ObjectOr<T> = Object;
|
|
21
|
-
|
|
22
|
-
type StateReal = { kind: 'followPuck' } /* | { kind: 'overview' } */;
|
|
23
|
-
type State = ObjectOr<StateReal>;
|
|
24
|
-
type TransitionReal =
|
|
25
|
-
| { kind: 'immediate' }
|
|
26
|
-
| { kind: 'default'; options: { maxDurationMs?: number } };
|
|
27
|
-
type Transition = ObjectOr<TransitionReal>;
|
|
28
|
-
|
|
29
|
-
type ViewRef = Int32 | null;
|
|
30
|
-
|
|
31
|
-
export interface Spec extends TurboModule {
|
|
32
|
-
getState(viewRef: ViewRef): Promise<StateInfo>;
|
|
33
|
-
transitionTo(
|
|
34
|
-
viewRef: ViewRef,
|
|
35
|
-
state: State,
|
|
36
|
-
transition: Transition,
|
|
37
|
-
): Promise<void>;
|
|
38
|
-
idle(viewRef: ViewRef): Promise<void>;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
export default TurboModuleRegistry.getEnforcing<Spec>('RNMBXViewportModule');
|
|
@@ -1,89 +0,0 @@
|
|
|
1
|
-
import { NodeHandle, findNodeHandle } from 'react-native';
|
|
2
|
-
|
|
3
|
-
export type NativeArg =
|
|
4
|
-
| string
|
|
5
|
-
| number
|
|
6
|
-
| boolean
|
|
7
|
-
| null
|
|
8
|
-
| { [k: string]: NativeArg }
|
|
9
|
-
| NativeArg[]
|
|
10
|
-
// eslint-disable-next-line @typescript-eslint/ban-types
|
|
11
|
-
| Function
|
|
12
|
-
| GeoJSON.Geometry
|
|
13
|
-
| undefined;
|
|
14
|
-
|
|
15
|
-
type FunctionKeys<T> = keyof {
|
|
16
|
-
// eslint-disable-next-line @typescript-eslint/ban-types
|
|
17
|
-
[K in keyof T as T[K] extends Function ? K : never]: T[K];
|
|
18
|
-
};
|
|
19
|
-
|
|
20
|
-
type RefType = React.Component;
|
|
21
|
-
|
|
22
|
-
export class NativeCommands<Spec extends object> {
|
|
23
|
-
module: Spec;
|
|
24
|
-
|
|
25
|
-
preRefMethodQueue: Array<{
|
|
26
|
-
method: { name: FunctionKeys<Spec>; args: NativeArg[] };
|
|
27
|
-
resolver: (value: unknown) => void;
|
|
28
|
-
}>;
|
|
29
|
-
|
|
30
|
-
nativeRef: RefType | undefined;
|
|
31
|
-
|
|
32
|
-
constructor(module: Spec) {
|
|
33
|
-
this.module = module;
|
|
34
|
-
this.preRefMethodQueue = [];
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
async setNativeRef(nativeRef: RefType) {
|
|
38
|
-
if (nativeRef) {
|
|
39
|
-
this.nativeRef = nativeRef;
|
|
40
|
-
while (this.preRefMethodQueue.length > 0) {
|
|
41
|
-
const item = this.preRefMethodQueue.pop();
|
|
42
|
-
|
|
43
|
-
if (item && item.method && item.resolver) {
|
|
44
|
-
const res = await this._call(
|
|
45
|
-
item.method.name,
|
|
46
|
-
nativeRef,
|
|
47
|
-
item.method.args,
|
|
48
|
-
);
|
|
49
|
-
item.resolver(res);
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
call<T>(name: FunctionKeys<Spec>, args: NativeArg[]): Promise<T> {
|
|
56
|
-
if (this.nativeRef) {
|
|
57
|
-
return this._call(name, this.nativeRef, args);
|
|
58
|
-
} else {
|
|
59
|
-
return new Promise((resolve) => {
|
|
60
|
-
this.preRefMethodQueue.push({
|
|
61
|
-
method: { name, args },
|
|
62
|
-
resolver: resolve as (args: unknown) => void,
|
|
63
|
-
});
|
|
64
|
-
});
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
_call<T>(
|
|
69
|
-
name: FunctionKeys<Spec>,
|
|
70
|
-
nativeRef: RefType,
|
|
71
|
-
args: NativeArg[],
|
|
72
|
-
): Promise<T> {
|
|
73
|
-
const handle = findNodeHandle(nativeRef);
|
|
74
|
-
if (handle) {
|
|
75
|
-
return (
|
|
76
|
-
this.module[name] as (
|
|
77
|
-
arg0: NodeHandle,
|
|
78
|
-
...args: NativeArg[]
|
|
79
|
-
) => Promise<T>
|
|
80
|
-
)(handle, ...args);
|
|
81
|
-
} else {
|
|
82
|
-
throw new Error(
|
|
83
|
-
`Could not find handle for native ref ${module} when trying to invoke ${String(
|
|
84
|
-
name,
|
|
85
|
-
)}`,
|
|
86
|
-
);
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
}
|