@maplibre/maplibre-react-native 11.0.0-alpha.43 → 11.0.0-alpha.44

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 (215) hide show
  1. package/android/src/main/java/org/maplibre/reactnative/components/AbstractEvent.kt +20 -24
  2. package/android/src/main/java/org/maplibre/reactnative/components/AbstractEventEmitter.kt +19 -10
  3. package/android/src/main/java/org/maplibre/reactnative/components/annotations/callout/MLRNCallout.kt +3 -2
  4. package/android/src/main/java/org/maplibre/reactnative/components/annotations/callout/MLRNCalloutManager.kt +1 -4
  5. package/android/src/main/java/org/maplibre/reactnative/components/annotations/markerview/MLRNMarkerView.kt +60 -33
  6. package/android/src/main/java/org/maplibre/reactnative/components/annotations/markerview/MLRNMarkerViewContent.kt +4 -3
  7. package/android/src/main/java/org/maplibre/reactnative/components/annotations/markerview/MLRNMarkerViewManager.kt +34 -18
  8. package/android/src/main/java/org/maplibre/reactnative/components/annotations/markerview/MarkerViewManager.kt +18 -9
  9. package/android/src/main/java/org/maplibre/reactnative/components/annotations/pointannotation/MLRNPointAnnotation.kt +71 -49
  10. package/android/src/main/java/org/maplibre/reactnative/components/annotations/pointannotation/MLRNPointAnnotationManager.kt +51 -24
  11. package/android/src/main/java/org/maplibre/reactnative/components/camera/CameraStop.kt +36 -15
  12. package/android/src/main/java/org/maplibre/reactnative/components/camera/CameraUpdateItem.kt +17 -26
  13. package/android/src/main/java/org/maplibre/reactnative/components/camera/CameraUpdateQueue.kt +1 -3
  14. package/android/src/main/java/org/maplibre/reactnative/components/camera/MLRNCamera.kt +88 -74
  15. package/android/src/main/java/org/maplibre/reactnative/components/camera/MLRNCameraManager.kt +29 -12
  16. package/android/src/main/java/org/maplibre/reactnative/components/camera/MLRNCameraModule.kt +9 -7
  17. package/android/src/main/java/org/maplibre/reactnative/components/camera/constants/CameraEasing.kt +3 -4
  18. package/android/src/main/java/org/maplibre/reactnative/components/layers/MLRNLayer.kt +44 -27
  19. package/android/src/main/java/org/maplibre/reactnative/components/layers/MLRNLayerManager.kt +46 -17
  20. package/android/src/main/java/org/maplibre/reactnative/components/location/LocationComponentManager.kt +36 -16
  21. package/android/src/main/java/org/maplibre/reactnative/components/location/MLRNNativeUserLocation.kt +7 -2
  22. package/android/src/main/java/org/maplibre/reactnative/components/location/MLRNNativeUserLocationManager.kt +8 -8
  23. package/android/src/main/java/org/maplibre/reactnative/components/mapview/MLRNAndroidTextureMapView.kt +4 -2
  24. package/android/src/main/java/org/maplibre/reactnative/components/mapview/MLRNAndroidTextureMapViewManager.kt +3 -3
  25. package/android/src/main/java/org/maplibre/reactnative/components/mapview/MLRNMapView.kt +2 -3
  26. package/android/src/main/java/org/maplibre/reactnative/components/mapview/MLRNMapViewManager.kt +93 -42
  27. package/android/src/main/java/org/maplibre/reactnative/components/mapview/helpers/CameraChangeTracker.kt +1 -1
  28. package/android/src/main/java/org/maplibre/reactnative/components/mapview/helpers/LayerSourceInfo.kt +4 -2
  29. package/android/src/main/java/org/maplibre/reactnative/components/sources/MLRNPressableSource.kt +26 -15
  30. package/android/src/main/java/org/maplibre/reactnative/components/sources/MLRNSource.kt +23 -14
  31. package/android/src/main/java/org/maplibre/reactnative/components/sources/MLRNSourceManager.kt +27 -13
  32. package/android/src/main/java/org/maplibre/reactnative/components/sources/imagesource/MLRNImageSource.kt +9 -7
  33. package/android/src/main/java/org/maplibre/reactnative/components/sources/imagesource/MLRNImageSourceManager.kt +12 -8
  34. package/android/src/main/java/org/maplibre/reactnative/components/sources/tilesources/MLRNPressableTileSource.kt +4 -2
  35. package/android/src/main/java/org/maplibre/reactnative/components/sources/tilesources/MLRNTileSource.kt +4 -1
  36. package/android/src/main/java/org/maplibre/reactnative/components/sources/tilesources/MLRNTileSourceManager.kt +25 -8
  37. package/android/src/main/java/org/maplibre/reactnative/components/sources/tilesources/TileSourceInterface.kt +0 -1
  38. package/android/src/main/java/org/maplibre/reactnative/components/sources/tilesources/rastersource/MLRNRasterSource.kt +3 -1
  39. package/android/src/main/java/org/maplibre/reactnative/components/sources/tilesources/rastersource/MLRNRasterSourceManager.kt +8 -7
  40. package/android/src/main/java/org/maplibre/reactnative/components/sources/tilesources/vectorsource/MLRNVectorSource.kt +4 -5
  41. package/android/src/main/java/org/maplibre/reactnative/components/sources/tilesources/vectorsource/MLRNVectorSourceManager.kt +4 -7
  42. package/android/src/main/java/org/maplibre/reactnative/components/sources/tilesources/vectorsource/MLRNVectorSourceModule.kt +7 -4
  43. package/android/src/main/java/org/maplibre/reactnative/events/MapChangeEvent.kt +2 -4
  44. package/android/src/main/java/org/maplibre/reactnative/events/MapPressEvent.kt +10 -9
  45. package/android/src/main/java/org/maplibre/reactnative/events/MapPressEventWithFeatures.kt +3 -6
  46. package/android/src/main/java/org/maplibre/reactnative/events/PointAnnotationClickEvent.java +1 -1
  47. package/android/src/main/java/org/maplibre/reactnative/events/PointAnnotationDragEvent.java +1 -1
  48. package/android/src/main/java/org/maplibre/reactnative/events/PointAnnotationEvent.kt +9 -7
  49. package/android/src/main/java/org/maplibre/reactnative/location/LocationManager.kt +18 -16
  50. package/android/src/main/java/org/maplibre/reactnative/location/TrackUserLocationMode.kt +6 -9
  51. package/android/src/main/java/org/maplibre/reactnative/location/UserLocation.kt +30 -28
  52. package/android/src/main/java/org/maplibre/reactnative/location/engine/DefaultLocationEngineProvider.kt +1 -1
  53. package/android/src/main/java/org/maplibre/reactnative/location/engine/LocationEngineProvidable.kt +1 -1
  54. package/android/src/main/java/org/maplibre/reactnative/modules/MLRNLocationModule.kt +37 -32
  55. package/android/src/main/java/org/maplibre/reactnative/modules/MLRNLogModule.kt +107 -67
  56. package/android/src/main/java/org/maplibre/reactnative/modules/MLRNOfflineModule.kt +311 -234
  57. package/android/src/main/java/org/maplibre/reactnative/utils/ExpressionParser.kt +1 -4
  58. package/android/src/main/java/org/maplibre/reactnative/utils/GeoJSONUtils.kt +62 -31
  59. package/android/src/main/java/org/maplibre/reactnative/utils/ReactTagResolver.kt +12 -6
  60. package/android/src/main/location-engine-default/org/maplibre/reactnative/location/engine/LocationEngineProvider.kt +1 -3
  61. package/android/src/main/location-engine-google/org/maplibre/reactnative/location/engine/GoogleLocationEngineImpl.kt +31 -20
  62. package/android/src/main/location-engine-google/org/maplibre/reactnative/location/engine/GoogleLocationEngineProvider.kt +3 -2
  63. package/android/src/main/location-engine-google/org/maplibre/reactnative/location/engine/LocationEngineProvider.kt +1 -3
  64. package/ios/components/annotations/callout/MLRNCalloutComponentView.mm +3 -9
  65. package/ios/components/annotations/point-annotation/MLRNPointAnnotation.m +2 -2
  66. package/ios/components/annotations/point-annotation/MLRNPointAnnotationComponentView.mm +7 -19
  67. package/ios/components/images/MLRNImages.h +4 -4
  68. package/ios/components/images/MLRNImagesComponentView.mm +1 -1
  69. package/ios/components/layers/MLRNLayer.m +1 -1
  70. package/ios/components/layers/MLRNLayerComponentView.mm +2 -4
  71. package/ios/components/layers/style/MLRNStyle.h +346 -170
  72. package/ios/components/layers/style/MLRNStyle.m +668 -711
  73. package/ios/components/map-view/MLRNMapViewComponentView.mm +1 -1
  74. package/ios/components/map-view/MLRNMapViewManager.h +7 -7
  75. package/ios/components/map-view/MLRNMapViewManager.m +4 -4
  76. package/ios/components/map-view/MLRNMapViewModule.mm +2 -2
  77. package/ios/components/sources/MLRNSource.h +2 -2
  78. package/ios/components/sources/geojson-source/MLRNGeoJSONSourceComponentView.h +0 -2
  79. package/ios/components/sources/geojson-source/MLRNGeoJSONSourceComponentView.mm +1 -1
  80. package/ios/components/sources/geojson-source/MLRNGeoJSONSourceModule.h +0 -1
  81. package/ios/components/sources/image-source/MLRNImageSourceComponentView.h +0 -1
  82. package/ios/components/sources/image-source/MLRNImageSourceComponentView.mm +1 -1
  83. package/ios/components/sources/tile-sources/raster-source/MLRNRasterSourceComponentView.h +0 -1
  84. package/ios/components/sources/tile-sources/raster-source/MLRNRasterSourceComponentView.mm +5 -4
  85. package/ios/components/sources/tile-sources/vector-source/MLRNVectorSourceComponentView.h +0 -1
  86. package/ios/components/sources/tile-sources/vector-source/MLRNVectorSourceComponentView.mm +6 -5
  87. package/ios/components/sources/tile-sources/vector-source/MLRNVectorSourceModule.h +0 -1
  88. package/ios/components/sources/tile-sources/vector-source/MLRNVectorSourceModule.mm +0 -1
  89. package/ios/modules/logging/MLRNLogModule.mm +1 -1
  90. package/lib/commonjs/components/annotations/{GeoJSONSourceAnnotation.js → LayerAnnotation.js} +4 -4
  91. package/lib/commonjs/components/annotations/LayerAnnotation.js.map +1 -0
  92. package/lib/commonjs/components/annotations/{marker-view/MarkerView.js → marker/Marker.js} +11 -11
  93. package/lib/commonjs/components/annotations/marker/Marker.js.map +1 -0
  94. package/lib/commonjs/components/annotations/{point-annotation/PointAnnotation.js → view-annotation/ViewAnnotation.js} +6 -6
  95. package/lib/commonjs/components/annotations/view-annotation/ViewAnnotation.js.map +1 -0
  96. package/{src/components/map-view → lib/commonjs/components/map}/AndroidTextureMapViewNativeComponent.ts +1 -1
  97. package/lib/commonjs/components/{map-view/MapView.js → map/Map.js} +7 -7
  98. package/lib/commonjs/components/map/Map.js.map +1 -0
  99. package/lib/commonjs/components/map/NativeMapViewModule.js.map +1 -0
  100. package/lib/commonjs/components/user-location/UserLocation.js +2 -2
  101. package/lib/commonjs/components/user-location/UserLocation.js.map +1 -1
  102. package/lib/commonjs/index.js +20 -20
  103. package/lib/commonjs/index.js.map +1 -1
  104. package/lib/commonjs/utils/animated/Animated.js +2 -2
  105. package/lib/commonjs/utils/animated/Animated.js.map +1 -1
  106. package/lib/module/components/annotations/{GeoJSONSourceAnnotation.js → LayerAnnotation.js} +2 -2
  107. package/lib/module/components/annotations/LayerAnnotation.js.map +1 -0
  108. package/lib/module/components/annotations/{marker-view/MarkerView.js → marker/Marker.js} +9 -9
  109. package/lib/module/components/annotations/marker/Marker.js.map +1 -0
  110. package/lib/module/components/annotations/{point-annotation/PointAnnotation.js → view-annotation/ViewAnnotation.js} +5 -5
  111. package/lib/module/components/annotations/view-annotation/ViewAnnotation.js.map +1 -0
  112. package/lib/{commonjs/components/map-view → module/components/map}/AndroidTextureMapViewNativeComponent.ts +1 -1
  113. package/lib/module/components/{map-view/MapView.js → map/Map.js} +6 -6
  114. package/lib/module/components/map/Map.js.map +1 -0
  115. package/lib/module/components/map/NativeMapViewModule.js.map +1 -0
  116. package/lib/module/components/user-location/UserLocation.js +2 -2
  117. package/lib/module/components/user-location/UserLocation.js.map +1 -1
  118. package/lib/module/index.js +4 -4
  119. package/lib/module/index.js.map +1 -1
  120. package/lib/module/utils/animated/Animated.js +2 -2
  121. package/lib/module/utils/animated/Animated.js.map +1 -1
  122. package/lib/typescript/commonjs/src/components/annotations/{GeoJSONSourceAnnotation.d.ts → LayerAnnotation.d.ts} +3 -4
  123. package/lib/typescript/commonjs/src/components/annotations/LayerAnnotation.d.ts.map +1 -0
  124. package/lib/typescript/{module/src/components/annotations/marker-view/MarkerView.d.ts → commonjs/src/components/annotations/marker/Marker.d.ts} +6 -6
  125. package/lib/typescript/commonjs/src/components/annotations/marker/Marker.d.ts.map +1 -0
  126. package/lib/typescript/commonjs/src/components/annotations/marker/MarkerViewNativeComponent.d.ts.map +1 -0
  127. package/lib/typescript/commonjs/src/components/annotations/view-annotation/PointAnnotationNativeComponent.d.ts.map +1 -0
  128. package/lib/typescript/commonjs/src/components/annotations/{point-annotation/PointAnnotation.d.ts → view-annotation/ViewAnnotation.d.ts} +13 -13
  129. package/lib/typescript/commonjs/src/components/annotations/view-annotation/ViewAnnotation.d.ts.map +1 -0
  130. package/lib/typescript/commonjs/src/components/map/AndroidTextureMapViewNativeComponent.d.ts.map +1 -0
  131. package/lib/typescript/commonjs/src/components/{map-view/MapView.d.ts → map/Map.d.ts} +18 -18
  132. package/lib/typescript/commonjs/src/components/map/Map.d.ts.map +1 -0
  133. package/lib/typescript/commonjs/src/components/map/MapViewNativeComponent.d.ts.map +1 -0
  134. package/lib/typescript/commonjs/src/components/map/NativeMapViewModule.d.ts.map +1 -0
  135. package/lib/typescript/commonjs/src/index.d.ts +4 -4
  136. package/lib/typescript/commonjs/src/index.d.ts.map +1 -1
  137. package/lib/typescript/commonjs/src/types/sources/PressableSourceProps.d.ts +1 -1
  138. package/lib/typescript/commonjs/src/utils/animated/Animated.d.ts +1 -1
  139. package/lib/typescript/module/src/components/annotations/{GeoJSONSourceAnnotation.d.ts → LayerAnnotation.d.ts} +3 -4
  140. package/lib/typescript/module/src/components/annotations/LayerAnnotation.d.ts.map +1 -0
  141. package/lib/typescript/{commonjs/src/components/annotations/marker-view/MarkerView.d.ts → module/src/components/annotations/marker/Marker.d.ts} +6 -6
  142. package/lib/typescript/module/src/components/annotations/marker/Marker.d.ts.map +1 -0
  143. package/lib/typescript/module/src/components/annotations/marker/MarkerViewNativeComponent.d.ts.map +1 -0
  144. package/lib/typescript/module/src/components/annotations/view-annotation/PointAnnotationNativeComponent.d.ts.map +1 -0
  145. package/lib/typescript/module/src/components/annotations/{point-annotation/PointAnnotation.d.ts → view-annotation/ViewAnnotation.d.ts} +13 -13
  146. package/lib/typescript/module/src/components/annotations/view-annotation/ViewAnnotation.d.ts.map +1 -0
  147. package/lib/typescript/module/src/components/map/AndroidTextureMapViewNativeComponent.d.ts.map +1 -0
  148. package/lib/typescript/module/src/components/{map-view/MapView.d.ts → map/Map.d.ts} +18 -18
  149. package/lib/typescript/module/src/components/map/Map.d.ts.map +1 -0
  150. package/lib/typescript/module/src/components/map/MapViewNativeComponent.d.ts.map +1 -0
  151. package/lib/typescript/module/src/components/map/NativeMapViewModule.d.ts.map +1 -0
  152. package/lib/typescript/module/src/index.d.ts +4 -4
  153. package/lib/typescript/module/src/index.d.ts.map +1 -1
  154. package/lib/typescript/module/src/types/sources/PressableSourceProps.d.ts +1 -1
  155. package/lib/typescript/module/src/utils/animated/Animated.d.ts +1 -1
  156. package/package.json +1 -1
  157. package/src/components/annotations/{GeoJSONSourceAnnotation.tsx → LayerAnnotation.tsx} +3 -3
  158. package/src/components/annotations/{marker-view/MarkerView.tsx → marker/Marker.tsx} +12 -12
  159. package/src/components/annotations/{point-annotation/PointAnnotation.tsx → view-annotation/ViewAnnotation.tsx} +16 -16
  160. package/{lib/module/components/map-view → src/components/map}/AndroidTextureMapViewNativeComponent.ts +1 -1
  161. package/src/components/{map-view/MapView.tsx → map/Map.tsx} +21 -21
  162. package/src/components/user-location/UserLocation.tsx +3 -3
  163. package/src/index.ts +18 -13
  164. package/src/types/sources/PressableSourceProps.ts +1 -1
  165. package/src/utils/animated/Animated.tsx +2 -2
  166. package/lib/commonjs/components/annotations/GeoJSONSourceAnnotation.js.map +0 -1
  167. package/lib/commonjs/components/annotations/marker-view/MarkerView.js.map +0 -1
  168. package/lib/commonjs/components/annotations/point-annotation/PointAnnotation.js.map +0 -1
  169. package/lib/commonjs/components/map-view/MapView.js.map +0 -1
  170. package/lib/commonjs/components/map-view/NativeMapViewModule.js.map +0 -1
  171. package/lib/module/components/annotations/GeoJSONSourceAnnotation.js.map +0 -1
  172. package/lib/module/components/annotations/marker-view/MarkerView.js.map +0 -1
  173. package/lib/module/components/annotations/point-annotation/PointAnnotation.js.map +0 -1
  174. package/lib/module/components/map-view/MapView.js.map +0 -1
  175. package/lib/module/components/map-view/NativeMapViewModule.js.map +0 -1
  176. package/lib/typescript/commonjs/src/components/annotations/GeoJSONSourceAnnotation.d.ts.map +0 -1
  177. package/lib/typescript/commonjs/src/components/annotations/marker-view/MarkerView.d.ts.map +0 -1
  178. package/lib/typescript/commonjs/src/components/annotations/marker-view/MarkerViewNativeComponent.d.ts.map +0 -1
  179. package/lib/typescript/commonjs/src/components/annotations/point-annotation/PointAnnotation.d.ts.map +0 -1
  180. package/lib/typescript/commonjs/src/components/annotations/point-annotation/PointAnnotationNativeComponent.d.ts.map +0 -1
  181. package/lib/typescript/commonjs/src/components/map-view/AndroidTextureMapViewNativeComponent.d.ts.map +0 -1
  182. package/lib/typescript/commonjs/src/components/map-view/MapView.d.ts.map +0 -1
  183. package/lib/typescript/commonjs/src/components/map-view/MapViewNativeComponent.d.ts.map +0 -1
  184. package/lib/typescript/commonjs/src/components/map-view/NativeMapViewModule.d.ts.map +0 -1
  185. package/lib/typescript/module/src/components/annotations/GeoJSONSourceAnnotation.d.ts.map +0 -1
  186. package/lib/typescript/module/src/components/annotations/marker-view/MarkerView.d.ts.map +0 -1
  187. package/lib/typescript/module/src/components/annotations/marker-view/MarkerViewNativeComponent.d.ts.map +0 -1
  188. package/lib/typescript/module/src/components/annotations/point-annotation/PointAnnotation.d.ts.map +0 -1
  189. package/lib/typescript/module/src/components/annotations/point-annotation/PointAnnotationNativeComponent.d.ts.map +0 -1
  190. package/lib/typescript/module/src/components/map-view/AndroidTextureMapViewNativeComponent.d.ts.map +0 -1
  191. package/lib/typescript/module/src/components/map-view/MapView.d.ts.map +0 -1
  192. package/lib/typescript/module/src/components/map-view/MapViewNativeComponent.d.ts.map +0 -1
  193. package/lib/typescript/module/src/components/map-view/NativeMapViewModule.d.ts.map +0 -1
  194. /package/lib/commonjs/components/annotations/{marker-view → marker}/MarkerViewNativeComponent.ts +0 -0
  195. /package/lib/commonjs/components/annotations/{point-annotation → view-annotation}/PointAnnotationNativeComponent.ts +0 -0
  196. /package/lib/commonjs/components/{map-view → map}/MapViewNativeComponent.ts +0 -0
  197. /package/lib/commonjs/components/{map-view → map}/NativeMapViewModule.js +0 -0
  198. /package/lib/module/components/annotations/{marker-view → marker}/MarkerViewNativeComponent.ts +0 -0
  199. /package/lib/module/components/annotations/{point-annotation → view-annotation}/PointAnnotationNativeComponent.ts +0 -0
  200. /package/lib/module/components/{map-view → map}/MapViewNativeComponent.ts +0 -0
  201. /package/lib/module/components/{map-view → map}/NativeMapViewModule.js +0 -0
  202. /package/lib/typescript/commonjs/src/components/annotations/{marker-view → marker}/MarkerViewNativeComponent.d.ts +0 -0
  203. /package/lib/typescript/commonjs/src/components/annotations/{point-annotation → view-annotation}/PointAnnotationNativeComponent.d.ts +0 -0
  204. /package/lib/typescript/commonjs/src/components/{map-view → map}/AndroidTextureMapViewNativeComponent.d.ts +0 -0
  205. /package/lib/typescript/commonjs/src/components/{map-view → map}/MapViewNativeComponent.d.ts +0 -0
  206. /package/lib/typescript/commonjs/src/components/{map-view → map}/NativeMapViewModule.d.ts +0 -0
  207. /package/lib/typescript/module/src/components/annotations/{marker-view → marker}/MarkerViewNativeComponent.d.ts +0 -0
  208. /package/lib/typescript/module/src/components/annotations/{point-annotation → view-annotation}/PointAnnotationNativeComponent.d.ts +0 -0
  209. /package/lib/typescript/module/src/components/{map-view → map}/AndroidTextureMapViewNativeComponent.d.ts +0 -0
  210. /package/lib/typescript/module/src/components/{map-view → map}/MapViewNativeComponent.d.ts +0 -0
  211. /package/lib/typescript/module/src/components/{map-view → map}/NativeMapViewModule.d.ts +0 -0
  212. /package/src/components/annotations/{marker-view → marker}/MarkerViewNativeComponent.ts +0 -0
  213. /package/src/components/annotations/{point-annotation → view-annotation}/PointAnnotationNativeComponent.ts +0 -0
  214. /package/src/components/{map-view → map}/MapViewNativeComponent.ts +0 -0
  215. /package/src/components/{map-view → map}/NativeMapViewModule.ts +0 -0
@@ -1,24 +1,20 @@
1
- package org.maplibre.reactnative.components
2
-
3
- import com.facebook.react.bridge.WritableMap
4
- import com.facebook.react.uimanager.events.Event
5
- import com.facebook.react.uimanager.events.RCTEventEmitter
6
-
7
- class AbstractEvent(
8
- viewId: Int,
9
- private val mEventName: String,
10
- private val mCanCoalesce: Boolean,
11
- private val mEvent: WritableMap?
12
- ) : Event<AbstractEvent>(viewId) {
13
- override fun getEventName(): String {
14
- return mEventName
15
- }
16
-
17
- override fun dispatch(rctEventEmitter: RCTEventEmitter) {
18
- rctEventEmitter.receiveEvent(viewTag, eventName, mEvent)
19
- }
20
-
21
- override fun canCoalesce(): Boolean {
22
- return mCanCoalesce
23
- }
24
- }
1
+ package org.maplibre.reactnative.components
2
+
3
+ import com.facebook.react.bridge.WritableMap
4
+ import com.facebook.react.uimanager.events.Event
5
+ import com.facebook.react.uimanager.events.RCTEventEmitter
6
+
7
+ class AbstractEvent(
8
+ viewId: Int,
9
+ private val mEventName: String,
10
+ private val mCanCoalesce: Boolean,
11
+ private val mEvent: WritableMap?,
12
+ ) : Event<AbstractEvent>(viewId) {
13
+ override fun getEventName(): String = mEventName
14
+
15
+ override fun dispatch(rctEventEmitter: RCTEventEmitter) {
16
+ rctEventEmitter.receiveEvent(viewTag, eventName, mEvent)
17
+ }
18
+
19
+ override fun canCoalesce(): Boolean = mCanCoalesce
20
+ }
@@ -10,8 +10,9 @@ import com.facebook.react.uimanager.common.UIManagerType
10
10
  import com.facebook.react.uimanager.events.EventDispatcher
11
11
  import org.maplibre.reactnative.events.IEvent
12
12
 
13
- abstract class AbstractEventEmitter<T : ViewGroup>(private val reactContext: ReactApplicationContext) :
14
- ViewGroupManager<T>() {
13
+ abstract class AbstractEventEmitter<T : ViewGroup>(
14
+ private val reactContext: ReactApplicationContext,
15
+ ) : ViewGroupManager<T>() {
15
16
  private val mRateLimitedEvents: MutableMap<String?, Long?> = HashMap()
16
17
  private var mEventDispatcher: EventDispatcher? = null
17
18
 
@@ -26,12 +27,18 @@ abstract class AbstractEventEmitter<T : ViewGroup>(private val reactContext: Rea
26
27
  mRateLimitedEvents.put(eventCacheKey, System.currentTimeMillis())
27
28
  mEventDispatcher!!.dispatchEvent(
28
29
  AbstractEvent(
29
- event.getID(), event.getKey(), event.canCoalesce(), event.toJSON()
30
- )
30
+ event.getID(),
31
+ event.getKey(),
32
+ event.canCoalesce(),
33
+ event.toJSON(),
34
+ ),
31
35
  )
32
36
  }
33
37
 
34
- override fun addEventEmitters(context: ThemedReactContext, view: T) {
38
+ override fun addEventEmitters(
39
+ context: ThemedReactContext,
40
+ view: T,
41
+ ) {
35
42
  mEventDispatcher =
36
43
  UIManagerHelper.getUIManager(context, UIManagerType.Companion.FABRIC)!!.eventDispatcher
37
44
  }
@@ -47,7 +54,8 @@ abstract class AbstractEventEmitter<T : ViewGroup>(private val reactContext: Rea
47
54
 
48
55
  for (event in events.entries) {
49
56
  exportedEvents.put(
50
- event.key, MapBuilder.of<String?, String?>("registrationName", event.value!!)
57
+ event.key,
58
+ MapBuilder.of<String?, String?>("registrationName", event.value!!),
51
59
  )
52
60
  }
53
61
 
@@ -56,14 +64,15 @@ abstract class AbstractEventEmitter<T : ViewGroup>(private val reactContext: Rea
56
64
 
57
65
  abstract fun customEvents(): Map<String, String>?
58
66
 
59
- private fun shouldDropEvent(cacheKey: String?, event: IEvent): Boolean {
67
+ private fun shouldDropEvent(
68
+ cacheKey: String?,
69
+ event: IEvent,
70
+ ): Boolean {
60
71
  val lastEventTimestamp = mRateLimitedEvents.get(cacheKey)
61
72
  return lastEventTimestamp != null && (event.getTimestamp() - lastEventTimestamp) <= BRIDGE_TIMEOUT_MS
62
73
  }
63
74
 
64
- private fun getEventCacheKey(event: IEvent): String {
65
- return String.format("%s-%s", event.getKey(), event.getType())
66
- }
75
+ private fun getEventCacheKey(event: IEvent): String = String.format("%s-%s", event.getKey(), event.getType())
67
76
 
68
77
  companion object {
69
78
  private const val BRIDGE_TIMEOUT_MS = 10.0
@@ -3,5 +3,6 @@ package org.maplibre.reactnative.components.annotations.callout
3
3
  import android.content.Context
4
4
  import com.facebook.react.views.view.ReactViewGroup
5
5
 
6
- class MLRNCallout(context: Context) : ReactViewGroup(context) {
7
- }
6
+ class MLRNCallout(
7
+ context: Context,
8
+ ) : ReactViewGroup(context)
@@ -11,7 +11,6 @@ import com.facebook.react.viewmanagers.MLRNCalloutManagerInterface
11
11
  class MLRNCalloutManager :
12
12
  ViewGroupManager<MLRNCallout>(),
13
13
  MLRNCalloutManagerInterface<MLRNCallout> {
14
-
15
14
  private val delegate: MLRNCalloutManagerDelegate<MLRNCallout, MLRNCalloutManager> =
16
15
  MLRNCalloutManagerDelegate(this)
17
16
 
@@ -23,7 +22,5 @@ class MLRNCalloutManager :
23
22
 
24
23
  override fun getName(): String = REACT_CLASS
25
24
 
26
- override fun createViewInstance(reactContext: ThemedReactContext): MLRNCallout {
27
- return MLRNCallout(reactContext)
28
- }
25
+ override fun createViewInstance(reactContext: ThemedReactContext): MLRNCallout = MLRNCallout(reactContext)
29
26
  }
@@ -12,7 +12,10 @@ import org.maplibre.reactnative.components.mapview.MLRNMapView
12
12
  import org.maplibre.reactnative.utils.GeoJSONUtils
13
13
 
14
14
  @SuppressLint("ViewConstructor")
15
- class MLRNMarkerView(context: Context) : AbstractMapFeature(context), View.OnLayoutChangeListener {
15
+ class MLRNMarkerView(
16
+ context: Context,
17
+ ) : AbstractMapFeature(context),
18
+ View.OnLayoutChangeListener {
16
19
  private var mMapView: MLRNMapView? = null
17
20
  private var mChildView: View? = null
18
21
  private var mWrapperView: MLRNMarkerViewContent? = null
@@ -35,19 +38,31 @@ class MLRNMarkerView(context: Context) : AbstractMapFeature(context), View.OnLay
35
38
  private fun disableClippingRecursively(view: View) {
36
39
  if (view is ViewGroup) {
37
40
  view.disableClipping()
38
- view.setOnHierarchyChangeListener(object : ViewGroup.OnHierarchyChangeListener {
39
- override fun onChildViewAdded(parent: View?, child: View?) {
40
- child?.let { disableClippingRecursively(it) }
41
- }
42
- override fun onChildViewRemoved(parent: View?, child: View?) {}
43
- })
41
+ view.setOnHierarchyChangeListener(
42
+ object : ViewGroup.OnHierarchyChangeListener {
43
+ override fun onChildViewAdded(
44
+ parent: View?,
45
+ child: View?,
46
+ ) {
47
+ child?.let { disableClippingRecursively(it) }
48
+ }
49
+
50
+ override fun onChildViewRemoved(
51
+ parent: View?,
52
+ child: View?,
53
+ ) {}
54
+ },
55
+ )
44
56
  for (i in 0 until view.childCount) {
45
57
  disableClippingRecursively(view.getChildAt(i))
46
58
  }
47
59
  }
48
60
  }
49
61
 
50
- override fun addView(childView: View, childPosition: Int) {
62
+ override fun addView(
63
+ childView: View,
64
+ childPosition: Int,
65
+ ) {
51
66
  if (childPosition != 0) return
52
67
 
53
68
  mChildView = childView
@@ -77,13 +92,9 @@ class MLRNMarkerView(context: Context) : AbstractMapFeature(context), View.OnLay
77
92
  mChildView = null
78
93
  }
79
94
 
80
- override fun getChildCount(): Int {
81
- return if (mChildView != null) 1 else 0
82
- }
95
+ override fun getChildCount(): Int = if (mChildView != null) 1 else 0
83
96
 
84
- override fun getChildAt(index: Int): View? {
85
- return if (index == 0) mChildView else null
86
- }
97
+ override fun getChildAt(index: Int): View? = if (index == 0) mChildView else null
87
98
 
88
99
  fun setLngLat(lngLat: DoubleArray?) {
89
100
  if (lngLat == null || lngLat.size < 2) return
@@ -95,14 +106,20 @@ class MLRNMarkerView(context: Context) : AbstractMapFeature(context), View.OnLay
95
106
  }
96
107
  }
97
108
 
98
- fun setAnchor(x: Float, y: Float) {
109
+ fun setAnchor(
110
+ x: Float,
111
+ y: Float,
112
+ ) {
99
113
  mAnchor = floatArrayOf(x, y)
100
114
  if (mMarkerInfo != null && mMarkerViewManager != null) {
101
115
  mMarkerViewManager!!.updateMarkerAnchor(mMarkerInfo!!, x, y)
102
116
  }
103
117
  }
104
118
 
105
- fun setOffset(x: Float, y: Float) {
119
+ fun setOffset(
120
+ x: Float,
121
+ y: Float,
122
+ ) {
106
123
  mOffset = floatArrayOf(x, y)
107
124
  val scale = resources.displayMetrics.density
108
125
  val pixelOffsetX = x * scale
@@ -140,13 +157,15 @@ class MLRNMarkerView(context: Context) : AbstractMapFeature(context), View.OnLay
140
157
  mMapView?.offscreenAnnotationViewContainer()?.removeView(mChildView)
141
158
  disableClippingRecursively(mChildView!!)
142
159
 
143
- mWrapperView = MLRNMarkerViewContent(context).apply {
144
- layoutParams = FrameLayout.LayoutParams(
145
- FrameLayout.LayoutParams.WRAP_CONTENT,
146
- FrameLayout.LayoutParams.WRAP_CONTENT
147
- )
148
- addView(mChildView)
149
- }
160
+ mWrapperView =
161
+ MLRNMarkerViewContent(context).apply {
162
+ layoutParams =
163
+ FrameLayout.LayoutParams(
164
+ FrameLayout.LayoutParams.WRAP_CONTENT,
165
+ FrameLayout.LayoutParams.WRAP_CONTENT,
166
+ )
167
+ addView(mChildView)
168
+ }
150
169
  mWrapperView!!.setLayerType(View.LAYER_TYPE_HARDWARE, null)
151
170
 
152
171
  mLastZIndex = ViewGroupManager.getViewZIndex(this@MLRNMarkerView)
@@ -158,14 +177,15 @@ class MLRNMarkerView(context: Context) : AbstractMapFeature(context), View.OnLay
158
177
  val pixelOffsetX = (mOffset?.get(0) ?: 0f) * scale
159
178
  val pixelOffsetY = (mOffset?.get(1) ?: 0f) * scale
160
179
 
161
- mMarkerInfo = mMarkerViewManager!!.addMarker(
162
- view = mWrapperView!!,
163
- latLng = latLng,
164
- anchorX = mAnchor?.get(0) ?: 0f,
165
- anchorY = mAnchor?.get(1) ?: 0f,
166
- offsetX = pixelOffsetX,
167
- offsetY = pixelOffsetY
168
- )
180
+ mMarkerInfo =
181
+ mMarkerViewManager!!.addMarker(
182
+ view = mWrapperView!!,
183
+ latLng = latLng,
184
+ anchorX = mAnchor?.get(0) ?: 0f,
185
+ anchorY = mAnchor?.get(1) ?: 0f,
186
+ offsetX = pixelOffsetX,
187
+ offsetY = pixelOffsetY,
188
+ )
169
189
  }
170
190
  }
171
191
  }
@@ -186,8 +206,15 @@ class MLRNMarkerView(context: Context) : AbstractMapFeature(context), View.OnLay
186
206
  }
187
207
 
188
208
  override fun onLayoutChange(
189
- v: View, left: Int, top: Int, right: Int, bottom: Int,
190
- oldLeft: Int, oldTop: Int, oldRight: Int, oldBottom: Int
209
+ v: View,
210
+ left: Int,
211
+ top: Int,
212
+ right: Int,
213
+ bottom: Int,
214
+ oldLeft: Int,
215
+ oldTop: Int,
216
+ oldRight: Int,
217
+ oldBottom: Int,
191
218
  ) {
192
219
  if (left == 0 && top == 0 && right == 0 && bottom == 0) return
193
220
 
@@ -7,13 +7,14 @@ import com.facebook.react.views.view.ReactViewGroup
7
7
 
8
8
  /**
9
9
  * Custom ReactViewGroup that allows content to render outside its bounds (#642).
10
- * This is used as a wrapper for MarkerView content to prevent clipping.
10
+ * This is used as a wrapper for Marker content to prevent clipping.
11
11
  *
12
12
  * Based on rnmapbox/maps implementation:
13
13
  * https://github.com/rnmapbox/maps/blob/main/android/src/main/java/com/rnmapbox/rnmbx/components/annotation/RNMBXMarkerViewContent.kt
14
14
  */
15
- class MLRNMarkerViewContent(context: Context) : ReactViewGroup(context) {
16
-
15
+ class MLRNMarkerViewContent(
16
+ context: Context,
17
+ ) : ReactViewGroup(context) {
17
18
  init {
18
19
  allowRenderingOutside()
19
20
  }
@@ -15,10 +15,10 @@ import com.facebook.react.viewmanagers.MLRNMarkerViewManagerDelegate
15
15
  import com.facebook.react.viewmanagers.MLRNMarkerViewManagerInterface
16
16
 
17
17
  @ReactModule(name = MLRNMarkerViewManager.REACT_CLASS)
18
- class MLRNMarkerViewManager(private val reactApplicationContext: ReactApplicationContext) :
19
- ViewGroupManager<MLRNMarkerView>(),
18
+ class MLRNMarkerViewManager(
19
+ private val reactApplicationContext: ReactApplicationContext,
20
+ ) : ViewGroupManager<MLRNMarkerView>(),
20
21
  MLRNMarkerViewManagerInterface<MLRNMarkerView> {
21
-
22
22
  private val delegate: MLRNMarkerViewManagerDelegate<MLRNMarkerView, MLRNMarkerViewManager> =
23
23
  MLRNMarkerViewManagerDelegate(this)
24
24
 
@@ -30,28 +30,35 @@ class MLRNMarkerViewManager(private val reactApplicationContext: ReactApplicatio
30
30
 
31
31
  override fun getName(): String = REACT_CLASS
32
32
 
33
- override fun createViewInstance(reactContext: ThemedReactContext): MLRNMarkerView {
34
- return MLRNMarkerView(reactContext)
35
- }
33
+ override fun createViewInstance(reactContext: ThemedReactContext): MLRNMarkerView = MLRNMarkerView(reactContext)
36
34
 
37
- override fun addView(parent: MLRNMarkerView, child: View, index: Int) {
35
+ override fun addView(
36
+ parent: MLRNMarkerView,
37
+ child: View,
38
+ index: Int,
39
+ ) {
38
40
  parent.addView(child, index)
39
41
  }
40
42
 
41
- override fun removeViewAt(parent: MLRNMarkerView, index: Int) {
43
+ override fun removeViewAt(
44
+ parent: MLRNMarkerView,
45
+ index: Int,
46
+ ) {
42
47
  parent.removeViewAt(index)
43
48
  }
44
49
 
45
- override fun getChildCount(parent: MLRNMarkerView): Int {
46
- return parent.childCount
47
- }
50
+ override fun getChildCount(parent: MLRNMarkerView): Int = parent.childCount
48
51
 
49
- override fun getChildAt(parent: MLRNMarkerView, index: Int): View? {
50
- return parent.getChildAt(index)
51
- }
52
+ override fun getChildAt(
53
+ parent: MLRNMarkerView,
54
+ index: Int,
55
+ ): View? = parent.getChildAt(index)
52
56
 
53
57
  @ReactProp(name = "lngLat")
54
- override fun setLngLat(markerView: MLRNMarkerView, lngLat: Dynamic) {
58
+ override fun setLngLat(
59
+ markerView: MLRNMarkerView,
60
+ lngLat: Dynamic,
61
+ ) {
55
62
  if (lngLat.type == ReadableType.Array) {
56
63
  val arr = lngLat.asArray()
57
64
  if (arr != null && arr.size() >= 2) {
@@ -61,20 +68,29 @@ class MLRNMarkerViewManager(private val reactApplicationContext: ReactApplicatio
61
68
  }
62
69
 
63
70
  @ReactProp(name = "anchor")
64
- override fun setAnchor(markerView: MLRNMarkerView, map: ReadableMap?) {
71
+ override fun setAnchor(
72
+ markerView: MLRNMarkerView,
73
+ map: ReadableMap?,
74
+ ) {
65
75
  if (map != null) {
66
76
  markerView.setAnchor(map.getDouble("x").toFloat(), map.getDouble("y").toFloat())
67
77
  }
68
78
  }
69
79
 
70
80
  @ReactProp(name = "offset")
71
- override fun setOffset(markerView: MLRNMarkerView, map: ReadableMap?) {
81
+ override fun setOffset(
82
+ markerView: MLRNMarkerView,
83
+ map: ReadableMap?,
84
+ ) {
72
85
  if (map != null) {
73
86
  markerView.setOffset(map.getDouble("x").toFloat(), map.getDouble("y").toFloat())
74
87
  }
75
88
  }
76
89
 
77
- override fun setZIndex(view: MLRNMarkerView, zIndex: Float) {
90
+ override fun setZIndex(
91
+ view: MLRNMarkerView,
92
+ zIndex: Float,
93
+ ) {
78
94
  super.setZIndex(view, zIndex)
79
95
  view.updateZIndex(zIndex)
80
96
  }
@@ -10,7 +10,7 @@ import org.maplibre.android.maps.MapView
10
10
 
11
11
  class MarkerViewManager(
12
12
  private val mapView: MapView,
13
- private val map: MapLibreMap
13
+ private val map: MapLibreMap,
14
14
  ) {
15
15
  data class MarkerInfo(
16
16
  val view: View,
@@ -18,7 +18,7 @@ class MarkerViewManager(
18
18
  var anchorX: Float = 0f,
19
19
  var anchorY: Float = 0f,
20
20
  var offsetX: Float = 0f,
21
- var offsetY: Float = 0f
21
+ var offsetY: Float = 0f,
22
22
  )
23
23
 
24
24
  private val markers = mutableListOf<MarkerInfo>()
@@ -30,7 +30,7 @@ class MarkerViewManager(
30
30
  anchorX: Float = 0f,
31
31
  anchorY: Float = 0f,
32
32
  offsetX: Float = 0f,
33
- offsetY: Float = 0f
33
+ offsetY: Float = 0f,
34
34
  ): MarkerInfo {
35
35
  val markerInfo = MarkerInfo(view, latLng, anchorX, anchorY, offsetX, offsetY)
36
36
  markers.add(markerInfo)
@@ -81,22 +81,31 @@ class MarkerViewManager(
81
81
  view.y = screenPos.y - anchorOffsetY + marker.offsetY
82
82
  }
83
83
 
84
- fun findMarkerByView(view: View): MarkerInfo? {
85
- return markers.find { it.view == view }
86
- }
84
+ fun findMarkerByView(view: View): MarkerInfo? = markers.find { it.view == view }
87
85
 
88
- fun updateMarkerCoordinate(markerInfo: MarkerInfo, latLng: LatLng) {
86
+ fun updateMarkerCoordinate(
87
+ markerInfo: MarkerInfo,
88
+ latLng: LatLng,
89
+ ) {
89
90
  markerInfo.latLng = latLng
90
91
  updateMarkerPosition(markerInfo)
91
92
  }
92
93
 
93
- fun updateMarkerAnchor(markerInfo: MarkerInfo, anchorX: Float, anchorY: Float) {
94
+ fun updateMarkerAnchor(
95
+ markerInfo: MarkerInfo,
96
+ anchorX: Float,
97
+ anchorY: Float,
98
+ ) {
94
99
  markerInfo.anchorX = anchorX
95
100
  markerInfo.anchorY = anchorY
96
101
  updateMarkerPosition(markerInfo)
97
102
  }
98
103
 
99
- fun updateMarkerOffset(markerInfo: MarkerInfo, offsetX: Float, offsetY: Float) {
104
+ fun updateMarkerOffset(
105
+ markerInfo: MarkerInfo,
106
+ offsetX: Float,
107
+ offsetY: Float,
108
+ ) {
100
109
  markerInfo.offsetX = offsetX
101
110
  markerInfo.offsetY = offsetY
102
111
  updateMarkerPosition(markerInfo)