@rnmapbox/maps 10.1.0-beta.14 → 10.1.0-beta.15

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 (293) hide show
  1. package/android/build.gradle +1 -1
  2. package/android/src/main/java/com/rnmapbox/rnmbx/RNMBXPackage.kt +22 -3
  3. package/android/src/main/java/com/rnmapbox/rnmbx/components/annotation/RNMBXCalloutManager.kt +33 -0
  4. package/android/src/main/java/com/rnmapbox/rnmbx/components/annotation/RNMBXMarkerViewManager.kt +24 -10
  5. package/android/src/main/java/com/rnmapbox/rnmbx/components/annotation/RNMBXPointAnnotationManager.kt +70 -0
  6. package/android/src/main/java/com/rnmapbox/rnmbx/components/annotation/RNMBXPointAnnotationModule.kt +33 -0
  7. package/android/src/main/java/com/rnmapbox/rnmbx/components/images/RNMBXImageManager.kt +11 -21
  8. package/android/src/main/java/com/rnmapbox/rnmbx/components/images/RNMBXImageModule.kt +33 -0
  9. package/android/src/main/java/com/rnmapbox/rnmbx/components/images/RNMBXImagesManager.kt +9 -8
  10. package/android/src/main/java/com/rnmapbox/rnmbx/components/location/RNMBXNativeUserLocationManager.kt +11 -4
  11. package/android/src/main/java/com/rnmapbox/rnmbx/components/mapview/RNMBXMapView.kt +140 -63
  12. package/android/src/main/java/com/rnmapbox/rnmbx/components/mapview/RNMBXMapViewManager.kt +71 -55
  13. package/android/src/main/java/com/rnmapbox/rnmbx/components/styles/atmosphere/RNMBXAtmosphereManager.kt +0 -5
  14. package/android/src/main/java/com/rnmapbox/rnmbx/components/styles/light/RNMBXLightManager.kt +27 -0
  15. package/android/src/main/java/com/rnmapbox/rnmbx/components/styles/sources/RNMBXImageSourceManager.kt +16 -8
  16. package/android/src/main/java/com/rnmapbox/rnmbx/components/styles/sources/RNMBXRasterDemSourceManager.kt +15 -1
  17. package/android/src/main/java/com/rnmapbox/rnmbx/components/styles/sources/RNMBXRasterSourceManager.kt +11 -3
  18. package/android/src/main/java/com/rnmapbox/rnmbx/components/styles/sources/RNMBXShapeSource.kt +0 -2
  19. package/android/src/main/java/com/rnmapbox/rnmbx/components/styles/sources/RNMBXShapeSourceManager.kt +32 -31
  20. package/android/src/main/java/com/rnmapbox/rnmbx/components/styles/sources/RNMBXSource.kt +1 -1
  21. package/android/src/main/java/com/rnmapbox/rnmbx/components/styles/sources/RNMBXTileSourceManager.kt +17 -17
  22. package/android/src/main/java/com/rnmapbox/rnmbx/components/styles/sources/RNMBXVectorSourceManager.kt +13 -32
  23. package/android/src/main/java/com/rnmapbox/rnmbx/components/styles/terrain/RNMBXTerrainManager.kt +8 -11
  24. package/android/src/main/java/com/rnmapbox/rnmbx/utils/PropertyChanges.kt +68 -0
  25. package/android/src/main/old-arch/com/facebook/react/viewmanagers/RNMBXCalloutManagerDelegate.java +25 -0
  26. package/android/src/main/old-arch/com/facebook/react/viewmanagers/RNMBXCalloutManagerInterface.java +16 -0
  27. package/android/src/main/old-arch/com/facebook/react/viewmanagers/RNMBXImageManagerDelegate.java +47 -0
  28. package/android/src/main/old-arch/com/facebook/react/viewmanagers/RNMBXImageManagerInterface.java +22 -0
  29. package/android/src/main/old-arch/com/facebook/react/viewmanagers/RNMBXImagesManagerDelegate.java +38 -0
  30. package/android/src/main/old-arch/com/facebook/react/viewmanagers/RNMBXImagesManagerInterface.java +19 -0
  31. package/android/src/main/old-arch/com/facebook/react/viewmanagers/RNMBXLightManagerDelegate.java +32 -0
  32. package/android/src/main/old-arch/com/facebook/react/viewmanagers/RNMBXLightManagerInterface.java +17 -0
  33. package/android/src/main/old-arch/com/facebook/react/viewmanagers/RNMBXMapViewManagerDelegate.java +3 -0
  34. package/android/src/main/old-arch/com/facebook/react/viewmanagers/RNMBXMapViewManagerInterface.java +1 -0
  35. package/android/src/main/old-arch/com/facebook/react/viewmanagers/RNMBXMarkerViewManagerDelegate.java +41 -0
  36. package/android/src/main/old-arch/com/facebook/react/viewmanagers/RNMBXMarkerViewManagerInterface.java +20 -0
  37. package/android/src/main/old-arch/com/facebook/react/viewmanagers/RNMBXNativeUserLocationManagerDelegate.java +35 -0
  38. package/android/src/main/old-arch/com/facebook/react/viewmanagers/RNMBXNativeUserLocationManagerInterface.java +18 -0
  39. package/android/src/main/old-arch/com/facebook/react/viewmanagers/RNMBXPointAnnotationManagerDelegate.java +41 -0
  40. package/android/src/main/old-arch/com/facebook/react/viewmanagers/RNMBXPointAnnotationManagerInterface.java +20 -0
  41. package/android/src/main/old-arch/com/facebook/react/viewmanagers/RNMBXShapeSourceManagerDelegate.java +0 -6
  42. package/android/src/main/old-arch/com/facebook/react/viewmanagers/RNMBXShapeSourceManagerInterface.java +0 -2
  43. package/android/src/main/old-arch/com/facebook/react/viewmanagers/RNMBXTerrainManagerDelegate.java +35 -0
  44. package/android/src/main/old-arch/com/facebook/react/viewmanagers/RNMBXTerrainManagerInterface.java +18 -0
  45. package/android/src/main/old-arch/com/rnmapbox/rnmbx/NativeRNMBXImageModuleSpec.java +40 -0
  46. package/android/src/main/old-arch/com/rnmapbox/rnmbx/NativeRNMBXPointAnnotationModuleSpec.java +40 -0
  47. package/ios/RNMBX/RNMBXAtmosphereComponentView.mm +2 -0
  48. package/ios/RNMBX/RNMBXCallout.swift +1 -1
  49. package/ios/RNMBX/RNMBXCalloutComponentView.h +15 -0
  50. package/ios/RNMBX/RNMBXCalloutComponentView.mm +57 -0
  51. package/ios/RNMBX/{RNMBXCalloutManager.m → RNMBXCalloutViewManager.m} +1 -1
  52. package/ios/RNMBX/{RNMBXCalloutManager.swift → RNMBXCalloutViewManager.swift} +2 -2
  53. package/ios/RNMBX/RNMBXFabricHelpers.h +1 -8
  54. package/ios/RNMBX/RNMBXImage.swift +30 -22
  55. package/ios/RNMBX/RNMBXImageComponentView.h +15 -0
  56. package/ios/RNMBX/RNMBXImageComponentView.mm +100 -0
  57. package/ios/RNMBX/RNMBXImageManager.swift +0 -1
  58. package/ios/RNMBX/RNMBXImageModule.h +17 -0
  59. package/ios/RNMBX/RNMBXImageModule.mm +67 -0
  60. package/ios/RNMBX/RNMBXImages.swift +10 -10
  61. package/ios/RNMBX/RNMBXImagesComponentView.h +15 -0
  62. package/ios/RNMBX/RNMBXImagesComponentView.mm +91 -0
  63. package/ios/RNMBX/{RNMBXImagesManager.m → RNMBXImagesViewManager.m} +1 -2
  64. package/ios/RNMBX/{RNMBXImagesManager.swift → RNMBXImagesViewManager.swift} +2 -2
  65. package/ios/RNMBX/RNMBXLight.swift +7 -7
  66. package/ios/RNMBX/RNMBXLightComponentView.h +15 -0
  67. package/ios/RNMBX/RNMBXLightComponentView.mm +68 -0
  68. package/ios/RNMBX/{RNMBXLightManager.m → RNMBXLightViewManager.m} +1 -1
  69. package/ios/RNMBX/{RNMBXLightManager.swift → RNMBXLightViewManager.swift} +2 -2
  70. package/ios/RNMBX/RNMBXMapViewComponentView.mm +0 -1
  71. package/ios/RNMBX/RNMBXMarkerView.swift +23 -16
  72. package/ios/RNMBX/RNMBXMarkerViewComponentView.h +15 -0
  73. package/ios/RNMBX/RNMBXMarkerViewComponentView.mm +130 -0
  74. package/ios/RNMBX/RNMBXNativeUserLocation.swift +3 -3
  75. package/ios/RNMBX/RNMBXNativeUserLocationComponentView.h +15 -0
  76. package/ios/RNMBX/RNMBXNativeUserLocationComponentView.mm +72 -0
  77. package/ios/RNMBX/{RNMBXNativeUserLocationManager.m → RNMBXNativeUserLocationViewManager.m} +1 -1
  78. package/ios/RNMBX/{RNMBXNativeUserLocationManager.swift → RNMBXNativeUserLocationViewManager.swift} +2 -2
  79. package/ios/RNMBX/RNMBXPointAnnotation.swift +41 -30
  80. package/ios/RNMBX/RNMBXPointAnnotationComponentView.h +15 -0
  81. package/ios/RNMBX/RNMBXPointAnnotationComponentView.mm +147 -0
  82. package/ios/RNMBX/RNMBXPointAnnotationModule.h +17 -0
  83. package/ios/RNMBX/RNMBXPointAnnotationModule.mm +66 -0
  84. package/ios/RNMBX/{RNMBXPointAnnotationManager.m → RNMBXPointAnnotationViewManager.m} +1 -6
  85. package/ios/RNMBX/RNMBXPointAnnotationViewManager.swift +14 -0
  86. package/ios/RNMBX/RNMBXRasterDemSourceComponentView.h +1 -3
  87. package/ios/RNMBX/RNMBXRasterDemSourceComponentView.mm +0 -2
  88. package/ios/RNMBX/RNMBXRasterSourceComponentView.h +1 -3
  89. package/ios/RNMBX/RNMBXRasterSourceComponentView.mm +0 -2
  90. package/ios/RNMBX/RNMBXShapeSourceComponentView.h +1 -3
  91. package/ios/RNMBX/RNMBXShapeSourceComponentView.mm +4 -6
  92. package/ios/RNMBX/RNMBXShapeSourceModule.mm +1 -9
  93. package/ios/RNMBX/RNMBXSingletonLayer.swift +1 -1
  94. package/ios/RNMBX/RNMBXTerrain.swift +2 -2
  95. package/ios/RNMBX/RNMBXTerrainComponentView.h +15 -0
  96. package/ios/RNMBX/RNMBXTerrainComponentView.mm +78 -0
  97. package/ios/RNMBX/{RNMBXTerrainManager.m → RNMBXTerrainViewManager.m} +1 -1
  98. package/ios/RNMBX/{RNMBXTerrainManager.swift → RNMBXTerrainViewManager.swift} +2 -2
  99. package/ios/RNMBX/RNMBXVectorSourceComponentView.h +1 -3
  100. package/ios/RNMBX/RNMBXVectorSourceComponentView.mm +0 -2
  101. package/ios/RNMBX/rnmapbox_maps-Swift.pre.h +0 -2
  102. package/lib/commonjs/components/Callout.js +3 -4
  103. package/lib/commonjs/components/Callout.js.map +1 -1
  104. package/lib/commonjs/components/Image.js +20 -4
  105. package/lib/commonjs/components/Image.js.map +1 -1
  106. package/lib/commonjs/components/Images.js +6 -3
  107. package/lib/commonjs/components/Images.js.map +1 -1
  108. package/lib/commonjs/components/Light.js +5 -5
  109. package/lib/commonjs/components/Light.js.map +1 -1
  110. package/lib/commonjs/components/MapView.js +12 -49
  111. package/lib/commonjs/components/MapView.js.map +1 -1
  112. package/lib/commonjs/components/MarkerView.js +2 -1
  113. package/lib/commonjs/components/MarkerView.js.map +1 -1
  114. package/lib/commonjs/components/NativeBridgeComponent.js +6 -43
  115. package/lib/commonjs/components/NativeBridgeComponent.js.map +1 -1
  116. package/lib/commonjs/components/NativeUserLocation.js +3 -4
  117. package/lib/commonjs/components/NativeUserLocation.js.map +1 -1
  118. package/lib/commonjs/components/PointAnnotation.js +29 -14
  119. package/lib/commonjs/components/PointAnnotation.js.map +1 -1
  120. package/lib/commonjs/components/ShapeSource.js +7 -18
  121. package/lib/commonjs/components/ShapeSource.js.map +1 -1
  122. package/lib/commonjs/components/Terrain.js +4 -5
  123. package/lib/commonjs/components/Terrain.js.map +1 -1
  124. package/lib/commonjs/components/VectorSource.js +2 -11
  125. package/lib/commonjs/components/VectorSource.js.map +1 -1
  126. package/lib/commonjs/specs/NativeRNMBXImageModule.js +10 -0
  127. package/lib/commonjs/specs/NativeRNMBXImageModule.js.map +1 -0
  128. package/lib/commonjs/specs/NativeRNMBXPointAnnotationModule.js +10 -0
  129. package/lib/commonjs/specs/NativeRNMBXPointAnnotationModule.js.map +1 -0
  130. package/lib/commonjs/specs/RNMBXCalloutNativeComponent.js +11 -0
  131. package/lib/commonjs/specs/RNMBXCalloutNativeComponent.js.map +1 -0
  132. package/lib/commonjs/specs/{RNMBXAndroidTextureMapViewNativeComponent.js → RNMBXImageNativeComponent.js} +2 -4
  133. package/lib/commonjs/specs/RNMBXImageNativeComponent.js.map +1 -0
  134. package/lib/commonjs/specs/RNMBXImagesNativeComponent.js +10 -0
  135. package/lib/commonjs/specs/RNMBXImagesNativeComponent.js.map +1 -0
  136. package/lib/commonjs/specs/RNMBXLightNativeComponent.js +10 -0
  137. package/lib/commonjs/specs/RNMBXLightNativeComponent.js.map +1 -0
  138. package/lib/commonjs/specs/RNMBXMapViewNativeComponent.js +1 -1
  139. package/lib/commonjs/specs/RNMBXMapViewNativeComponent.js.map +1 -1
  140. package/lib/commonjs/specs/RNMBXMarkerViewNativeComponent.js +10 -0
  141. package/lib/commonjs/specs/RNMBXMarkerViewNativeComponent.js.map +1 -0
  142. package/lib/commonjs/specs/RNMBXNativeUserLocationNativeComponent.js +10 -0
  143. package/lib/commonjs/specs/RNMBXNativeUserLocationNativeComponent.js.map +1 -0
  144. package/lib/commonjs/specs/RNMBXPointAnnotationNativeComponent.js +10 -0
  145. package/lib/commonjs/specs/RNMBXPointAnnotationNativeComponent.js.map +1 -0
  146. package/lib/commonjs/specs/RNMBXShapeSourceNativeComponent.js.map +1 -1
  147. package/lib/commonjs/specs/RNMBXTerrainNativeComponent.js +10 -0
  148. package/lib/commonjs/specs/RNMBXTerrainNativeComponent.js.map +1 -0
  149. package/lib/commonjs/utils/index.js +6 -30
  150. package/lib/commonjs/utils/index.js.map +1 -1
  151. package/lib/module/components/Callout.js +3 -4
  152. package/lib/module/components/Callout.js.map +1 -1
  153. package/lib/module/components/Image.js +19 -4
  154. package/lib/module/components/Image.js.map +1 -1
  155. package/lib/module/components/Images.js +7 -4
  156. package/lib/module/components/Images.js.map +1 -1
  157. package/lib/module/components/Light.js +4 -4
  158. package/lib/module/components/Light.js.map +1 -1
  159. package/lib/module/components/MapView.js +12 -49
  160. package/lib/module/components/MapView.js.map +1 -1
  161. package/lib/module/components/MarkerView.js +3 -2
  162. package/lib/module/components/MarkerView.js.map +1 -1
  163. package/lib/module/components/NativeBridgeComponent.js +7 -44
  164. package/lib/module/components/NativeBridgeComponent.js.map +1 -1
  165. package/lib/module/components/NativeUserLocation.js +2 -4
  166. package/lib/module/components/NativeUserLocation.js.map +1 -1
  167. package/lib/module/components/PointAnnotation.js +30 -15
  168. package/lib/module/components/PointAnnotation.js.map +1 -1
  169. package/lib/module/components/ShapeSource.js +7 -18
  170. package/lib/module/components/ShapeSource.js.map +1 -1
  171. package/lib/module/components/Terrain.js +2 -4
  172. package/lib/module/components/Terrain.js.map +1 -1
  173. package/lib/module/components/VectorSource.js +2 -11
  174. package/lib/module/components/VectorSource.js.map +1 -1
  175. package/lib/module/specs/NativeRNMBXImageModule.js +5 -0
  176. package/lib/module/specs/NativeRNMBXImageModule.js.map +1 -0
  177. package/lib/module/specs/NativeRNMBXPointAnnotationModule.js +5 -0
  178. package/lib/module/specs/NativeRNMBXPointAnnotationModule.js.map +1 -0
  179. package/lib/module/specs/RNMBXCalloutNativeComponent.js +6 -0
  180. package/lib/module/specs/RNMBXCalloutNativeComponent.js.map +1 -0
  181. package/lib/module/specs/RNMBXImageNativeComponent.js +3 -0
  182. package/lib/module/specs/RNMBXImageNativeComponent.js.map +1 -0
  183. package/lib/module/specs/RNMBXImagesNativeComponent.js +3 -0
  184. package/lib/module/specs/RNMBXImagesNativeComponent.js.map +1 -0
  185. package/lib/module/specs/RNMBXLightNativeComponent.js +3 -0
  186. package/lib/module/specs/RNMBXLightNativeComponent.js.map +1 -0
  187. package/lib/module/specs/RNMBXMapViewNativeComponent.js +2 -0
  188. package/lib/module/specs/RNMBXMapViewNativeComponent.js.map +1 -1
  189. package/lib/module/specs/RNMBXMarkerViewNativeComponent.js +3 -0
  190. package/lib/module/specs/RNMBXMarkerViewNativeComponent.js.map +1 -0
  191. package/lib/module/specs/RNMBXNativeUserLocationNativeComponent.js +3 -0
  192. package/lib/module/specs/RNMBXNativeUserLocationNativeComponent.js.map +1 -0
  193. package/lib/module/specs/RNMBXPointAnnotationNativeComponent.js +3 -0
  194. package/lib/module/specs/RNMBXPointAnnotationNativeComponent.js.map +1 -0
  195. package/lib/module/specs/RNMBXShapeSourceNativeComponent.js.map +1 -1
  196. package/lib/module/specs/RNMBXTerrainNativeComponent.js +3 -0
  197. package/lib/module/specs/RNMBXTerrainNativeComponent.js.map +1 -0
  198. package/lib/module/utils/index.js +6 -29
  199. package/lib/module/utils/index.js.map +1 -1
  200. package/lib/typescript/src/components/Callout.d.ts +0 -1
  201. package/lib/typescript/src/components/Callout.d.ts.map +1 -1
  202. package/lib/typescript/src/components/Image.d.ts +0 -1
  203. package/lib/typescript/src/components/Image.d.ts.map +1 -1
  204. package/lib/typescript/src/components/Images.d.ts +0 -1
  205. package/lib/typescript/src/components/Images.d.ts.map +1 -1
  206. package/lib/typescript/src/components/Light.d.ts +0 -1
  207. package/lib/typescript/src/components/Light.d.ts.map +1 -1
  208. package/lib/typescript/src/components/MapView.d.ts +21 -28
  209. package/lib/typescript/src/components/MapView.d.ts.map +1 -1
  210. package/lib/typescript/src/components/MarkerView.d.ts.map +1 -1
  211. package/lib/typescript/src/components/NativeBridgeComponent.d.ts +5 -9
  212. package/lib/typescript/src/components/NativeBridgeComponent.d.ts.map +1 -1
  213. package/lib/typescript/src/components/NativeUserLocation.d.ts.map +1 -1
  214. package/lib/typescript/src/components/PointAnnotation.d.ts +5 -11
  215. package/lib/typescript/src/components/PointAnnotation.d.ts.map +1 -1
  216. package/lib/typescript/src/components/ShapeSource.d.ts +40 -2
  217. package/lib/typescript/src/components/ShapeSource.d.ts.map +1 -1
  218. package/lib/typescript/src/components/Terrain.d.ts +0 -1
  219. package/lib/typescript/src/components/Terrain.d.ts.map +1 -1
  220. package/lib/typescript/src/components/VectorSource.d.ts +1 -2
  221. package/lib/typescript/src/components/VectorSource.d.ts.map +1 -1
  222. package/lib/typescript/src/specs/NativeRNMBXImageModule.d.ts +9 -0
  223. package/lib/typescript/src/specs/NativeRNMBXImageModule.d.ts.map +1 -0
  224. package/lib/typescript/src/specs/NativeRNMBXPointAnnotationModule.d.ts +9 -0
  225. package/lib/typescript/src/specs/NativeRNMBXPointAnnotationModule.d.ts.map +1 -0
  226. package/lib/typescript/src/specs/RNMBXCalloutNativeComponent.d.ts +6 -0
  227. package/lib/typescript/src/specs/RNMBXCalloutNativeComponent.d.ts.map +1 -0
  228. package/lib/typescript/src/specs/RNMBXImageNativeComponent.d.ts +14 -0
  229. package/lib/typescript/src/specs/RNMBXImageNativeComponent.d.ts.map +1 -0
  230. package/lib/typescript/src/specs/RNMBXImagesNativeComponent.d.ts +18 -0
  231. package/lib/typescript/src/specs/RNMBXImagesNativeComponent.d.ts.map +1 -0
  232. package/lib/typescript/src/specs/RNMBXLightNativeComponent.d.ts +8 -0
  233. package/lib/typescript/src/specs/RNMBXLightNativeComponent.d.ts.map +1 -0
  234. package/lib/typescript/src/specs/RNMBXMapViewNativeComponent.d.ts +52 -3
  235. package/lib/typescript/src/specs/RNMBXMapViewNativeComponent.d.ts.map +1 -1
  236. package/lib/typescript/src/specs/RNMBXMarkerViewNativeComponent.d.ts +16 -0
  237. package/lib/typescript/src/specs/RNMBXMarkerViewNativeComponent.d.ts.map +1 -0
  238. package/lib/typescript/src/specs/RNMBXNativeUserLocationNativeComponent.d.ts +9 -0
  239. package/lib/typescript/src/specs/RNMBXNativeUserLocationNativeComponent.d.ts.map +1 -0
  240. package/lib/typescript/src/specs/RNMBXPointAnnotationNativeComponent.d.ts +37 -0
  241. package/lib/typescript/src/specs/RNMBXPointAnnotationNativeComponent.d.ts.map +1 -0
  242. package/lib/typescript/src/specs/RNMBXShapeSourceNativeComponent.d.ts +0 -2
  243. package/lib/typescript/src/specs/RNMBXShapeSourceNativeComponent.d.ts.map +1 -1
  244. package/lib/typescript/src/specs/RNMBXTerrainNativeComponent.d.ts +9 -0
  245. package/lib/typescript/src/specs/RNMBXTerrainNativeComponent.d.ts.map +1 -0
  246. package/lib/typescript/src/specs/codegenUtils.d.ts +0 -4
  247. package/lib/typescript/src/specs/codegenUtils.d.ts.map +1 -1
  248. package/lib/typescript/src/utils/index.d.ts +2 -3
  249. package/lib/typescript/src/utils/index.d.ts.map +1 -1
  250. package/package.json +1 -1
  251. package/setup-jest.js +8 -0
  252. package/src/components/Callout.tsx +4 -11
  253. package/src/components/Image.tsx +17 -13
  254. package/src/components/Images.tsx +9 -19
  255. package/src/components/Light.tsx +4 -12
  256. package/src/components/MapView.tsx +36 -74
  257. package/src/components/MarkerView.tsx +3 -15
  258. package/src/components/NativeBridgeComponent.tsx +9 -57
  259. package/src/components/NativeUserLocation.tsx +2 -8
  260. package/src/components/PointAnnotation.tsx +32 -24
  261. package/src/components/ShapeSource.tsx +21 -44
  262. package/src/components/Terrain.tsx +3 -11
  263. package/src/components/VectorSource.tsx +2 -19
  264. package/src/specs/NativeRNMBXImageModule.ts +10 -0
  265. package/src/specs/NativeRNMBXPointAnnotationModule.ts +12 -0
  266. package/src/specs/RNMBXCalloutNativeComponent.ts +9 -0
  267. package/src/specs/RNMBXImageNativeComponent.ts +18 -0
  268. package/src/specs/RNMBXImagesNativeComponent.ts +18 -0
  269. package/src/specs/RNMBXLightNativeComponent.ts +12 -0
  270. package/src/specs/RNMBXMapViewNativeComponent.ts +69 -5
  271. package/src/specs/RNMBXMarkerViewNativeComponent.ts +21 -0
  272. package/src/specs/RNMBXNativeUserLocationNativeComponent.ts +13 -0
  273. package/src/specs/RNMBXPointAnnotationNativeComponent.ts +40 -0
  274. package/src/specs/RNMBXShapeSourceNativeComponent.ts +0 -2
  275. package/src/specs/RNMBXTerrainNativeComponent.ts +13 -0
  276. package/src/specs/codegenUtils.ts +0 -5
  277. package/src/utils/index.ts +6 -43
  278. package/android/src/main/java/com/rnmapbox/rnmbx/components/annotation/RNMBXCalloutManager.java +0 -18
  279. package/android/src/main/java/com/rnmapbox/rnmbx/components/annotation/RNMBXPointAnnotationManager.java +0 -84
  280. package/android/src/main/java/com/rnmapbox/rnmbx/components/mapview/RNMBXAndroidTextureMapViewManager.kt +0 -39
  281. package/android/src/main/java/com/rnmapbox/rnmbx/components/styles/light/RNMBXLightManager.java +0 -25
  282. package/android/src/main/old-arch/com/facebook/react/viewmanagers/RNMBXAndroidTextureMapViewManagerDelegate.java +0 -95
  283. package/android/src/main/old-arch/com/facebook/react/viewmanagers/RNMBXAndroidTextureMapViewManagerInterface.java +0 -38
  284. package/ios/RNMBX/RNMBXCircleLayerManager.m +0 -12
  285. package/ios/RNMBX/RNMBXCircleLayerManager.swift +0 -13
  286. package/ios/RNMBX/RNMBXMapFeatureView.h +0 -7
  287. package/ios/RNMBX/RNMBXPointAnnotationManager.swift +0 -34
  288. package/lib/commonjs/specs/RNMBXAndroidTextureMapViewNativeComponent.js.map +0 -1
  289. package/lib/module/specs/RNMBXAndroidTextureMapViewNativeComponent.js +0 -5
  290. package/lib/module/specs/RNMBXAndroidTextureMapViewNativeComponent.js.map +0 -1
  291. package/lib/typescript/src/specs/RNMBXAndroidTextureMapViewNativeComponent.d.ts +0 -46
  292. package/lib/typescript/src/specs/RNMBXAndroidTextureMapViewNativeComponent.d.ts.map +0 -1
  293. package/src/specs/RNMBXAndroidTextureMapViewNativeComponent.ts +0 -59
@@ -1,5 +1,8 @@
1
1
  import React, { memo, forwardRef, ReactElement } from 'react';
2
- import { requireNativeComponent } from 'react-native';
2
+ import { findNodeHandle } from 'react-native';
3
+
4
+ import RNMBXImageNativeComponent from '../specs/RNMBXImageNativeComponent';
5
+ import NativeRNMBXImageModule from '../specs/NativeRNMBXImageModule';
3
6
 
4
7
  interface Props {
5
8
  /** ID of the image */
@@ -42,21 +45,22 @@ const Image = memo(
42
45
  stretchY,
43
46
  children,
44
47
  };
45
- return <RNMBXImage {...nativeProps} />;
46
- }),
47
- );
48
48
 
49
- interface NativeProps {
50
- name: string;
51
- children: ReactElement;
52
- sdf?: boolean;
53
- stretchX?: [number, number][];
54
- stretchY?: [number, number][];
55
- }
49
+ const imageRef = React.useRef(null);
50
+
51
+ const refresh = () => {
52
+ const handle = findNodeHandle(imageRef.current as any);
53
+ NativeRNMBXImageModule.refresh(handle);
54
+ };
56
55
 
57
- export const NATIVE_MODULE_NAME = 'RNMBXImage';
56
+ React.useImperativeHandle(ref, () => {
57
+ return { refresh };
58
+ });
58
59
 
59
- const RNMBXImage = requireNativeComponent<NativeProps>(NATIVE_MODULE_NAME);
60
+ // @ts-expect-error just codegen stuff
61
+ return <RNMBXImageNativeComponent {...nativeProps} ref={imageRef} />;
62
+ }),
63
+ );
60
64
 
61
65
  Image.displayName = 'Image';
62
66
 
@@ -1,11 +1,9 @@
1
1
  import React, { ReactNode, ReactElement } from 'react';
2
- import {
3
- requireNativeComponent,
4
- Image as RNImage,
5
- ImageURISource,
6
- } from 'react-native';
2
+ import { Image as RNImage, ImageURISource } from 'react-native';
7
3
  import { ImageSourcePropType, ImageResolvedAssetSource } from 'react-native';
8
4
 
5
+ import RNMBXImagesNativeComponent from '../specs/RNMBXImagesNativeComponent';
6
+
9
7
  import { ShapeSource } from './ShapeSource';
10
8
  import Image from './Image';
11
9
 
@@ -101,7 +99,6 @@ interface Props {
101
99
  */
102
100
  onImageMissing?: (imageKey: string) => void;
103
101
 
104
- id?: string;
105
102
  children?: TypedReactNode<typeof Image>;
106
103
  }
107
104
 
@@ -184,25 +181,18 @@ class Images extends React.PureComponent<Props> {
184
181
 
185
182
  render() {
186
183
  const props = {
187
- id: this.props.id,
188
184
  hasOnImageMissing: !!this.props.onImageMissing,
189
185
  onImageMissing: this._onImageMissing.bind(this),
190
186
  ...this._getImages(),
191
187
  };
192
188
 
193
- return <RNMBXImages {...props}>{this.props.children}</RNMBXImages>;
189
+ return (
190
+ // @ts-expect-error just codegen stuff
191
+ <RNMBXImagesNativeComponent {...props}>
192
+ {this.props.children}
193
+ </RNMBXImagesNativeComponent>
194
+ );
194
195
  }
195
196
  }
196
197
 
197
- type NativeProps = {
198
- hasOnImageMissing: boolean;
199
- onImageMissing?: (event: React.SyntheticEvent<Element, RNMBEvent>) => void;
200
- images?: {
201
- [key: string]: string | ImageResolvedAssetSource | ResolvedImageEntryData;
202
- };
203
- nativeImages?: NativeImage[];
204
- };
205
-
206
- const RNMBXImages = requireNativeComponent<NativeProps>(NATIVE_MODULE_NAME);
207
-
208
198
  export default Images;
@@ -1,14 +1,11 @@
1
1
  import React, { forwardRef, memo, useImperativeHandle, useRef } from 'react';
2
- import { requireNativeComponent } from 'react-native';
3
2
 
3
+ import RNMBXLightNativeComponent from '../specs/RNMBXLightNativeComponent';
4
4
  import { LightLayerStyleProps } from '../utils/MapboxStyles';
5
- import { StyleValue } from '../utils/StyleValue';
6
5
  import { type BaseProps } from '../types/BaseProps';
7
6
  import { transformStyle } from '../utils/StyleValue';
8
7
  import nativeRef from '../utils/nativeRef';
9
8
 
10
- export const NATIVE_MODULE_NAME = 'RNMBXLight';
11
-
12
9
  type Props = BaseProps & {
13
10
  /**
14
11
  * Customizable style attributes
@@ -16,10 +13,6 @@ type Props = BaseProps & {
16
13
  style: LightLayerStyleProps;
17
14
  };
18
15
 
19
- type NativeProps = Omit<Props, 'style'> & {
20
- reactStyle?: { [key: string]: StyleValue };
21
- };
22
-
23
16
  interface LightMethods {
24
17
  setNativeProps(props: { [key: string]: unknown }): void;
25
18
  }
@@ -30,7 +23,7 @@ interface LightMethods {
30
23
  function Light(props: Props, ref: React.ForwardedRef<LightMethods>) {
31
24
  const { style, ...propWithoutStyle } = props;
32
25
 
33
- const nativeLightRef = nativeRef(useRef<typeof RNMBXLight>(null));
26
+ const nativeLightRef = nativeRef(useRef(null));
34
27
 
35
28
  useImperativeHandle(ref, () => ({
36
29
  setNativeProps(_props: { [key: string]: unknown }) {
@@ -46,7 +39,8 @@ function Light(props: Props, ref: React.ForwardedRef<LightMethods>) {
46
39
  }));
47
40
 
48
41
  return (
49
- <RNMBXLight
42
+ <RNMBXLightNativeComponent
43
+ // @ts-expect-error just codegen stuff
50
44
  ref={nativeLightRef}
51
45
  testID="RNMBXLight"
52
46
  {...propWithoutStyle}
@@ -55,6 +49,4 @@ function Light(props: Props, ref: React.ForwardedRef<LightMethods>) {
55
49
  );
56
50
  }
57
51
 
58
- const RNMBXLight = requireNativeComponent<NativeProps>(NATIVE_MODULE_NAME);
59
-
60
52
  export default memo(forwardRef(Light));
@@ -8,13 +8,12 @@ import {
8
8
  NativeMethods,
9
9
  HostComponent,
10
10
  LayoutChangeEvent,
11
- findNodeHandle,
12
11
  } from 'react-native';
13
12
  import { debounce } from 'debounce';
14
- import { GeoJsonProperties, Geometry } from 'geojson';
15
13
 
16
- import NativeMapView from '../specs/RNMBXMapViewNativeComponent';
17
- import NativeAndroidTextureMapView from '../specs/RNMBXAndroidTextureMapViewNativeComponent';
14
+ import NativeMapView, {
15
+ type NativeMapViewActual,
16
+ } from '../specs/RNMBXMapViewNativeComponent';
18
17
  import NativeMapViewModule from '../specs/NativeMapViewModule';
19
18
  import {
20
19
  isFunction,
@@ -44,9 +43,6 @@ if (!RNMBXModule.MapboxV10) {
44
43
  );
45
44
  }
46
45
 
47
- // TODO: check if this can be removed
48
- export const NATIVE_MODULE_NAME = 'MBXMapView';
49
-
50
46
  const styles = StyleSheet.create({
51
47
  matchParent: { flex: 1 },
52
48
  });
@@ -463,7 +459,7 @@ type Debounced<F> = F & { clear(): void; flush(): void };
463
459
  */
464
460
  class MapView extends NativeBridgeComponent(
465
461
  React.PureComponent<Props>,
466
- NATIVE_MODULE_NAME,
462
+ NativeMapViewModule,
467
463
  ) {
468
464
  static defaultProps: Props = {
469
465
  scrollEnabled: true,
@@ -636,7 +632,7 @@ class MapView extends NativeBridgeComponent(
636
632
  );
637
633
  }
638
634
 
639
- this._runNativeCommand('setHandledMapChangedEvents', this._nativeRef, [
635
+ this._runNativeMethod('setHandledMapChangedEvents', this._nativeRef, [
640
636
  events,
641
637
  ]);
642
638
  }
@@ -806,7 +802,7 @@ class MapView extends NativeBridgeComponent(
806
802
  methodName: string,
807
803
  args: NativeArg[] = [],
808
804
  ): Promise<ReturnType> {
809
- return this._runNativeCommand<typeof RNMBXMapView, ReturnType>(
805
+ return super._runNativeMethod<typeof RNMBXMapView, ReturnType>(
810
806
  methodName,
811
807
  // eslint-disable-next-line @typescript-eslint/ban-ts-comment
812
808
  // @ts-ignore TODO: fix types
@@ -918,37 +914,7 @@ class MapView extends NativeBridgeComponent(
918
914
  return this._runNative<void>('showAttribution');
919
915
  }
920
916
 
921
- _runNativeCommand<RefType, ReturnType = NativeArg>(
922
- methodName: string,
923
- nativeRef: RefType | undefined,
924
- args: NativeArg[],
925
- ): Promise<ReturnType> {
926
- // when this method is called after component mounts, the ref is not yet set
927
- // schedule it to be called after a timeout
928
- if (!this._nativeRef) {
929
- return new Promise<ReturnType>((resolve) => {
930
- this._preRefMapMethodQueue.push({
931
- method: { name: methodName, args },
932
- resolver: resolve as (args: NativeArg) => void,
933
- });
934
- });
935
- }
936
-
937
- const handle = findNodeHandle(nativeRef as any);
938
-
939
- // @ts-expect-error TS says that string cannot be used to index NativeMapViewModule.
940
- // It can, it's just not pretty.
941
- return NativeMapViewModule[methodName]?.(
942
- handle,
943
- ...(args ?? []),
944
- ) as Promise<ReturnType>;
945
- }
946
-
947
- _decodePayload<G extends Geometry | null = Geometry, P = GeoJsonProperties>(
948
- payload: GeoJSON.Feature<G, P> | string,
949
- ): GeoJSON.Feature<G, P> {
950
- // we check whether the payload is a string, since the strict type safety is enforced only on iOS on the new arch
951
- // on Android, on both archs, the payload is an object
917
+ _decodePayload<T>(payload: T | string): T {
952
918
  if (typeof payload === 'string') {
953
919
  return JSON.parse(payload);
954
920
  } else {
@@ -956,15 +922,15 @@ class MapView extends NativeBridgeComponent(
956
922
  }
957
923
  }
958
924
 
959
- _onPress(e: NativeSyntheticEvent<{ payload: GeoJSON.Feature }>) {
925
+ _onPress(e: NativeSyntheticEvent<{ payload: GeoJSON.Feature | string }>) {
960
926
  if (isFunction(this.props.onPress)) {
961
927
  this.props.onPress(this._decodePayload(e.nativeEvent.payload));
962
928
  }
963
929
  }
964
930
 
965
- _onLongPress(e: NativeSyntheticEvent<{ payload: GeoJSON.Feature }>) {
931
+ _onLongPress(e: NativeSyntheticEvent<{ payload: GeoJSON.Feature | string }>) {
966
932
  if (isFunction(this.props.onLongPress)) {
967
- this.props.onLongPress(e.nativeEvent.payload);
933
+ this.props.onLongPress(this._decodePayload(e.nativeEvent.payload));
968
934
  }
969
935
  }
970
936
 
@@ -991,17 +957,19 @@ class MapView extends NativeBridgeComponent(
991
957
  this.setState({ region: payload });
992
958
  }
993
959
 
994
- _onCameraChanged(e: NativeSyntheticEvent<{ payload: MapState }>) {
995
- this.props.onCameraChanged?.(e.nativeEvent.payload);
960
+ _onCameraChanged(e: NativeSyntheticEvent<{ payload: MapState | string }>) {
961
+ this.props.onCameraChanged?.(this._decodePayload(e.nativeEvent.payload));
996
962
  }
997
963
 
998
964
  _onChange(
999
965
  e: NativeSyntheticEvent<{
1000
966
  type: string;
1001
- payload: GeoJSON.Feature<
1002
- GeoJSON.Point,
1003
- RegionPayload & { isAnimatingFromUserInteraction: boolean }
1004
- >;
967
+ payload:
968
+ | GeoJSON.Feature<
969
+ GeoJSON.Point,
970
+ RegionPayload & { isAnimatingFromUserInteraction: boolean }
971
+ >
972
+ | string;
1005
973
  }>,
1006
974
  ) {
1007
975
  const { regionWillChangeDebounceTime, regionDidChangeDebounceTime } =
@@ -1121,9 +1089,11 @@ class MapView extends NativeBridgeComponent(
1121
1089
  return this.props.contentInset;
1122
1090
  }
1123
1091
 
1124
- _setNativeRef(nativeRef: RNMBXMapViewRefType) {
1125
- this._nativeRef = nativeRef;
1126
- super._runPendingNativeCommands(nativeRef);
1092
+ _setNativeRef(nativeRef: RNMBXMapViewRefType | null) {
1093
+ if (nativeRef != null) {
1094
+ this._nativeRef = nativeRef;
1095
+ super._runPendingNativeMethods(nativeRef);
1096
+ }
1127
1097
  }
1128
1098
 
1129
1099
  setNativeProps(props: NativeProps) {
@@ -1172,25 +1142,17 @@ class MapView extends NativeBridgeComponent(
1172
1142
  this._setLocalizeLabels(props);
1173
1143
 
1174
1144
  const callbacks = {
1175
- ref: (nativeRef: RNMBXMapViewRefType) => this._setNativeRef(nativeRef),
1145
+ ref: (nativeRef: RNMBXMapViewRefType | null) =>
1146
+ this._setNativeRef(nativeRef),
1176
1147
  onPress: this._onPress,
1177
1148
  onLongPress: this._onLongPress,
1178
1149
  onMapChange: this._onChange,
1179
- onAndroidCallback: isAndroid() ? this._onAndroidCallback : undefined,
1180
1150
  onCameraChanged: this._onCameraChanged,
1181
1151
  };
1182
1152
 
1183
1153
  let mapView = null;
1184
- if (isAndroid() && !this.props.surfaceView && this.state.isReady) {
1185
- mapView = (
1186
- <RNMBXAndroidTextureMapView {...props} {...callbacks}>
1187
- {this.props.children}
1188
- </RNMBXAndroidTextureMapView>
1189
- );
1190
- } else if (this.state.isReady) {
1154
+ if (this.state.isReady) {
1191
1155
  mapView = (
1192
- // eslint-disable-next-line @typescript-eslint/ban-ts-comment
1193
- // @ts-ignore TODO: fix types
1194
1156
  <RNMBXMapView {...props} {...callbacks}>
1195
1157
  {this.props.children}
1196
1158
  </RNMBXMapView>
@@ -1213,19 +1175,19 @@ type NativeProps = Omit<
1213
1175
  Props,
1214
1176
  'onPress' | 'onLongPress' | 'onCameraChanged'
1215
1177
  > & {
1216
- onPress(event: NativeSyntheticEvent<{ payload: GeoJSON.Feature }>): void;
1217
- onLongPress(event: NativeSyntheticEvent<{ payload: GeoJSON.Feature }>): void;
1218
- onCameraChanged(event: NativeSyntheticEvent<{ payload: MapState }>): void;
1178
+ onPress?: (
1179
+ event: NativeSyntheticEvent<{ type: string; payload: string }>,
1180
+ ) => void;
1181
+ onLongPress?: (
1182
+ event: NativeSyntheticEvent<{ type: string; payload: string }>,
1183
+ ) => void;
1184
+ onCameraChanged?: (
1185
+ event: NativeSyntheticEvent<{ type: string; payload: string }>,
1186
+ ) => void;
1219
1187
  };
1220
1188
 
1221
1189
  type RNMBXMapViewRefType = Component<NativeProps> & Readonly<NativeMethods>;
1222
- // const RNMBXMapView = requireNativeComponent<NativeProps>(NATIVE_MODULE_NAME);
1223
- // TODO: figure out how to pick the correct implementation
1224
- const RNMBXMapView = NativeMapView;
1225
1190
 
1226
- let RNMBXAndroidTextureMapView: any;
1227
- if (isAndroid()) {
1228
- RNMBXAndroidTextureMapView = NativeAndroidTextureMapView;
1229
- }
1191
+ const RNMBXMapView = NativeMapView as NativeMapViewActual;
1230
1192
 
1231
1193
  export default MapView;
@@ -1,15 +1,10 @@
1
1
  import React from 'react';
2
- import {
3
- Platform,
4
- NativeModules,
5
- requireNativeComponent,
6
- type ViewProps,
7
- View,
8
- } from 'react-native';
2
+ import { Platform, NativeModules, type ViewProps, View } from 'react-native';
9
3
 
10
4
  import { toJSONString } from '../utils';
11
5
  import { makePoint } from '../utils/geoUtils';
12
6
  import { type Position } from '../types/Position';
7
+ import NativeMarkerViewComponent from '../specs/RNMBXMarkerViewNativeComponent';
13
8
 
14
9
  import PointAnnotation from './PointAnnotation';
15
10
 
@@ -139,13 +134,6 @@ class MarkerView extends React.PureComponent<Props> {
139
134
  }
140
135
  }
141
136
 
142
- type NativeProps = ViewProps & {
143
- coordinate: string | undefined;
144
- anchor: { x: number; y: number };
145
- allowOverlap: boolean;
146
- isSelected: boolean;
147
- };
148
-
149
- const RNMBXMarkerView = requireNativeComponent<NativeProps>(NATIVE_MODULE_NAME);
137
+ const RNMBXMarkerView = NativeMarkerViewComponent;
150
138
 
151
139
  export default MarkerView;
@@ -1,8 +1,7 @@
1
1
  import React from 'react';
2
+ import { TurboModule } from 'react-native';
2
3
 
3
- import { type NativeArg, runNativeCommand, isAndroid } from '../utils';
4
-
5
- let callbackIncrement = 0;
4
+ import { type NativeArg, runNativeMethod } from '../utils';
6
5
 
7
6
  export type RNMBEvent<PayloadType = { [key: string]: string }> = {
8
7
  payload: PayloadType;
@@ -14,12 +13,10 @@ const NativeBridgeComponent = <
14
13
  BaseComponent extends new (...ags: any[]) => React.Component<Props>,
15
14
  >(
16
15
  Base: BaseComponent,
17
- nativeModuleName: string,
16
+ turboModule: TurboModule,
18
17
  ) =>
19
18
  class extends Base {
20
- _nativeModuleName: string;
21
- _onAndroidCallback: (e: any) => void;
22
- _callbackMap: Map<string, any>;
19
+ _turboModule: TurboModule;
23
20
  _preRefMapMethodQueue: Array<{
24
21
  method: { name: string; args: NativeArg[] };
25
22
  resolver: (value: NativeArg) => void;
@@ -28,48 +25,17 @@ const NativeBridgeComponent = <
28
25
  constructor(...args: any[]) {
29
26
  super(...args);
30
27
 
31
- this._nativeModuleName = nativeModuleName;
32
- this._onAndroidCallback = this._onAndroidCallbackO.bind(this);
33
- this._callbackMap = new Map();
28
+ this._turboModule = turboModule;
34
29
  this._preRefMapMethodQueue = [];
35
30
  }
36
31
 
37
- _addAddAndroidCallback<ReturnType>(
38
- id: string,
39
- resolve: (value: ReturnType) => void,
40
- reject: (error: Error) => void,
41
- ) {
42
- this._callbackMap.set(id, { resolve, reject });
43
- }
44
-
45
- _removeAndroidCallback(id: string) {
46
- this._callbackMap.delete(id);
47
- }
48
-
49
- _onAndroidCallbackO(e: React.SyntheticEvent<Element, RNMBEvent>) {
50
- const callbackID = e.nativeEvent.type;
51
- const callback = this._callbackMap.get(callbackID);
52
-
53
- if (!callback) {
54
- return;
55
- }
56
-
57
- this._callbackMap.delete(callbackID);
58
- const { payload } = e.nativeEvent;
59
- if (payload.error) {
60
- callback.reject.call(null, new Error(payload.error));
61
- } else {
62
- callback.resolve.call(null, payload);
63
- }
64
- }
65
-
66
- async _runPendingNativeCommands<RefType>(nativeRef: RefType) {
32
+ async _runPendingNativeMethods<RefType>(nativeRef: RefType) {
67
33
  if (nativeRef) {
68
34
  while (this._preRefMapMethodQueue.length > 0) {
69
35
  const item = this._preRefMapMethodQueue.pop();
70
36
 
71
37
  if (item && item.method && item.resolver) {
72
- const res = await this._runNativeCommand(
38
+ const res = await this._runNativeMethod(
73
39
  item.method.name,
74
40
  nativeRef,
75
41
  item.method.args,
@@ -80,7 +46,7 @@ const NativeBridgeComponent = <
80
46
  }
81
47
  }
82
48
 
83
- _runNativeCommand<RefType, ReturnType = NativeArg>(
49
+ _runNativeMethod<RefType, ReturnType = NativeArg>(
84
50
  methodName: string,
85
51
  nativeRef: RefType | undefined,
86
52
  args: NativeArg[] = [],
@@ -94,21 +60,7 @@ const NativeBridgeComponent = <
94
60
  });
95
61
  }
96
62
 
97
- if (isAndroid()) {
98
- return new Promise((resolve, reject) => {
99
- callbackIncrement += 1;
100
- const callbackID = `${methodName}_${callbackIncrement}`;
101
- this._addAddAndroidCallback(callbackID, resolve, reject);
102
- args.unshift(callbackID);
103
- runNativeCommand(this._nativeModuleName, methodName, nativeRef, args);
104
- });
105
- }
106
- return runNativeCommand(
107
- this._nativeModuleName,
108
- methodName,
109
- nativeRef,
110
- args,
111
- );
63
+ return runNativeMethod(this._turboModule, methodName, nativeRef, args);
112
64
  }
113
65
  };
114
66
 
@@ -1,7 +1,6 @@
1
1
  import React, { memo } from 'react';
2
- import { requireNativeComponent } from 'react-native';
3
2
 
4
- const NATIVE_MODULE_NAME = 'RNMBXNativeUserLocation';
3
+ import RNMBXNativeUserLocationNativeComponent from '../specs/RNMBXNativeUserLocationNativeComponent';
5
4
 
6
5
  export type Props = {
7
6
  /**
@@ -23,13 +22,8 @@ export type Props = {
23
22
  iosShowsUserHeadingIndicator?: boolean;
24
23
  };
25
24
 
26
- type NativeProps = Props;
27
-
28
- const RNMBXNativeUserLocation =
29
- requireNativeComponent<NativeProps>(NATIVE_MODULE_NAME);
30
-
31
25
  const NativeUserLocation = memo((props: Props) => {
32
- return <RNMBXNativeUserLocation {...props} />;
26
+ return <RNMBXNativeUserLocationNativeComponent {...props} />;
33
27
  });
34
28
 
35
29
  export default NativeUserLocation;
@@ -1,17 +1,14 @@
1
1
  import React, { SyntheticEvent, type Component } from 'react';
2
- import {
3
- requireNativeComponent,
4
- StyleSheet,
5
- Platform,
6
- type ViewProps,
7
- } from 'react-native';
8
- import { Feature, Point } from 'geojson';
2
+ import { StyleSheet, type ViewProps } from 'react-native';
3
+ import { Feature, GeoJsonProperties, Geometry, Point } from 'geojson';
9
4
 
10
5
  import { toJSONString, isFunction } from '../utils';
11
6
  import checkRequiredProps from '../utils/checkRequiredProps';
12
7
  import { makePoint } from '../utils/geoUtils';
13
8
  import { type BaseProps } from '../types/BaseProps';
14
9
  import { Position } from '../types/Position';
10
+ import RNMBXPointAnnotationNativeComponent from '../specs/RNMBXPointAnnotationNativeComponent';
11
+ import NativeRNMBXPointAnnotationModule from '../specs/NativeRNMBXPointAnnotationModule';
15
12
 
16
13
  import NativeBridgeComponent, { type RNMBEvent } from './NativeBridgeComponent';
17
14
 
@@ -127,7 +124,7 @@ type Props = BaseProps & {
127
124
  */
128
125
  class PointAnnotation extends NativeBridgeComponent(
129
126
  React.PureComponent<Props>,
130
- NATIVE_MODULE_NAME,
127
+ NativeRNMBXPointAnnotationModule,
131
128
  ) {
132
129
  static defaultProps = {
133
130
  anchor: { x: 0.5, y: 0.5 },
@@ -146,33 +143,50 @@ class PointAnnotation extends NativeBridgeComponent(
146
143
  this._onDragEnd = this._onDragEnd.bind(this);
147
144
  }
148
145
 
146
+ _decodePayload<G extends Geometry | null = Geometry, P = GeoJsonProperties>(
147
+ payload: GeoJSON.Feature<G, P> | string,
148
+ ): GeoJSON.Feature<G, P> {
149
+ // we check whether the payload is a string, since the strict type safety is enforced only on iOS on the new arch
150
+ // on Android, on both archs, the payload is an object
151
+ if (typeof payload === 'string') {
152
+ return JSON.parse(payload);
153
+ } else {
154
+ return payload;
155
+ }
156
+ }
157
+
149
158
  _onSelected(e: SyntheticEvent<Element, RNMBEvent<FeaturePayload>>) {
150
159
  if (isFunction(this.props.onSelected)) {
151
- this.props.onSelected(e.nativeEvent.payload);
160
+ const payload = this._decodePayload(e.nativeEvent.payload);
161
+ this.props.onSelected(payload);
152
162
  }
153
163
  }
154
164
 
155
165
  _onDeselected(e: SyntheticEvent<Element, RNMBEvent<FeaturePayload>>) {
156
166
  if (isFunction(this.props.onDeselected)) {
157
- this.props.onDeselected(e.nativeEvent.payload);
167
+ const payload = this._decodePayload(e.nativeEvent.payload);
168
+ this.props.onDeselected(payload);
158
169
  }
159
170
  }
160
171
 
161
172
  _onDragStart(e: SyntheticEvent<Element, RNMBEvent<FeaturePayload>>) {
162
173
  if (isFunction(this.props.onDragStart)) {
163
- this.props.onDragStart(e.nativeEvent.payload);
174
+ const payload = this._decodePayload(e.nativeEvent.payload);
175
+ this.props.onDragStart(payload);
164
176
  }
165
177
  }
166
178
 
167
179
  _onDrag(e: SyntheticEvent<Element, RNMBEvent<FeaturePayload>>) {
168
180
  if (isFunction(this.props.onDrag)) {
169
- this.props.onDrag(e.nativeEvent.payload);
181
+ const payload = this._decodePayload(e.nativeEvent.payload);
182
+ this.props.onDrag(payload);
170
183
  }
171
184
  }
172
185
 
173
186
  _onDragEnd(e: SyntheticEvent<Element, RNMBEvent<FeaturePayload>>) {
174
187
  if (isFunction(this.props.onDragEnd)) {
175
- this.props.onDragEnd(e.nativeEvent.payload);
188
+ const payload = this._decodePayload(e.nativeEvent.payload);
189
+ this.props.onDragEnd(payload);
176
190
  }
177
191
  }
178
192
 
@@ -189,16 +203,12 @@ class PointAnnotation extends NativeBridgeComponent(
189
203
  * Call this for example from Image#onLoad.
190
204
  */
191
205
  refresh() {
192
- if (Platform.OS === 'android') {
193
- this._runNativeCommand('refresh', this._nativeRef, []);
194
- } else {
195
- this._runNativeCommand('refresh', this._nativeRef, []);
196
- }
206
+ this._runNativeMethod('refresh', this._nativeRef, []);
197
207
  }
198
208
 
199
209
  _setNativeRef(nativeRef: NativePointAnnotationRef | null) {
200
210
  this._nativeRef = nativeRef;
201
- super._runPendingNativeCommands(nativeRef);
211
+ super._runPendingNativeMethods(nativeRef);
202
212
  }
203
213
 
204
214
  render() {
@@ -221,9 +231,10 @@ class PointAnnotation extends NativeBridgeComponent(
221
231
  coordinate: this._getCoordinate(),
222
232
  };
223
233
  return (
224
- <RNMBXPointAnnotation {...props}>
234
+ // @ts-expect-error just codegen stuff
235
+ <RNMBXPointAnnotationNativeComponent {...props}>
225
236
  {this.props.children}
226
- </RNMBXPointAnnotation>
237
+ </RNMBXPointAnnotationNativeComponent>
227
238
  );
228
239
  }
229
240
  }
@@ -234,7 +245,4 @@ type NativeProps = Omit<Props, 'coordinate'> & {
234
245
 
235
246
  type NativePointAnnotationRef = Component<NativeProps>;
236
247
 
237
- const RNMBXPointAnnotation =
238
- requireNativeComponent<NativeProps>(NATIVE_MODULE_NAME);
239
-
240
248
  export default PointAnnotation;