@maplibre/maplibre-react-native 11.0.0-alpha.7 → 11.0.0-alpha.9

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 (338) hide show
  1. package/MapLibreReactNative.podspec +1 -1
  2. package/android/build.gradle +0 -3
  3. package/android/src/main/java/org/maplibre/reactnative/MLRNPackage.kt +43 -0
  4. package/android/src/main/java/org/maplibre/reactnative/components/AbstractEvent.kt +24 -0
  5. package/android/src/main/java/org/maplibre/reactnative/components/AbstractEventEmitter.kt +71 -0
  6. package/android/src/main/java/org/maplibre/reactnative/components/annotation/MLRNPointAnnotation.java +1 -1
  7. package/android/src/main/java/org/maplibre/reactnative/components/camera/CameraStop.kt +203 -0
  8. package/android/src/main/java/org/maplibre/reactnative/components/camera/CameraUpdateItem.kt +109 -0
  9. package/android/src/main/java/org/maplibre/reactnative/components/camera/CameraUpdateQueue.kt +60 -0
  10. package/android/src/main/java/org/maplibre/reactnative/components/camera/MLRNCamera.kt +409 -0
  11. package/android/src/main/java/org/maplibre/reactnative/components/camera/MLRNCameraManager.kt +69 -0
  12. package/android/src/main/java/org/maplibre/reactnative/components/camera/MLRNCameraModule.kt +34 -0
  13. package/android/src/main/java/org/maplibre/reactnative/components/camera/constants/CameraEasing.kt +24 -0
  14. package/android/src/main/java/org/maplibre/reactnative/components/images/MLRNImages.java +1 -2
  15. package/android/src/main/java/org/maplibre/reactnative/components/location/LocationComponentManager.java +1 -1
  16. package/android/src/main/java/org/maplibre/reactnative/components/mapview/MLRNAndroidTextureMapView.kt +23 -0
  17. package/android/src/main/java/org/maplibre/reactnative/components/mapview/MLRNAndroidTextureMapViewManager.kt +23 -0
  18. package/android/src/main/java/org/maplibre/reactnative/components/mapview/MLRNMapView.kt +1338 -0
  19. package/android/src/main/java/org/maplibre/reactnative/components/mapview/MLRNMapViewManager.kt +187 -0
  20. package/android/src/main/java/org/maplibre/reactnative/components/mapview/MLRNMapViewModule.kt +159 -0
  21. package/android/src/main/java/org/maplibre/reactnative/components/mapview/helpers/CameraChangeTracker.kt +26 -0
  22. package/android/src/main/java/org/maplibre/reactnative/components/mapview/helpers/LayerSourceInfo.kt +74 -0
  23. package/android/src/main/java/org/maplibre/reactnative/components/styles/layers/MLRNLayer.java +1 -5
  24. package/android/src/main/java/org/maplibre/reactnative/components/styles/light/MLRNLight.java +1 -6
  25. package/android/src/main/java/org/maplibre/reactnative/components/styles/sources/MLRNShapeSource.java +2 -9
  26. package/android/src/main/java/org/maplibre/reactnative/components/styles/sources/MLRNSource.java +1 -1
  27. package/android/src/main/java/org/maplibre/reactnative/events/AbstractEvent.java +2 -5
  28. package/android/src/main/java/org/maplibre/reactnative/events/MapChangeEvent.kt +18 -0
  29. package/android/src/main/java/org/maplibre/reactnative/events/MapClickEvent.java +4 -0
  30. package/android/src/main/java/org/maplibre/reactnative/events/MapPressEvent.kt +27 -0
  31. package/android/src/main/java/org/maplibre/reactnative/events/TrackUserLocationChangeEvent.kt +24 -0
  32. package/android/src/main/java/org/maplibre/reactnative/events/constants/EventKeys.java +0 -1
  33. package/android/src/main/java/org/maplibre/reactnative/events/constants/EventTypes.java +0 -19
  34. package/android/src/main/java/org/maplibre/reactnative/location/LocationManager.java +1 -1
  35. package/android/src/main/java/org/maplibre/reactnative/location/TrackUserLocationMode.kt +43 -0
  36. package/android/src/main/java/org/maplibre/reactnative/location/{UserTrackingState.java → TrackUserLocationState.java} +1 -1
  37. package/android/src/main/java/org/maplibre/reactnative/location/UserLocation.java +1 -1
  38. package/android/src/main/java/org/maplibre/reactnative/modules/MLRNModule.java +1 -49
  39. package/android/src/main/java/org/maplibre/reactnative/utils/ConvertUtils.java +2 -9
  40. package/android/src/main/java/org/maplibre/reactnative/utils/GeoJSONUtils.kt +322 -0
  41. package/android/src/main/java/org/maplibre/reactnative/utils/ReactTagResolver.kt +85 -0
  42. package/ios/MLRNCallout.h +1 -1
  43. package/ios/MLRNEvent.m +3 -1
  44. package/ios/MLRNEventTypes.h +10 -31
  45. package/ios/MLRNEventTypes.m +10 -30
  46. package/ios/MLRNImages.h +1 -1
  47. package/ios/MLRNImages.m +1 -1
  48. package/ios/MLRNLayer.h +1 -1
  49. package/ios/MLRNLayer.m +2 -2
  50. package/ios/MLRNLight.h +2 -1
  51. package/ios/MLRNLocationModule.m +2 -2
  52. package/ios/MLRNMapTouchEvent.h +2 -1
  53. package/ios/MLRNMapTouchEvent.m +12 -10
  54. package/ios/MLRNModule.m +5 -52
  55. package/ios/MLRNNativeUserLocation.m +0 -1
  56. package/ios/MLRNOfflineModule.h +2 -2
  57. package/ios/MLRNOfflineModule.m +9 -9
  58. package/ios/MLRNPointAnnotation.h +1 -1
  59. package/ios/MLRNShapeSource.h +1 -1
  60. package/ios/MLRNSource.h +3 -1
  61. package/ios/MLRNStyle.m +20 -20
  62. package/ios/MLRNUtils.h +17 -2
  63. package/ios/MLRNUtils.m +25 -2
  64. package/ios/components/camera/CameraEasing.h +8 -0
  65. package/ios/{CameraStop.h → components/camera/CameraStop.h} +10 -6
  66. package/ios/components/camera/CameraStop.m +75 -0
  67. package/ios/{CameraUpdateItem.m → components/camera/CameraUpdateItem.m} +45 -46
  68. package/ios/components/camera/MLRNCamera.h +26 -0
  69. package/ios/components/camera/MLRNCamera.m +195 -0
  70. package/ios/components/camera/MLRNCameraComponentView.h +18 -0
  71. package/ios/components/camera/MLRNCameraComponentView.mm +192 -0
  72. package/ios/components/camera/MLRNCameraManager.h +11 -0
  73. package/ios/components/camera/MLRNCameraManager.m +20 -0
  74. package/ios/components/camera/MLRNCameraModule.h +4 -0
  75. package/ios/components/camera/MLRNCameraModule.mm +111 -0
  76. package/ios/{MLRNMapView.h → components/map-view/MLRNMapView.h} +42 -20
  77. package/ios/components/map-view/MLRNMapView.m +809 -0
  78. package/ios/components/map-view/MLRNMapViewComponentView.h +18 -0
  79. package/ios/components/map-view/MLRNMapViewComponentView.mm +400 -0
  80. package/ios/components/map-view/MLRNMapViewManager.h +70 -0
  81. package/ios/components/map-view/MLRNMapViewManager.m +163 -0
  82. package/ios/components/map-view/MLRNMapViewModule.h +4 -0
  83. package/ios/components/map-view/MLRNMapViewModule.mm +249 -0
  84. package/ios/{MLRNSnapshotModule → modules/snapshot}/MLRNSnapshotModule.mm +0 -1
  85. package/lib/commonjs/MLRNModule.js +1 -3
  86. package/lib/commonjs/MLRNModule.js.map +1 -1
  87. package/lib/commonjs/components/Annotation.js +1 -13
  88. package/lib/commonjs/components/Annotation.js.map +1 -1
  89. package/lib/commonjs/components/Images.js.map +1 -1
  90. package/lib/commonjs/components/ShapeSource.js +2 -21
  91. package/lib/commonjs/components/ShapeSource.js.map +1 -1
  92. package/lib/commonjs/components/VectorSource.js +3 -26
  93. package/lib/commonjs/components/VectorSource.js.map +1 -1
  94. package/lib/commonjs/components/camera/Camera.js +97 -0
  95. package/lib/commonjs/components/camera/Camera.js.map +1 -0
  96. package/lib/commonjs/components/camera/CameraNativeComponent.ts +61 -0
  97. package/lib/commonjs/components/camera/NativeCameraModule.js +11 -0
  98. package/lib/commonjs/components/camera/NativeCameraModule.js.map +1 -0
  99. package/lib/commonjs/components/map-view/MapView.js +115 -0
  100. package/lib/commonjs/components/map-view/MapView.js.map +1 -0
  101. package/lib/commonjs/components/map-view/MapViewNativeComponent.ts +96 -0
  102. package/lib/commonjs/components/map-view/NativeMapViewModule.js +9 -0
  103. package/lib/commonjs/components/map-view/NativeMapViewModule.js.map +1 -0
  104. package/lib/commonjs/index.js +246 -4
  105. package/lib/commonjs/index.js.map +1 -1
  106. package/lib/commonjs/modules/snapshot/NativeSnapshotModule.js +2 -2
  107. package/lib/commonjs/modules/snapshot/NativeSnapshotModule.js.map +1 -1
  108. package/lib/commonjs/modules/snapshot/SnapshotManager.js +3 -2
  109. package/lib/commonjs/modules/snapshot/SnapshotManager.js.map +1 -1
  110. package/lib/commonjs/types/Bounds.js +2 -0
  111. package/lib/commonjs/types/{OnPressEvent.js.map → Bounds.js.map} +1 -1
  112. package/lib/commonjs/types/PressEvent.js +2 -0
  113. package/lib/{module/types/OnPressEvent.js.map → commonjs/types/PressEvent.js.map} +1 -1
  114. package/lib/commonjs/types/ViewPadding.js +2 -0
  115. package/lib/commonjs/types/{MapLibreRNEvent.js.map → ViewPadding.js.map} +1 -1
  116. package/lib/commonjs/types/codegen/UnsafeMixed.js +2 -0
  117. package/lib/commonjs/types/codegen/UnsafeMixed.js.map +1 -0
  118. package/lib/commonjs/utils/index.js +0 -11
  119. package/lib/commonjs/utils/index.js.map +1 -1
  120. package/lib/module/MLRNModule.js +0 -1
  121. package/lib/module/MLRNModule.js.map +1 -1
  122. package/lib/module/components/Annotation.js +2 -14
  123. package/lib/module/components/Annotation.js.map +1 -1
  124. package/lib/module/components/Images.js.map +1 -1
  125. package/lib/module/components/ShapeSource.js +3 -22
  126. package/lib/module/components/ShapeSource.js.map +1 -1
  127. package/lib/module/components/VectorSource.js +4 -27
  128. package/lib/module/components/VectorSource.js.map +1 -1
  129. package/lib/module/components/camera/Camera.js +92 -0
  130. package/lib/module/components/camera/Camera.js.map +1 -0
  131. package/lib/module/components/camera/CameraNativeComponent.ts +61 -0
  132. package/lib/module/components/camera/NativeCameraModule.js +10 -0
  133. package/lib/module/components/camera/NativeCameraModule.js.map +1 -0
  134. package/lib/module/components/map-view/MapView.js +110 -0
  135. package/lib/module/components/map-view/MapView.js.map +1 -0
  136. package/lib/module/components/map-view/MapViewNativeComponent.ts +96 -0
  137. package/lib/module/components/map-view/NativeMapViewModule.js +5 -0
  138. package/lib/module/components/map-view/NativeMapViewModule.js.map +1 -0
  139. package/lib/module/index.js +30 -1
  140. package/lib/module/index.js.map +1 -1
  141. package/lib/module/modules/snapshot/NativeSnapshotModule.js +1 -1
  142. package/lib/module/modules/snapshot/NativeSnapshotModule.js.map +1 -1
  143. package/lib/module/modules/snapshot/SnapshotManager.js +1 -1
  144. package/lib/module/modules/snapshot/SnapshotManager.js.map +1 -1
  145. package/lib/module/types/Bounds.js +2 -0
  146. package/lib/module/types/{MapLibreRNEvent.js.map → Bounds.js.map} +1 -1
  147. package/lib/module/types/PressEvent.js +2 -0
  148. package/lib/module/types/PressEvent.js.map +1 -0
  149. package/lib/module/types/ViewPadding.js +2 -0
  150. package/lib/module/types/ViewPadding.js.map +1 -0
  151. package/lib/module/types/codegen/UnsafeMixed.js +2 -0
  152. package/lib/module/types/codegen/UnsafeMixed.js.map +1 -0
  153. package/lib/module/utils/index.js +0 -9
  154. package/lib/module/utils/index.js.map +1 -1
  155. package/lib/typescript/commonjs/src/MLRNModule.d.ts +1 -7
  156. package/lib/typescript/commonjs/src/MLRNModule.d.ts.map +1 -1
  157. package/lib/typescript/commonjs/src/components/Annotation.d.ts +3 -3
  158. package/lib/typescript/commonjs/src/components/Annotation.d.ts.map +1 -1
  159. package/lib/typescript/commonjs/src/components/Images.d.ts +1 -2
  160. package/lib/typescript/commonjs/src/components/Images.d.ts.map +1 -1
  161. package/lib/typescript/commonjs/src/components/ShapeSource.d.ts +2 -5
  162. package/lib/typescript/commonjs/src/components/ShapeSource.d.ts.map +1 -1
  163. package/lib/typescript/commonjs/src/components/VectorSource.d.ts +3 -2
  164. package/lib/typescript/commonjs/src/components/VectorSource.d.ts.map +1 -1
  165. package/lib/typescript/commonjs/src/components/camera/Camera.d.ts +180 -0
  166. package/lib/typescript/commonjs/src/components/camera/Camera.d.ts.map +1 -0
  167. package/lib/typescript/commonjs/src/components/camera/CameraNativeComponent.d.ts +37 -0
  168. package/lib/typescript/commonjs/src/components/camera/CameraNativeComponent.d.ts.map +1 -0
  169. package/lib/typescript/commonjs/src/components/camera/NativeCameraModule.d.ts +27 -0
  170. package/lib/typescript/commonjs/src/components/camera/NativeCameraModule.d.ts.map +1 -0
  171. package/lib/typescript/commonjs/src/components/map-view/MapView.d.ts +323 -0
  172. package/lib/typescript/commonjs/src/components/map-view/MapView.d.ts.map +1 -0
  173. package/lib/typescript/commonjs/src/components/map-view/MapViewNativeComponent.d.ts +69 -0
  174. package/lib/typescript/commonjs/src/components/map-view/MapViewNativeComponent.d.ts.map +1 -0
  175. package/lib/typescript/commonjs/src/components/map-view/NativeMapViewModule.d.ts +45 -0
  176. package/lib/typescript/commonjs/src/components/map-view/NativeMapViewModule.d.ts.map +1 -0
  177. package/lib/typescript/commonjs/src/index.d.ts +41 -1
  178. package/lib/typescript/commonjs/src/index.d.ts.map +1 -1
  179. package/lib/typescript/commonjs/src/modules/snapshot/NativeSnapshotModule.d.ts +2 -1
  180. package/lib/typescript/commonjs/src/modules/snapshot/NativeSnapshotModule.d.ts.map +1 -1
  181. package/lib/typescript/commonjs/src/types/Bounds.d.ts +2 -0
  182. package/lib/typescript/commonjs/src/types/Bounds.d.ts.map +1 -0
  183. package/lib/typescript/commonjs/src/types/PressEvent.d.ts +16 -0
  184. package/lib/typescript/commonjs/src/types/PressEvent.d.ts.map +1 -0
  185. package/lib/typescript/commonjs/src/types/ViewPadding.d.ts +7 -0
  186. package/lib/typescript/commonjs/src/types/ViewPadding.d.ts.map +1 -0
  187. package/lib/typescript/commonjs/src/types/codegen/UnsafeMixed.d.ts +10 -0
  188. package/lib/typescript/commonjs/src/types/codegen/UnsafeMixed.d.ts.map +1 -0
  189. package/lib/typescript/commonjs/src/utils/index.d.ts +1 -3
  190. package/lib/typescript/commonjs/src/utils/index.d.ts.map +1 -1
  191. package/lib/typescript/module/src/MLRNModule.d.ts +1 -7
  192. package/lib/typescript/module/src/MLRNModule.d.ts.map +1 -1
  193. package/lib/typescript/module/src/components/Annotation.d.ts +3 -3
  194. package/lib/typescript/module/src/components/Annotation.d.ts.map +1 -1
  195. package/lib/typescript/module/src/components/Images.d.ts +1 -2
  196. package/lib/typescript/module/src/components/Images.d.ts.map +1 -1
  197. package/lib/typescript/module/src/components/ShapeSource.d.ts +2 -5
  198. package/lib/typescript/module/src/components/ShapeSource.d.ts.map +1 -1
  199. package/lib/typescript/module/src/components/VectorSource.d.ts +3 -2
  200. package/lib/typescript/module/src/components/VectorSource.d.ts.map +1 -1
  201. package/lib/typescript/module/src/components/camera/Camera.d.ts +180 -0
  202. package/lib/typescript/module/src/components/camera/Camera.d.ts.map +1 -0
  203. package/lib/typescript/module/src/components/camera/CameraNativeComponent.d.ts +37 -0
  204. package/lib/typescript/module/src/components/camera/CameraNativeComponent.d.ts.map +1 -0
  205. package/lib/typescript/module/src/components/camera/NativeCameraModule.d.ts +27 -0
  206. package/lib/typescript/module/src/components/camera/NativeCameraModule.d.ts.map +1 -0
  207. package/lib/typescript/module/src/components/map-view/MapView.d.ts +323 -0
  208. package/lib/typescript/module/src/components/map-view/MapView.d.ts.map +1 -0
  209. package/lib/typescript/module/src/components/map-view/MapViewNativeComponent.d.ts +69 -0
  210. package/lib/typescript/module/src/components/map-view/MapViewNativeComponent.d.ts.map +1 -0
  211. package/lib/typescript/module/src/components/map-view/NativeMapViewModule.d.ts +45 -0
  212. package/lib/typescript/module/src/components/map-view/NativeMapViewModule.d.ts.map +1 -0
  213. package/lib/typescript/module/src/index.d.ts +41 -1
  214. package/lib/typescript/module/src/index.d.ts.map +1 -1
  215. package/lib/typescript/module/src/modules/snapshot/NativeSnapshotModule.d.ts +2 -1
  216. package/lib/typescript/module/src/modules/snapshot/NativeSnapshotModule.d.ts.map +1 -1
  217. package/lib/typescript/module/src/types/Bounds.d.ts +2 -0
  218. package/lib/typescript/module/src/types/Bounds.d.ts.map +1 -0
  219. package/lib/typescript/module/src/types/PressEvent.d.ts +16 -0
  220. package/lib/typescript/module/src/types/PressEvent.d.ts.map +1 -0
  221. package/lib/typescript/module/src/types/ViewPadding.d.ts +7 -0
  222. package/lib/typescript/module/src/types/ViewPadding.d.ts.map +1 -0
  223. package/lib/typescript/module/src/types/codegen/UnsafeMixed.d.ts +10 -0
  224. package/lib/typescript/module/src/types/codegen/UnsafeMixed.d.ts.map +1 -0
  225. package/lib/typescript/module/src/utils/index.d.ts +1 -3
  226. package/lib/typescript/module/src/utils/index.d.ts.map +1 -1
  227. package/package.json +38 -28
  228. package/src/MLRNModule.ts +0 -10
  229. package/src/components/Annotation.tsx +8 -23
  230. package/src/components/Images.tsx +2 -4
  231. package/src/components/ShapeSource.tsx +18 -31
  232. package/src/components/VectorSource.tsx +5 -28
  233. package/src/components/camera/Camera.tsx +311 -0
  234. package/src/components/camera/CameraNativeComponent.ts +61 -0
  235. package/src/components/camera/NativeCameraModule.ts +39 -0
  236. package/src/components/map-view/MapView.tsx +582 -0
  237. package/src/components/map-view/MapViewNativeComponent.ts +96 -0
  238. package/src/components/map-view/NativeMapViewModule.ts +83 -0
  239. package/src/index.ts +86 -1
  240. package/src/modules/snapshot/NativeSnapshotModule.ts +1 -2
  241. package/src/modules/snapshot/SnapshotManager.ts +1 -1
  242. package/src/types/Bounds.ts +1 -0
  243. package/src/types/PressEvent.ts +19 -0
  244. package/src/types/ViewPadding.ts +6 -0
  245. package/src/types/codegen/UnsafeMixed.ts +9 -0
  246. package/src/utils/index.ts +1 -14
  247. package/android/src/main/java/org/maplibre/reactnative/components/AbstractEvent.java +0 -35
  248. package/android/src/main/java/org/maplibre/reactnative/components/AbstractEventEmitter.java +0 -80
  249. package/android/src/main/java/org/maplibre/reactnative/components/camera/CameraStop.java +0 -245
  250. package/android/src/main/java/org/maplibre/reactnative/components/camera/CameraUpdateItem.java +0 -121
  251. package/android/src/main/java/org/maplibre/reactnative/components/camera/CameraUpdateQueue.java +0 -68
  252. package/android/src/main/java/org/maplibre/reactnative/components/camera/MLRNCamera.java +0 -519
  253. package/android/src/main/java/org/maplibre/reactnative/components/camera/MLRNCameraManager.java +0 -101
  254. package/android/src/main/java/org/maplibre/reactnative/components/camera/constants/CameraMode.java +0 -18
  255. package/android/src/main/java/org/maplibre/reactnative/components/mapview/LayerSourceInfo.java +0 -59
  256. package/android/src/main/java/org/maplibre/reactnative/components/mapview/MLRNAndroidTextureMapView.java +0 -13
  257. package/android/src/main/java/org/maplibre/reactnative/components/mapview/MLRNAndroidTextureMapViewManager.java +0 -27
  258. package/android/src/main/java/org/maplibre/reactnative/components/mapview/MLRNMapView.java +0 -1521
  259. package/android/src/main/java/org/maplibre/reactnative/components/mapview/MLRNMapViewManager.java +0 -342
  260. package/android/src/main/java/org/maplibre/reactnative/components/mapview/helpers/CameraChangeTracker.java +0 -37
  261. package/android/src/main/java/org/maplibre/reactnative/events/MapChangeEvent.java +0 -43
  262. package/android/src/main/java/org/maplibre/reactnative/events/MapUserTrackingModeEvent.java +0 -32
  263. package/android/src/main/java/org/maplibre/reactnative/location/UserLocationVerticalAlignment.java +0 -7
  264. package/android/src/main/java/org/maplibre/reactnative/location/UserTrackingMode.java +0 -59
  265. package/android/src/main/java/org/maplibre/reactnative/utils/GeoJSONUtils.java +0 -310
  266. package/ios/CameraMode.h +0 -10
  267. package/ios/CameraMode.m +0 -10
  268. package/ios/CameraStop.m +0 -73
  269. package/ios/MLRNCamera.h +0 -29
  270. package/ios/MLRNCamera.m +0 -236
  271. package/ios/MLRNCameraManager.h +0 -5
  272. package/ios/MLRNCameraManager.m +0 -39
  273. package/ios/MLRNMapView.m +0 -497
  274. package/ios/MLRNMapViewManager.h +0 -9
  275. package/ios/MLRNMapViewManager.m +0 -604
  276. package/lib/commonjs/MapLibreRN.js +0 -266
  277. package/lib/commonjs/MapLibreRN.js.map +0 -1
  278. package/lib/commonjs/components/Camera.js +0 -333
  279. package/lib/commonjs/components/Camera.js.map +0 -1
  280. package/lib/commonjs/components/MapView.js +0 -449
  281. package/lib/commonjs/components/MapView.js.map +0 -1
  282. package/lib/commonjs/hooks/useNativeRef.js +0 -14
  283. package/lib/commonjs/hooks/useNativeRef.js.map +0 -1
  284. package/lib/commonjs/types/CameraMode.js +0 -14
  285. package/lib/commonjs/types/CameraMode.js.map +0 -1
  286. package/lib/commonjs/types/MapLibreRNEvent.js +0 -6
  287. package/lib/commonjs/types/OnPressEvent.js +0 -2
  288. package/lib/module/MapLibreRN.js +0 -33
  289. package/lib/module/MapLibreRN.js.map +0 -1
  290. package/lib/module/components/Camera.js +0 -328
  291. package/lib/module/components/Camera.js.map +0 -1
  292. package/lib/module/components/MapView.js +0 -444
  293. package/lib/module/components/MapView.js.map +0 -1
  294. package/lib/module/hooks/useNativeRef.js +0 -10
  295. package/lib/module/hooks/useNativeRef.js.map +0 -1
  296. package/lib/module/types/CameraMode.js +0 -10
  297. package/lib/module/types/CameraMode.js.map +0 -1
  298. package/lib/module/types/MapLibreRNEvent.js +0 -4
  299. package/lib/module/types/OnPressEvent.js +0 -2
  300. package/lib/typescript/commonjs/src/MapLibreRN.d.ts +0 -41
  301. package/lib/typescript/commonjs/src/MapLibreRN.d.ts.map +0 -1
  302. package/lib/typescript/commonjs/src/components/Camera.d.ts +0 -134
  303. package/lib/typescript/commonjs/src/components/Camera.d.ts.map +0 -1
  304. package/lib/typescript/commonjs/src/components/MapView.d.ts +0 -223
  305. package/lib/typescript/commonjs/src/components/MapView.d.ts.map +0 -1
  306. package/lib/typescript/commonjs/src/hooks/useNativeRef.d.ts +0 -8
  307. package/lib/typescript/commonjs/src/hooks/useNativeRef.d.ts.map +0 -1
  308. package/lib/typescript/commonjs/src/types/CameraMode.d.ts +0 -7
  309. package/lib/typescript/commonjs/src/types/CameraMode.d.ts.map +0 -1
  310. package/lib/typescript/commonjs/src/types/MapLibreRNEvent.d.ts +0 -6
  311. package/lib/typescript/commonjs/src/types/MapLibreRNEvent.d.ts.map +0 -1
  312. package/lib/typescript/commonjs/src/types/OnPressEvent.d.ts +0 -12
  313. package/lib/typescript/commonjs/src/types/OnPressEvent.d.ts.map +0 -1
  314. package/lib/typescript/module/src/MapLibreRN.d.ts +0 -41
  315. package/lib/typescript/module/src/MapLibreRN.d.ts.map +0 -1
  316. package/lib/typescript/module/src/components/Camera.d.ts +0 -134
  317. package/lib/typescript/module/src/components/Camera.d.ts.map +0 -1
  318. package/lib/typescript/module/src/components/MapView.d.ts +0 -223
  319. package/lib/typescript/module/src/components/MapView.d.ts.map +0 -1
  320. package/lib/typescript/module/src/hooks/useNativeRef.d.ts +0 -8
  321. package/lib/typescript/module/src/hooks/useNativeRef.d.ts.map +0 -1
  322. package/lib/typescript/module/src/types/CameraMode.d.ts +0 -7
  323. package/lib/typescript/module/src/types/CameraMode.d.ts.map +0 -1
  324. package/lib/typescript/module/src/types/MapLibreRNEvent.d.ts +0 -6
  325. package/lib/typescript/module/src/types/MapLibreRNEvent.d.ts.map +0 -1
  326. package/lib/typescript/module/src/types/OnPressEvent.d.ts +0 -12
  327. package/lib/typescript/module/src/types/OnPressEvent.d.ts.map +0 -1
  328. package/src/MapLibreRN.ts +0 -75
  329. package/src/components/Camera.tsx +0 -568
  330. package/src/components/MapView.tsx +0 -838
  331. package/src/hooks/useNativeRef.ts +0 -14
  332. package/src/types/CameraMode.ts +0 -6
  333. package/src/types/MapLibreRNEvent.ts +0 -7
  334. package/src/types/OnPressEvent.ts +0 -11
  335. /package/ios/{CameraUpdateItem.h → components/camera/CameraUpdateItem.h} +0 -0
  336. /package/ios/{CameraUpdateQueue.h → components/camera/CameraUpdateQueue.h} +0 -0
  337. /package/ios/{CameraUpdateQueue.m → components/camera/CameraUpdateQueue.m} +0 -0
  338. /package/ios/{MLRNSnapshotModule → modules/snapshot}/MLRNSnapshotModule.h +0 -0
@@ -0,0 +1,18 @@
1
+ #import <React/RCTViewComponentView.h>
2
+ #import <UIKit/UIKit.h>
3
+
4
+ #import <React/RCTUIManager.h>
5
+ #import <React/RCTViewComponentView.h>
6
+
7
+ #ifndef MLRNMapViewComponentView_h
8
+ #define MLRNMapViewComponentView_h
9
+
10
+ NS_ASSUME_NONNULL_BEGIN
11
+
12
+ @interface MLRNMapViewComponentView : RCTViewComponentView
13
+
14
+ @end
15
+
16
+ NS_ASSUME_NONNULL_END
17
+
18
+ #endif
@@ -0,0 +1,400 @@
1
+ #import "MLRNMapViewComponentView.h"
2
+
3
+ #import <react/renderer/components/MapLibreReactNativeSpec/ComponentDescriptors.h>
4
+ #import <react/renderer/components/MapLibreReactNativeSpec/EventEmitters.h>
5
+ #import <react/renderer/components/MapLibreReactNativeSpec/Props.h>
6
+ #import <react/renderer/components/MapLibreReactNativeSpec/RCTComponentViewHelpers.h>
7
+
8
+ #import "RCTFabricComponentsPlugins.h"
9
+
10
+ #import <React/RCTConversions.h>
11
+ #import "MLRNMapView.h"
12
+
13
+ using namespace facebook::react;
14
+
15
+ struct PressEvent {
16
+ double longitude;
17
+ double latitude;
18
+ double locationX;
19
+ double locationY;
20
+ };
21
+
22
+ PressEvent createPressEvent(NSDictionary *dict) {
23
+ PressEvent result;
24
+
25
+ result.longitude = [dict[@"properties"][@"longitude"] doubleValue];
26
+ result.latitude = [dict[@"properties"][@"latitude"] doubleValue];
27
+ result.locationX = [dict[@"properties"][@"locationX"] doubleValue];
28
+ result.locationY = [dict[@"properties"][@"locationY"] doubleValue];
29
+
30
+ return result;
31
+ }
32
+
33
+ struct ViewState {
34
+ double longitude;
35
+ double latitude;
36
+ double zoom;
37
+ double bearing;
38
+ double pitch;
39
+ folly::dynamic bounds;
40
+ bool animated;
41
+ bool userInteraction;
42
+ };
43
+
44
+ ViewState createViewState(NSDictionary *dict) {
45
+ ViewState result;
46
+
47
+ result.longitude = [dict[@"longitude"] doubleValue];
48
+ result.latitude = [dict[@"latitude"] doubleValue];
49
+ result.zoom = [dict[@"zoom"] doubleValue];
50
+ result.bearing = [dict[@"bearing"] doubleValue];
51
+ result.pitch = [dict[@"pitch"] doubleValue];
52
+
53
+ NSArray *boundsArray = dict[@"bounds"];
54
+ folly::dynamic bounds = folly::dynamic::array;
55
+ for (NSNumber *coordinate in boundsArray) {
56
+ bounds.push_back([coordinate doubleValue]);
57
+ }
58
+ result.bounds = bounds;
59
+
60
+ result.animated = [dict[@"animated"] boolValue];
61
+ result.userInteraction = [dict[@"userInteraction"] boolValue];
62
+
63
+ return result;
64
+ }
65
+
66
+ // MARK: - MLRNMapViewComponentView
67
+
68
+ @interface MLRNMapViewComponentView () <RCTMLRNMapViewViewProtocol>
69
+
70
+ @end
71
+
72
+ @implementation MLRNMapViewComponentView {
73
+ MLRNMapView *_view;
74
+ CGRect _frame;
75
+ }
76
+
77
+ + (BOOL)shouldBeRecycled {
78
+ return NO;
79
+ }
80
+
81
+ - (instancetype)initWithFrame:(CGRect)frame {
82
+ if (self = [super initWithFrame:frame]) {
83
+ static const auto defaultProps = std::make_shared<const MLRNMapViewProps>();
84
+ _props = defaultProps;
85
+ _frame = frame;
86
+ [self prepareView];
87
+ }
88
+
89
+ return self;
90
+ }
91
+
92
+ - (void)prepareView {
93
+ _view = [[MLRNMapView alloc] initWithFrame:_frame];
94
+
95
+ // Capture weak self reference to prevent retain cycle
96
+ __weak __typeof__(self) weakSelf = self;
97
+
98
+ [_view setReactOnPress:^(NSDictionary *event) {
99
+ __typeof__(self) strongSelf = weakSelf;
100
+
101
+ if (strongSelf != nullptr && strongSelf->_eventEmitter != nullptr) {
102
+ PressEvent pressEvent = createPressEvent(event);
103
+
104
+ facebook::react::MLRNMapViewEventEmitter::OnPress eventStruct{
105
+ pressEvent.longitude, pressEvent.latitude, pressEvent.locationX, pressEvent.locationY};
106
+
107
+ std::dynamic_pointer_cast<const facebook::react::MLRNMapViewEventEmitter>(
108
+ strongSelf->_eventEmitter)
109
+ ->onPress(eventStruct);
110
+ }
111
+ }];
112
+
113
+ [_view setReactOnLongPress:^(NSDictionary *event) {
114
+ __typeof__(self) strongSelf = weakSelf;
115
+
116
+ if (strongSelf != nullptr && strongSelf->_eventEmitter != nullptr) {
117
+ PressEvent pressEvent = createPressEvent(event);
118
+
119
+ facebook::react::MLRNMapViewEventEmitter::OnLongPress eventStruct{
120
+ pressEvent.longitude, pressEvent.latitude, pressEvent.locationX, pressEvent.locationY};
121
+
122
+ std::dynamic_pointer_cast<const facebook::react::MLRNMapViewEventEmitter>(
123
+ strongSelf->_eventEmitter)
124
+ ->onLongPress(eventStruct);
125
+ }
126
+ }];
127
+
128
+ [_view setReactOnRegionWillChange:^(NSDictionary *event) {
129
+ __typeof__(self) strongSelf = weakSelf;
130
+
131
+ if (strongSelf != nullptr && strongSelf->_eventEmitter != nullptr) {
132
+ ViewState viewState = createViewState(event);
133
+
134
+ facebook::react::MLRNMapViewEventEmitter::OnRegionWillChange eventStruct{
135
+ viewState.longitude, viewState.latitude, viewState.zoom, viewState.bearing,
136
+ viewState.pitch, viewState.bounds, viewState.animated, viewState.userInteraction};
137
+
138
+ std::dynamic_pointer_cast<const facebook::react::MLRNMapViewEventEmitter>(
139
+ strongSelf->_eventEmitter)
140
+ ->onRegionWillChange(eventStruct);
141
+ }
142
+ }];
143
+ [_view setReactOnRegionIsChanging:^(NSDictionary *event) {
144
+ __typeof__(self) strongSelf = weakSelf;
145
+
146
+ if (strongSelf != nullptr && strongSelf->_eventEmitter != nullptr) {
147
+ ViewState viewState = createViewState(event);
148
+
149
+ facebook::react::MLRNMapViewEventEmitter::OnRegionIsChanging eventStruct{
150
+ viewState.longitude, viewState.latitude, viewState.zoom, viewState.bearing,
151
+ viewState.pitch, viewState.bounds, viewState.animated, viewState.userInteraction};
152
+
153
+ std::dynamic_pointer_cast<const facebook::react::MLRNMapViewEventEmitter>(
154
+ strongSelf->_eventEmitter)
155
+ ->onRegionIsChanging(eventStruct);
156
+ }
157
+ }];
158
+ [_view setReactOnRegionDidChange:^(NSDictionary *event) {
159
+ __typeof__(self) strongSelf = weakSelf;
160
+
161
+ if (strongSelf != nullptr && strongSelf->_eventEmitter != nullptr) {
162
+ ViewState viewState = createViewState(event);
163
+
164
+ facebook::react::MLRNMapViewEventEmitter::OnRegionDidChange eventStruct{
165
+ viewState.longitude, viewState.latitude, viewState.zoom, viewState.bearing,
166
+ viewState.pitch, viewState.bounds, viewState.animated, viewState.userInteraction};
167
+
168
+ std::dynamic_pointer_cast<const facebook::react::MLRNMapViewEventEmitter>(
169
+ strongSelf->_eventEmitter)
170
+ ->onRegionDidChange(eventStruct);
171
+ }
172
+ }];
173
+
174
+ [_view setReactOnWillStartLoadingMap:^(NSDictionary *event) {
175
+ __typeof__(self) strongSelf = weakSelf;
176
+
177
+ if (strongSelf != nullptr && strongSelf->_eventEmitter != nullptr) {
178
+ std::dynamic_pointer_cast<const facebook::react::MLRNMapViewEventEmitter>(
179
+ strongSelf->_eventEmitter)
180
+ ->onWillStartLoadingMap({});
181
+ }
182
+ }];
183
+ [_view setReactOnDidFinishLoadingMap:^(NSDictionary *event) {
184
+ __typeof__(self) strongSelf = weakSelf;
185
+
186
+ if (strongSelf != nullptr && strongSelf->_eventEmitter != nullptr) {
187
+ std::dynamic_pointer_cast<const facebook::react::MLRNMapViewEventEmitter>(
188
+ strongSelf->_eventEmitter)
189
+ ->onDidFinishLoadingMap({});
190
+ }
191
+ }];
192
+ [_view setReactOnDidFailLoadingMap:^(NSDictionary *event) {
193
+ __typeof__(self) strongSelf = weakSelf;
194
+
195
+ if (strongSelf != nullptr && strongSelf->_eventEmitter != nullptr) {
196
+ std::dynamic_pointer_cast<const facebook::react::MLRNMapViewEventEmitter>(
197
+ strongSelf->_eventEmitter)
198
+ ->onDidFailLoadingMap({});
199
+ }
200
+ }];
201
+
202
+ [_view setReactOnWillStartRenderingFrame:^(NSDictionary *event) {
203
+ __typeof__(self) strongSelf = weakSelf;
204
+
205
+ if (strongSelf != nullptr && strongSelf->_eventEmitter != nullptr) {
206
+ std::dynamic_pointer_cast<const facebook::react::MLRNMapViewEventEmitter>(
207
+ strongSelf->_eventEmitter)
208
+ ->onWillStartRenderingFrame({});
209
+ }
210
+ }];
211
+ [_view setReactOnDidFinishRenderingFrame:^(NSDictionary *event) {
212
+ __typeof__(self) strongSelf = weakSelf;
213
+
214
+ if (strongSelf != nullptr && strongSelf->_eventEmitter != nullptr) {
215
+ std::dynamic_pointer_cast<const facebook::react::MLRNMapViewEventEmitter>(
216
+ strongSelf->_eventEmitter)
217
+ ->onDidFinishRenderingFrame({});
218
+ }
219
+ }];
220
+ [_view setReactOnDidFinishRenderingFrameFully:^(NSDictionary *event) {
221
+ __typeof__(self) strongSelf = weakSelf;
222
+
223
+ if (strongSelf != nullptr && strongSelf->_eventEmitter != nullptr) {
224
+ std::dynamic_pointer_cast<const facebook::react::MLRNMapViewEventEmitter>(
225
+ strongSelf->_eventEmitter)
226
+ ->onDidFinishRenderingFrameFully({});
227
+ }
228
+ }];
229
+
230
+ [_view setReactOnWillStartRenderingMap:^(NSDictionary *event) {
231
+ __typeof__(self) strongSelf = weakSelf;
232
+
233
+ if (strongSelf != nullptr && strongSelf->_eventEmitter != nullptr) {
234
+ std::dynamic_pointer_cast<const facebook::react::MLRNMapViewEventEmitter>(
235
+ strongSelf->_eventEmitter)
236
+ ->onWillStartRenderingMap({});
237
+ }
238
+ }];
239
+ [_view setReactOnDidFinishRenderingMap:^(NSDictionary *event) {
240
+ __typeof__(self) strongSelf = weakSelf;
241
+
242
+ if (strongSelf != nullptr && strongSelf->_eventEmitter != nullptr) {
243
+ std::dynamic_pointer_cast<const facebook::react::MLRNMapViewEventEmitter>(
244
+ strongSelf->_eventEmitter)
245
+ ->onDidFinishRenderingMap({});
246
+ }
247
+ }];
248
+ [_view setReactOnDidFinishRenderingMapFully:^(NSDictionary *event) {
249
+ __typeof__(self) strongSelf = weakSelf;
250
+
251
+ if (strongSelf != nullptr && strongSelf->_eventEmitter != nullptr) {
252
+ std::dynamic_pointer_cast<const facebook::react::MLRNMapViewEventEmitter>(
253
+ strongSelf->_eventEmitter)
254
+ ->onDidFinishRenderingMapFully({});
255
+ }
256
+ }];
257
+
258
+ [_view setReactOnDidFinishLoadingStyle:^(NSDictionary *event) {
259
+ __typeof__(self) strongSelf = weakSelf;
260
+
261
+ if (strongSelf != nullptr && strongSelf->_eventEmitter != nullptr) {
262
+ std::dynamic_pointer_cast<const facebook::react::MLRNMapViewEventEmitter>(
263
+ strongSelf->_eventEmitter)
264
+ ->onDidFinishLoadingStyle({});
265
+ }
266
+ }];
267
+
268
+ self.contentView = _view;
269
+ }
270
+
271
+ - (void)mountChildComponentView:(UIView<RCTComponentViewProtocol> *)childComponentView
272
+ index:(NSInteger)index {
273
+ if ([childComponentView isKindOfClass:[RCTViewComponentView class]] &&
274
+ ((RCTViewComponentView *)childComponentView).contentView) {
275
+ [_view addToMap:((RCTViewComponentView *)childComponentView).contentView];
276
+ }
277
+ [super mountChildComponentView:childComponentView index:index + 1];
278
+ }
279
+
280
+ - (void)unmountChildComponentView:(UIView<RCTComponentViewProtocol> *)childComponentView
281
+ index:(NSInteger)index {
282
+ if ([childComponentView isKindOfClass:[RCTViewComponentView class]] &&
283
+ ((RCTViewComponentView *)childComponentView).contentView) {
284
+ [_view removeFromMap:((RCTViewComponentView *)childComponentView).contentView];
285
+ }
286
+ [super unmountChildComponentView:childComponentView index:index + 1];
287
+ }
288
+
289
+ #pragma mark - RCTComponentViewProtocol
290
+
291
+ - (void)updateProps:(Props::Shared const &)props oldProps:(Props::Shared const &)oldProps {
292
+ const auto &oldViewProps = *std::static_pointer_cast<MLRNMapViewProps const>(_props);
293
+ const auto &newViewProps = *std::static_pointer_cast<MLRNMapViewProps const>(props);
294
+
295
+ if (oldViewProps.mapStyle != newViewProps.mapStyle) {
296
+ NSString *mapStyle = [NSString stringWithCString:newViewProps.mapStyle.c_str()
297
+ encoding:NSUTF8StringEncoding];
298
+ [_view setReactMapStyle:mapStyle];
299
+ }
300
+
301
+ if (oldViewProps.contentInset.top != newViewProps.contentInset.top ||
302
+ oldViewProps.contentInset.right != newViewProps.contentInset.right ||
303
+ oldViewProps.contentInset.bottom != newViewProps.contentInset.bottom ||
304
+ oldViewProps.contentInset.left != newViewProps.contentInset.left) {
305
+ NSDictionary *contentInset = @{
306
+ @"top" : @(newViewProps.contentInset.top),
307
+ @"right" : @(newViewProps.contentInset.right),
308
+ @"bottom" : @(newViewProps.contentInset.bottom),
309
+ @"left" : @(newViewProps.contentInset.left)
310
+ };
311
+
312
+ [_view setReactContentInset:contentInset];
313
+ }
314
+
315
+ if (oldViewProps.preferredFramesPerSecond != newViewProps.preferredFramesPerSecond) {
316
+ [_view setReactPreferredFramesPerSecond:newViewProps.preferredFramesPerSecond];
317
+ }
318
+
319
+ if (oldViewProps.dragPan != newViewProps.dragPan) {
320
+ [_view setReactScrollEnabled:newViewProps.dragPan];
321
+ }
322
+
323
+ if (oldViewProps.touchAndDoubleTapZoom != newViewProps.touchAndDoubleTapZoom) {
324
+ [_view setReactZoomEnabled:newViewProps.touchAndDoubleTapZoom];
325
+ }
326
+
327
+ if (oldViewProps.touchRotate != newViewProps.touchRotate) {
328
+ [_view setReactRotateEnabled:newViewProps.touchRotate];
329
+ }
330
+
331
+ if (oldViewProps.touchPitch != newViewProps.touchPitch) {
332
+ [_view setPitchEnabled:newViewProps.touchPitch];
333
+ }
334
+
335
+ if (oldViewProps.tintColor != newViewProps.tintColor) {
336
+ [_view setTintColor:RCTUIColorFromSharedColor(newViewProps.tintColor)];
337
+ }
338
+
339
+ if (oldViewProps.attribution != newViewProps.attribution) {
340
+ [_view setReactAttributionEnabled:newViewProps.attribution];
341
+ }
342
+
343
+ if (oldViewProps.attributionPosition.top != newViewProps.attributionPosition.top ||
344
+ oldViewProps.attributionPosition.right != newViewProps.attributionPosition.right ||
345
+ oldViewProps.attributionPosition.bottom != newViewProps.attributionPosition.bottom ||
346
+ oldViewProps.attributionPosition.left != newViewProps.attributionPosition.left) {
347
+ NSDictionary *attributionPosition = @{
348
+ @"top" : @(newViewProps.attributionPosition.top),
349
+ @"right" : @(newViewProps.attributionPosition.right),
350
+ @"bottom" : @(newViewProps.attributionPosition.bottom),
351
+ @"left" : @(newViewProps.attributionPosition.left)
352
+ };
353
+
354
+ [_view setReactAttributionPosition:attributionPosition];
355
+ }
356
+
357
+ if (oldViewProps.logo != newViewProps.logo) {
358
+ [_view setReactLogoEnabled:newViewProps.logo];
359
+ }
360
+
361
+ if (oldViewProps.logoPosition.top != newViewProps.logoPosition.top ||
362
+ oldViewProps.logoPosition.right != newViewProps.logoPosition.right ||
363
+ oldViewProps.logoPosition.bottom != newViewProps.logoPosition.bottom ||
364
+ oldViewProps.logoPosition.left != newViewProps.logoPosition.left) {
365
+ NSDictionary *logoPosition = @{
366
+ @"top" : @(newViewProps.logoPosition.top),
367
+ @"right" : @(newViewProps.logoPosition.right),
368
+ @"bottom" : @(newViewProps.logoPosition.bottom),
369
+ @"left" : @(newViewProps.logoPosition.left)
370
+ };
371
+
372
+ [_view setReactLogoPosition:logoPosition];
373
+ }
374
+
375
+ if (oldViewProps.compass != newViewProps.compass) {
376
+ [_view setReactCompassEnabled:newViewProps.compass];
377
+ }
378
+
379
+ if (oldViewProps.compassPosition.top != newViewProps.compassPosition.top ||
380
+ oldViewProps.compassPosition.right != newViewProps.compassPosition.right ||
381
+ oldViewProps.compassPosition.bottom != newViewProps.compassPosition.bottom ||
382
+ oldViewProps.compassPosition.left != newViewProps.compassPosition.left) {
383
+ NSDictionary *compassPosition = @{
384
+ @"top" : @(newViewProps.compassPosition.top),
385
+ @"right" : @(newViewProps.compassPosition.right),
386
+ @"bottom" : @(newViewProps.compassPosition.bottom),
387
+ @"left" : @(newViewProps.compassPosition.left)
388
+ };
389
+
390
+ [_view setReactCompassPosition:compassPosition];
391
+ }
392
+
393
+ [super updateProps:props oldProps:oldProps];
394
+ }
395
+
396
+ + (ComponentDescriptorProvider)componentDescriptorProvider {
397
+ return concreteComponentDescriptorProvider<MLRNMapViewComponentDescriptor>();
398
+ }
399
+
400
+ @end
@@ -0,0 +1,70 @@
1
+ #import <MapLibre/MapLibre.h>
2
+ #import "ViewManager.h"
3
+
4
+ @interface MLRNMapViewManager : ViewManager <MLNMapViewDelegate>
5
+
6
+ + (void)getCenter:(MLRNMapView *_Nonnull)view
7
+ resolve:(RCTPromiseResolveBlock _Nonnull)resolve
8
+ reject:(RCTPromiseRejectBlock _Nonnull)reject;
9
+
10
+ + (void)getZoom:(MLRNMapView *_Nonnull)view
11
+ resolve:(RCTPromiseResolveBlock _Nonnull)resolve
12
+ reject:(RCTPromiseRejectBlock _Nonnull)reject;
13
+
14
+ + (void)getBearing:(MLRNMapView *_Nonnull)view
15
+ resolve:(RCTPromiseResolveBlock _Nonnull)resolve
16
+ reject:(RCTPromiseRejectBlock _Nonnull)reject;
17
+
18
+ + (void)getPitch:(MLRNMapView *_Nonnull)view
19
+ resolve:(RCTPromiseResolveBlock _Nonnull)resolve
20
+ reject:(RCTPromiseRejectBlock _Nonnull)reject;
21
+
22
+ + (void)getBounds:(MLRNMapView *_Nonnull)view
23
+ resolve:(RCTPromiseResolveBlock _Nonnull)resolve
24
+ reject:(RCTPromiseRejectBlock _Nonnull)reject;
25
+
26
+ + (void)getViewState:(MLRNMapView *_Nonnull)view
27
+ resolve:(RCTPromiseResolveBlock _Nonnull)resolve
28
+ reject:(RCTPromiseRejectBlock _Nonnull)reject;
29
+
30
+ + (void)project:(MLRNMapView *_Nonnull)view
31
+ coordinate:(CLLocationCoordinate2D)coordinate
32
+ resolve:(RCTPromiseResolveBlock _Nonnull)resolve
33
+ reject:(RCTPromiseRejectBlock _Nonnull)reject;
34
+
35
+ + (void)unproject:(MLRNMapView *_Nonnull)view
36
+ point:(CGPoint)point
37
+ resolve:(RCTPromiseResolveBlock _Nonnull)resolve
38
+ reject:(RCTPromiseRejectBlock _Nonnull)reject;
39
+
40
+ + (void)takeSnap:(MLRNMapView *_Nonnull)view
41
+ writeToDisk:(BOOL)writeToDisk
42
+ resolve:(RCTPromiseResolveBlock _Nonnull)resolve
43
+ reject:(RCTPromiseRejectBlock _Nonnull)reject;
44
+
45
+ + (void)queryRenderedFeaturesWithCoordinate:(MLRNMapView *_Nonnull)view
46
+ coordinate:(CLLocationCoordinate2D)coordinate
47
+ layerIds:(NSSet *_Nonnull)layerIds
48
+ predicate:(NSPredicate *_Nonnull)predicate
49
+ resolve:(RCTPromiseResolveBlock _Nonnull)resolve
50
+ reject:(RCTPromiseRejectBlock _Nonnull)reject;
51
+
52
+ + (void)queryRenderedFeaturesWithBounds:(MLRNMapView *_Nonnull)view
53
+ bounds:(MLNCoordinateBounds)bounds
54
+ layerIds:(NSSet *_Nonnull)layerIds
55
+ predicate:(NSPredicate *_Nonnull)predicate
56
+ resolve:(RCTPromiseResolveBlock _Nonnull)resolve
57
+ reject:(RCTPromiseRejectBlock _Nonnull)reject;
58
+
59
+ + (void)showAttribution:(MLRNMapView *_Nonnull)view
60
+ resolve:(RCTPromiseResolveBlock _Nonnull)resolve
61
+ reject:(RCTPromiseRejectBlock _Nonnull)reject;
62
+
63
+ + (void)setSourceVisibility:(MLRNMapView *_Nonnull)view
64
+ visible:(BOOL)visible
65
+ sourceId:(nonnull NSString *)sourceId
66
+ sourceLayerId:(nullable NSString *)sourceLayerId
67
+ resolve:(RCTPromiseResolveBlock _Nonnull)resolve
68
+ reject:(RCTPromiseRejectBlock _Nonnull)reject;
69
+
70
+ @end
@@ -0,0 +1,163 @@
1
+ #import <React/RCTUIManager.h>
2
+
3
+ #import "CameraStop.h"
4
+ #import "CameraUpdateQueue.h"
5
+ #import "FilterParser.h"
6
+ #import "MLRNEvent.h"
7
+ #import "MLRNEventTypes.h"
8
+ #import "MLRNImages.h"
9
+ #import "MLRNMapTouchEvent.h"
10
+ #import "MLRNMapView.h"
11
+ #import "MLRNMapViewManager.h"
12
+ #import "MLRNShapeSource.h"
13
+ #import "MLRNUserLocation.h"
14
+ #import "MLRNUtils.h"
15
+
16
+ @implementation MLRNMapViewManager
17
+
18
+ // MARK: - React View Methods
19
+
20
+ + (void)getCenter:(MLRNMapView *)view
21
+ resolve:(RCTPromiseResolveBlock)resolve
22
+ reject:(RCTPromiseRejectBlock)reject {
23
+ resolve(@{
24
+ @"longitude" : @(view.centerCoordinate.longitude),
25
+ @"latitude" : @(view.centerCoordinate.latitude)
26
+ });
27
+ }
28
+
29
+ + (void)getZoom:(MLRNMapView *)view
30
+ resolve:(RCTPromiseResolveBlock)resolve
31
+ reject:(RCTPromiseRejectBlock)reject {
32
+ resolve(@(view.zoomLevel));
33
+ }
34
+
35
+ + (void)getBearing:(MLRNMapView *)view
36
+ resolve:(RCTPromiseResolveBlock)resolve
37
+ reject:(RCTPromiseRejectBlock)reject {
38
+ resolve(@(view.camera.heading));
39
+ }
40
+
41
+ + (void)getPitch:(MLRNMapView *)view
42
+ resolve:(RCTPromiseResolveBlock)resolve
43
+ reject:(RCTPromiseRejectBlock)reject {
44
+ resolve(@(view.camera.pitch));
45
+ }
46
+
47
+ + (void)getBounds:(MLRNMapView *)view
48
+ resolve:(RCTPromiseResolveBlock)resolve
49
+ reject:(RCTPromiseRejectBlock)reject {
50
+ resolve([MLRNUtils fromCoordinateBounds:view.visibleCoordinateBounds]);
51
+ }
52
+
53
+ + (void)getViewState:(MLRNMapView *)view
54
+ resolve:(RCTPromiseResolveBlock)resolve
55
+ reject:(RCTPromiseRejectBlock)reject {
56
+ NSDictionary *center = @{
57
+ @"longitude" : @(view.centerCoordinate.longitude),
58
+ @"latitude" : @(view.centerCoordinate.latitude)
59
+ };
60
+ NSNumber *zoom = @(view.zoomLevel);
61
+ NSNumber *bearing = @(view.camera.heading);
62
+ NSNumber *pitch = @(view.camera.pitch);
63
+ NSArray *bounds = [MLRNUtils fromCoordinateBounds:view.visibleCoordinateBounds];
64
+
65
+ NSMutableDictionary *payload = [center mutableCopy];
66
+ payload[@"zoom"] = zoom;
67
+ payload[@"bearing"] = bearing;
68
+ payload[@"pitch"] = pitch;
69
+ payload[@"bounds"] = bounds;
70
+
71
+ resolve(payload);
72
+ }
73
+
74
+ + (CGPoint)project:(MLRNMapView *)view coordinate:(CLLocationCoordinate2D)coordinate {
75
+ CGPoint pointInView = [view convertCoordinate:coordinate toPointToView:view];
76
+
77
+ return pointInView;
78
+ }
79
+
80
+ + (void)project:(MLRNMapView *)view
81
+ coordinate:(CLLocationCoordinate2D)coordinate
82
+ resolve:(RCTPromiseResolveBlock)resolve
83
+ reject:(RCTPromiseRejectBlock)reject {
84
+ CGPoint point = [self project:view coordinate:coordinate];
85
+
86
+ resolve(@[ @(point.x), @(point.y) ]);
87
+ }
88
+
89
+ + (void)unproject:(MLRNMapView *)view
90
+ point:(CGPoint)point
91
+ resolve:(RCTPromiseResolveBlock)resolve
92
+ reject:(RCTPromiseRejectBlock)reject {
93
+ CLLocationCoordinate2D coordinate = [view convertPoint:point toCoordinateFromView:view];
94
+
95
+ resolve(@[ @(coordinate.longitude), @(coordinate.latitude) ]);
96
+ }
97
+
98
+ + (void)takeSnap:(MLRNMapView *)view
99
+ writeToDisk:(BOOL)writeToDisk
100
+ resolve:(RCTPromiseResolveBlock)resolve
101
+ reject:(RCTPromiseRejectBlock)reject {
102
+ NSString *uri = [view takeSnap:writeToDisk];
103
+ resolve(uri);
104
+ }
105
+
106
+ + (void)queryRenderedFeaturesWithCoordinate:(MLRNMapView *)view
107
+ coordinate:(CLLocationCoordinate2D)coordinate
108
+ layerIds:(NSSet *)layerIds
109
+ predicate:(NSPredicate *)predicate
110
+ resolve:(RCTPromiseResolveBlock)resolve
111
+ reject:(RCTPromiseRejectBlock)reject {
112
+ CGPoint point = [self project:view coordinate:coordinate];
113
+
114
+ NSArray<id<MLNFeature>> *shapes = [view visibleFeaturesAtPoint:point
115
+ inStyleLayersWithIdentifiers:layerIds
116
+ predicate:predicate];
117
+
118
+ NSMutableArray<NSDictionary *> *features = [[NSMutableArray alloc] init];
119
+ for (int i = 0; i < shapes.count; i++) {
120
+ [features addObject:shapes[i].geoJSONDictionary];
121
+ }
122
+
123
+ resolve(@{@"type" : @"FeatureCollection", @"features" : features});
124
+ }
125
+
126
+ + (void)queryRenderedFeaturesWithBounds:(MLRNMapView *)view
127
+ bounds:(MLNCoordinateBounds)bounds
128
+ layerIds:(NSSet *)layerIds
129
+ predicate:(NSPredicate *)predicate
130
+ resolve:(RCTPromiseResolveBlock)resolve
131
+ reject:(RCTPromiseRejectBlock)reject {
132
+ CGPoint swPoint = [self project:view coordinate:bounds.sw];
133
+ CGPoint nePoint = [self project:view coordinate:bounds.ne];
134
+
135
+ CGRect bbox = CGRectMake(swPoint.x, swPoint.y, nePoint.x - swPoint.x, nePoint.y - swPoint.y);
136
+
137
+ NSArray<id<MLNFeature>> *shapes = [view visibleFeaturesInRect:bbox
138
+ inStyleLayersWithIdentifiers:layerIds
139
+ predicate:predicate];
140
+
141
+ NSArray<NSDictionary *> *features = [MLRNUtils featuresToJSON:shapes];
142
+
143
+ resolve(@{@"type" : @"FeatureCollection", @"features" : features});
144
+ }
145
+
146
+ + (void)showAttribution:(MLRNMapView *)view
147
+ resolve:(RCTPromiseResolveBlock)resolve
148
+ reject:(RCTPromiseRejectBlock)reject {
149
+ [view showAttribution:view];
150
+ resolve(nil);
151
+ }
152
+
153
+ + (void)setSourceVisibility:(MLRNMapView *)view
154
+ visible:(BOOL)visible
155
+ sourceId:(nonnull NSString *)sourceId
156
+ sourceLayerId:(nullable NSString *)sourceLayerId
157
+ resolve:(RCTPromiseResolveBlock)resolve
158
+ reject:(RCTPromiseRejectBlock)reject {
159
+ [view setSourceVisibility:visible sourceId:sourceId sourceLayerId:sourceLayerId];
160
+ resolve(nil);
161
+ }
162
+
163
+ @end
@@ -0,0 +1,4 @@
1
+ #import <MapLibreReactNativeSpec/MapLibreReactNativeSpec.h>
2
+
3
+ @interface MLRNMapViewModule : NSObject <NativeMapViewModuleSpec>
4
+ @end