@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.
Files changed (233) hide show
  1. package/android/build.gradle +14 -2
  2. package/android/src/main/java/com/rnmapbox/rnmbx/components/annotation/RNMBXMarkerView.kt +1 -1
  3. package/android/src/main/java/com/rnmapbox/rnmbx/components/annotation/RNMBXMarkerViewManager.kt +11 -1
  4. package/android/src/main/java/com/rnmapbox/rnmbx/components/annotation/RNMBXPointAnnotationManager.kt +7 -1
  5. package/android/src/main/java/com/rnmapbox/rnmbx/components/camera/RNMBXCameraManager.kt +25 -4
  6. package/android/src/main/java/com/rnmapbox/rnmbx/components/camera/RNMBXCameraModule.kt +65 -2
  7. package/android/src/main/java/com/rnmapbox/rnmbx/components/camera/RNMBXViewport.kt +4 -4
  8. package/android/src/main/java/com/rnmapbox/rnmbx/components/images/RNMBXImagesManager.kt +30 -4
  9. package/android/src/main/java/com/rnmapbox/rnmbx/components/location/RNMBXCustomLocationProviderManager.kt +4 -0
  10. package/android/src/main/java/com/rnmapbox/rnmbx/components/location/RNMBXNativeUserLocation.kt +1 -1
  11. package/android/src/main/java/com/rnmapbox/rnmbx/components/location/RNMBXNativeUserLocationManager.kt +8 -2
  12. package/android/src/main/java/com/rnmapbox/rnmbx/components/mapview/RNMBXMapViewManager.kt +59 -10
  13. package/android/src/main/java/com/rnmapbox/rnmbx/components/styles/RNMBXStyleImportManager.kt +6 -1
  14. package/android/src/main/java/com/rnmapbox/rnmbx/components/styles/RNMBXStyleValue.kt +9 -5
  15. package/android/src/main/java/com/rnmapbox/rnmbx/components/styles/layers/RNMBXModelLayer.kt +5 -1
  16. package/android/src/main/java/com/rnmapbox/rnmbx/components/styles/layers/RNMBXModelLayerManager.kt +1 -0
  17. package/android/src/main/java/com/rnmapbox/rnmbx/components/styles/sources/RNMBXRasterSourceManager.kt +3 -2
  18. package/android/src/main/java/com/rnmapbox/rnmbx/components/styles/sources/RNMBXShapeSourceManager.kt +19 -4
  19. package/android/src/main/java/com/rnmapbox/rnmbx/components/styles/sources/RNMBXTileSourceManager.kt +8 -3
  20. package/android/src/main/java/com/rnmapbox/rnmbx/components/styles/sources/RNMBXVectorSourceManager.kt +7 -1
  21. package/android/src/main/java/com/rnmapbox/rnmbx/modules/RNMBXLocationModule.kt +7 -5
  22. package/android/src/main/java/com/rnmapbox/rnmbx/utils/extensions/Dynamic.kt +27 -3
  23. package/android/src/main/mapbox-v11-compat/v10/com/rnmapbox/rnmbx/v11compat/Annotation.kt +5 -1
  24. package/android/src/main/old-arch/com/rnmapbox/rnmbx/NativeRNMBXCameraModuleSpec.java +8 -0
  25. package/ios/RNMBX/RNMBXCamera.swift +64 -3
  26. package/ios/RNMBX/RNMBXCameraModule.mm +26 -1
  27. package/ios/RNMBX/RNMBXMarkerViewComponentView.mm +11 -16
  28. package/ios/RNMBX/RNMBXShapeSource.swift +2 -4
  29. package/ios/RNMBX/RNMBXShapeSourceComponentView.mm +1 -1
  30. package/ios/RNMBX/RNMBXShapeSourceViewManager.m +1 -1
  31. package/ios/RNMBX/RNMBXVectorSourceComponentView.mm +1 -1
  32. package/ios/install.md +1 -1
  33. package/lib/commonjs/components/Camera.js +29 -1
  34. package/lib/commonjs/components/Camera.js.map +1 -1
  35. package/lib/commonjs/components/NativeBridgeComponent.js +41 -0
  36. package/lib/commonjs/components/NativeBridgeComponent.js.map +1 -0
  37. package/lib/commonjs/modules/location/locationManager.js +3 -1
  38. package/lib/commonjs/modules/location/locationManager.js.map +1 -1
  39. package/lib/commonjs/plugin/build/generateCode.js +5 -6
  40. package/lib/commonjs/plugin/install.md +2 -2
  41. package/lib/commonjs/specs/NativeMapViewModule.js +10 -0
  42. package/lib/commonjs/specs/NativeMapViewModule.js.map +1 -0
  43. package/lib/commonjs/specs/NativeRNMBXCameraModule.js +10 -0
  44. package/lib/commonjs/specs/NativeRNMBXCameraModule.js.map +1 -0
  45. package/lib/commonjs/specs/NativeRNMBXChangeLineOffsetsShapeAnimatorModule.js +10 -0
  46. package/lib/commonjs/specs/NativeRNMBXChangeLineOffsetsShapeAnimatorModule.js.map +1 -0
  47. package/lib/commonjs/specs/NativeRNMBXImageModule.js +10 -0
  48. package/lib/commonjs/specs/NativeRNMBXImageModule.js.map +1 -0
  49. package/lib/commonjs/specs/NativeRNMBXLocationModule.js +9 -0
  50. package/lib/commonjs/specs/NativeRNMBXLocationModule.js.map +1 -0
  51. package/lib/commonjs/specs/NativeRNMBXMovePointShapeAnimatorModule.js +10 -0
  52. package/lib/commonjs/specs/NativeRNMBXMovePointShapeAnimatorModule.js.map +1 -0
  53. package/lib/commonjs/specs/NativeRNMBXPointAnnotationModule.js +10 -0
  54. package/lib/commonjs/specs/NativeRNMBXPointAnnotationModule.js.map +1 -0
  55. package/lib/commonjs/specs/NativeRNMBXShapeSourceModule.js +10 -0
  56. package/lib/commonjs/specs/NativeRNMBXShapeSourceModule.js.map +1 -0
  57. package/lib/commonjs/specs/NativeRNMBXTileStoreModule.js +11 -0
  58. package/lib/commonjs/specs/NativeRNMBXTileStoreModule.js.map +1 -0
  59. package/lib/commonjs/specs/NativeRNMBXViewportModule.js +10 -0
  60. package/lib/commonjs/specs/NativeRNMBXViewportModule.js.map +1 -0
  61. package/lib/commonjs/utils/NativeCommands.js +50 -0
  62. package/lib/commonjs/utils/NativeCommands.js.map +1 -0
  63. package/lib/{module/utils/nativeRef.ts → commonjs/utils/nativeRef.js} +8 -9
  64. package/lib/commonjs/utils/nativeRef.js.map +1 -0
  65. package/lib/module/components/Camera.js +29 -1
  66. package/lib/module/components/Camera.js.map +1 -1
  67. package/lib/module/components/NativeBridgeComponent.js +37 -0
  68. package/lib/module/components/NativeBridgeComponent.js.map +1 -0
  69. package/lib/module/modules/location/locationManager.js +3 -1
  70. package/lib/module/modules/location/locationManager.js.map +1 -1
  71. package/lib/module/specs/NativeMapViewModule.js +7 -0
  72. package/lib/module/specs/NativeMapViewModule.js.map +1 -0
  73. package/lib/module/specs/NativeRNMBXCameraModule.js +8 -0
  74. package/lib/module/specs/NativeRNMBXCameraModule.js.map +1 -0
  75. package/lib/module/specs/NativeRNMBXChangeLineOffsetsShapeAnimatorModule.js +8 -0
  76. package/lib/module/specs/NativeRNMBXChangeLineOffsetsShapeAnimatorModule.js.map +1 -0
  77. package/lib/module/specs/NativeRNMBXImageModule.js +7 -0
  78. package/lib/module/specs/NativeRNMBXImageModule.js.map +1 -0
  79. package/lib/module/specs/NativeRNMBXLocationModule.js +5 -0
  80. package/lib/module/specs/NativeRNMBXLocationModule.js.map +1 -0
  81. package/lib/module/specs/NativeRNMBXMovePointShapeAnimatorModule.js +8 -0
  82. package/lib/module/specs/NativeRNMBXMovePointShapeAnimatorModule.js.map +1 -0
  83. package/lib/module/specs/NativeRNMBXPointAnnotationModule.js +7 -0
  84. package/lib/module/specs/NativeRNMBXPointAnnotationModule.js.map +1 -0
  85. package/lib/module/specs/NativeRNMBXShapeSourceModule.js +7 -0
  86. package/lib/module/specs/NativeRNMBXShapeSourceModule.js.map +1 -0
  87. package/lib/module/specs/NativeRNMBXTileStoreModule.js +10 -0
  88. package/lib/module/specs/NativeRNMBXTileStoreModule.js.map +1 -0
  89. package/lib/module/specs/NativeRNMBXViewportModule.js +8 -0
  90. package/lib/module/specs/NativeRNMBXViewportModule.js.map +1 -0
  91. package/lib/module/utils/NativeCommands.js +45 -0
  92. package/lib/module/utils/NativeCommands.js.map +1 -0
  93. package/lib/{commonjs/utils/nativeRef.ts → module/utils/nativeRef.js} +4 -9
  94. package/lib/module/utils/nativeRef.js.map +1 -0
  95. package/lib/typescript/src/Mapbox.d.ts +0 -1
  96. package/lib/typescript/src/Mapbox.d.ts.map +1 -1
  97. package/lib/typescript/src/RNMBXModule.d.ts +1 -1
  98. package/lib/typescript/src/RNMBXModule.d.ts.map +1 -1
  99. package/lib/typescript/src/components/AbstractLayer.d.ts.map +1 -1
  100. package/lib/typescript/src/components/Camera.d.ts +20 -0
  101. package/lib/typescript/src/components/Camera.d.ts.map +1 -1
  102. package/lib/typescript/src/components/HeadingIndicator.d.ts.map +1 -1
  103. package/lib/typescript/src/components/Light.d.ts.map +1 -1
  104. package/lib/typescript/src/components/MapView.d.ts +4 -3
  105. package/lib/typescript/src/components/MapView.d.ts.map +1 -1
  106. package/lib/typescript/src/components/NativeBridgeComponent.d.ts +4 -4
  107. package/lib/typescript/src/components/NativeBridgeComponent.d.ts.map +1 -1
  108. package/lib/typescript/src/components/PointAnnotation.d.ts +4 -3
  109. package/lib/typescript/src/components/PointAnnotation.d.ts.map +1 -1
  110. package/lib/typescript/src/components/ShapeSource.d.ts +4 -3
  111. package/lib/typescript/src/components/ShapeSource.d.ts.map +1 -1
  112. package/lib/typescript/src/components/Style.d.ts.map +1 -1
  113. package/lib/typescript/src/modules/location/locationManager.d.ts.map +1 -1
  114. package/lib/typescript/src/specs/NativeMapViewModule.d.ts +0 -1
  115. package/lib/typescript/src/specs/NativeMapViewModule.d.ts.map +1 -1
  116. package/lib/typescript/src/specs/NativeRNMBXCameraModule.d.ts +3 -3
  117. package/lib/typescript/src/specs/NativeRNMBXCameraModule.d.ts.map +1 -1
  118. package/lib/typescript/src/specs/NativeRNMBXChangeLineOffsetsShapeAnimatorModule.d.ts +0 -1
  119. package/lib/typescript/src/specs/NativeRNMBXChangeLineOffsetsShapeAnimatorModule.d.ts.map +1 -1
  120. package/lib/typescript/src/specs/NativeRNMBXImageModule.d.ts +0 -1
  121. package/lib/typescript/src/specs/NativeRNMBXImageModule.d.ts.map +1 -1
  122. package/lib/typescript/src/specs/NativeRNMBXLocationModule.d.ts +0 -1
  123. package/lib/typescript/src/specs/NativeRNMBXLocationModule.d.ts.map +1 -1
  124. package/lib/typescript/src/specs/NativeRNMBXMovePointShapeAnimatorModule.d.ts +0 -1
  125. package/lib/typescript/src/specs/NativeRNMBXMovePointShapeAnimatorModule.d.ts.map +1 -1
  126. package/lib/typescript/src/specs/NativeRNMBXPointAnnotationModule.d.ts +0 -1
  127. package/lib/typescript/src/specs/NativeRNMBXPointAnnotationModule.d.ts.map +1 -1
  128. package/lib/typescript/src/specs/NativeRNMBXShapeSourceModule.d.ts +0 -1
  129. package/lib/typescript/src/specs/NativeRNMBXShapeSourceModule.d.ts.map +1 -1
  130. package/lib/typescript/src/specs/NativeRNMBXTileStoreModule.d.ts +0 -1
  131. package/lib/typescript/src/specs/NativeRNMBXTileStoreModule.d.ts.map +1 -1
  132. package/lib/typescript/src/specs/NativeRNMBXViewportModule.d.ts +0 -1
  133. package/lib/typescript/src/specs/NativeRNMBXViewportModule.d.ts.map +1 -1
  134. package/lib/typescript/src/specs/RNMBXAtmosphereNativeComponent.d.ts.map +1 -1
  135. package/lib/typescript/src/specs/RNMBXBackgroundLayerNativeComponent.d.ts +0 -1
  136. package/lib/typescript/src/specs/RNMBXBackgroundLayerNativeComponent.d.ts.map +1 -1
  137. package/lib/typescript/src/specs/RNMBXCalloutNativeComponent.d.ts.map +1 -1
  138. package/lib/typescript/src/specs/RNMBXCameraNativeComponent.d.ts +0 -1
  139. package/lib/typescript/src/specs/RNMBXCameraNativeComponent.d.ts.map +1 -1
  140. package/lib/typescript/src/specs/RNMBXCircleLayerNativeComponent.d.ts +0 -1
  141. package/lib/typescript/src/specs/RNMBXCircleLayerNativeComponent.d.ts.map +1 -1
  142. package/lib/typescript/src/specs/RNMBXCustomLocationProviderNativeComponent.d.ts +0 -1
  143. package/lib/typescript/src/specs/RNMBXCustomLocationProviderNativeComponent.d.ts.map +1 -1
  144. package/lib/typescript/src/specs/RNMBXFillExtrusionLayerNativeComponent.d.ts +0 -1
  145. package/lib/typescript/src/specs/RNMBXFillExtrusionLayerNativeComponent.d.ts.map +1 -1
  146. package/lib/typescript/src/specs/RNMBXFillLayerNativeComponent.d.ts +0 -1
  147. package/lib/typescript/src/specs/RNMBXFillLayerNativeComponent.d.ts.map +1 -1
  148. package/lib/typescript/src/specs/RNMBXHeatmapLayerNativeComponent.d.ts +0 -1
  149. package/lib/typescript/src/specs/RNMBXHeatmapLayerNativeComponent.d.ts.map +1 -1
  150. package/lib/typescript/src/specs/RNMBXImageNativeComponent.d.ts +0 -1
  151. package/lib/typescript/src/specs/RNMBXImageNativeComponent.d.ts.map +1 -1
  152. package/lib/typescript/src/specs/RNMBXImageSourceNativeComponent.d.ts.map +1 -1
  153. package/lib/typescript/src/specs/RNMBXImagesNativeComponent.d.ts +0 -1
  154. package/lib/typescript/src/specs/RNMBXImagesNativeComponent.d.ts.map +1 -1
  155. package/lib/typescript/src/specs/RNMBXLightNativeComponent.d.ts.map +1 -1
  156. package/lib/typescript/src/specs/RNMBXLineLayerNativeComponent.d.ts +0 -1
  157. package/lib/typescript/src/specs/RNMBXLineLayerNativeComponent.d.ts.map +1 -1
  158. package/lib/typescript/src/specs/RNMBXMapViewNativeComponent.d.ts +0 -1
  159. package/lib/typescript/src/specs/RNMBXMapViewNativeComponent.d.ts.map +1 -1
  160. package/lib/typescript/src/specs/RNMBXMarkerViewContentNativeComponent.d.ts.map +1 -1
  161. package/lib/typescript/src/specs/RNMBXMarkerViewNativeComponent.d.ts +0 -1
  162. package/lib/typescript/src/specs/RNMBXMarkerViewNativeComponent.d.ts.map +1 -1
  163. package/lib/typescript/src/specs/RNMBXModelLayerNativeComponent.d.ts +0 -1
  164. package/lib/typescript/src/specs/RNMBXModelLayerNativeComponent.d.ts.map +1 -1
  165. package/lib/typescript/src/specs/RNMBXModelsNativeComponent.d.ts.map +1 -1
  166. package/lib/typescript/src/specs/RNMBXNativeUserLocationNativeComponent.d.ts.map +1 -1
  167. package/lib/typescript/src/specs/RNMBXPointAnnotationNativeComponent.d.ts +0 -1
  168. package/lib/typescript/src/specs/RNMBXPointAnnotationNativeComponent.d.ts.map +1 -1
  169. package/lib/typescript/src/specs/RNMBXRasterDemSourceNativeComponent.d.ts +0 -1
  170. package/lib/typescript/src/specs/RNMBXRasterDemSourceNativeComponent.d.ts.map +1 -1
  171. package/lib/typescript/src/specs/RNMBXRasterLayerNativeComponent.d.ts +0 -1
  172. package/lib/typescript/src/specs/RNMBXRasterLayerNativeComponent.d.ts.map +1 -1
  173. package/lib/typescript/src/specs/RNMBXRasterSourceNativeComponent.d.ts +0 -1
  174. package/lib/typescript/src/specs/RNMBXRasterSourceNativeComponent.d.ts.map +1 -1
  175. package/lib/typescript/src/specs/RNMBXShapeSourceNativeComponent.d.ts +0 -1
  176. package/lib/typescript/src/specs/RNMBXShapeSourceNativeComponent.d.ts.map +1 -1
  177. package/lib/typescript/src/specs/RNMBXSkyLayerNativeComponent.d.ts +0 -1
  178. package/lib/typescript/src/specs/RNMBXSkyLayerNativeComponent.d.ts.map +1 -1
  179. package/lib/typescript/src/specs/RNMBXStyleImportNativeComponent.d.ts.map +1 -1
  180. package/lib/typescript/src/specs/RNMBXSymbolLayerNativeComponent.d.ts +0 -1
  181. package/lib/typescript/src/specs/RNMBXSymbolLayerNativeComponent.d.ts.map +1 -1
  182. package/lib/typescript/src/specs/RNMBXTerrainNativeComponent.d.ts.map +1 -1
  183. package/lib/typescript/src/specs/RNMBXVectorSourceNativeComponent.d.ts +0 -1
  184. package/lib/typescript/src/specs/RNMBXVectorSourceNativeComponent.d.ts.map +1 -1
  185. package/lib/typescript/src/specs/RNMBXViewportNativeComponent.d.ts +0 -1
  186. package/lib/typescript/src/specs/RNMBXViewportNativeComponent.d.ts.map +1 -1
  187. package/lib/typescript/src/specs/codegenUtils.d.ts +1 -2
  188. package/lib/typescript/src/specs/codegenUtils.d.ts.map +1 -1
  189. package/lib/typescript/src/utils/BridgeValue.d.ts.map +1 -1
  190. package/lib/typescript/src/utils/NativeCommands.d.ts +0 -1
  191. package/lib/typescript/src/utils/NativeCommands.d.ts.map +1 -1
  192. package/lib/typescript/src/utils/getAnnotationsLayerID.d.ts +1 -1
  193. package/lib/typescript/src/utils/getAnnotationsLayerID.d.ts.map +1 -1
  194. package/lib/typescript/src/web/MapContext.d.ts +1 -1
  195. package/lib/typescript/src/web/MapContext.d.ts.map +1 -1
  196. package/lib/typescript/src/web/components/Camera.d.ts +2 -2
  197. package/lib/typescript/src/web/components/Camera.d.ts.map +1 -1
  198. package/package.json +5 -5
  199. package/plugin/build/generateCode.js +5 -6
  200. package/plugin/install.md +2 -2
  201. package/rnmapbox-maps.podspec +1 -1
  202. package/src/components/Camera.tsx +83 -1
  203. package/src/modules/location/locationManager.ts +3 -1
  204. package/src/specs/NativeRNMBXCameraModule.ts +16 -3
  205. package/src/specs/codegenUtils.ts +1 -1
  206. package/src/web/components/Camera.tsx +1 -1
  207. package/CHANGELOG.md +0 -390
  208. package/android/.gitignore +0 -9
  209. package/android/.npmignore +0 -9
  210. package/lib/commonjs/components/NativeBridgeComponent.tsx +0 -67
  211. package/lib/commonjs/specs/NativeMapViewModule.ts +0 -54
  212. package/lib/commonjs/specs/NativeRNMBXCameraModule.ts +0 -36
  213. package/lib/commonjs/specs/NativeRNMBXChangeLineOffsetsShapeAnimatorModule.ts +0 -37
  214. package/lib/commonjs/specs/NativeRNMBXImageModule.ts +0 -10
  215. package/lib/commonjs/specs/NativeRNMBXLocationModule.ts +0 -32
  216. package/lib/commonjs/specs/NativeRNMBXMovePointShapeAnimatorModule.ts +0 -20
  217. package/lib/commonjs/specs/NativeRNMBXPointAnnotationModule.ts +0 -12
  218. package/lib/commonjs/specs/NativeRNMBXShapeSourceModule.ts +0 -23
  219. package/lib/commonjs/specs/NativeRNMBXTileStoreModule.ts +0 -27
  220. package/lib/commonjs/specs/NativeRNMBXViewportModule.ts +0 -41
  221. package/lib/commonjs/utils/NativeCommands.ts +0 -89
  222. package/lib/module/components/NativeBridgeComponent.tsx +0 -67
  223. package/lib/module/specs/NativeMapViewModule.ts +0 -54
  224. package/lib/module/specs/NativeRNMBXCameraModule.ts +0 -36
  225. package/lib/module/specs/NativeRNMBXChangeLineOffsetsShapeAnimatorModule.ts +0 -37
  226. package/lib/module/specs/NativeRNMBXImageModule.ts +0 -10
  227. package/lib/module/specs/NativeRNMBXLocationModule.ts +0 -32
  228. package/lib/module/specs/NativeRNMBXMovePointShapeAnimatorModule.ts +0 -20
  229. package/lib/module/specs/NativeRNMBXPointAnnotationModule.ts +0 -12
  230. package/lib/module/specs/NativeRNMBXShapeSourceModule.ts +0 -23
  231. package/lib/module/specs/NativeRNMBXTileStoreModule.ts +0 -27
  232. package/lib/module/specs/NativeRNMBXViewportModule.ts +0 -41
  233. 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
- }