@maplibre/maplibre-react-native 10.0.0-beta.1 → 10.0.0-beta.11

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 (259) hide show
  1. package/README.md +36 -35
  2. package/android/build.gradle +98 -51
  3. package/android/gradle.properties +7 -0
  4. package/android/src/main/AndroidManifest.xml +4 -2
  5. package/android/src/main/AndroidManifestNew.xml +5 -0
  6. package/android/src/main/java/org/maplibre/reactnative/MLRNPackage.java +0 -5
  7. package/android/src/main/java/org/maplibre/reactnative/components/mapview/MLRNMapView.java +11 -13
  8. package/android/src/main/java/org/maplibre/reactnative/components/mapview/MLRNMapViewManager.java +4 -11
  9. package/android/src/main/java/org/maplibre/reactnative/components/styles/MLRNStyle.java +1 -4
  10. package/android/src/main/java/org/maplibre/reactnative/components/styles/MLRNStyleFactory.java +10 -11
  11. package/android/src/main/java/org/maplibre/reactnative/components/styles/sources/MLRNShapeSource.java +0 -66
  12. package/android/src/main/java/org/maplibre/reactnative/components/styles/sources/MLRNShapeSourceManager.java +0 -28
  13. package/android/src/main/java/org/maplibre/reactnative/modules/MLRNModule.java +3 -146
  14. package/android/src/main/java/org/maplibre/reactnative/modules/MLRNOfflineModule.java +1 -3
  15. package/android/src/main/java/org/maplibre/reactnative/utils/GeoJSONUtils.java +80 -0
  16. package/ios/MLRN/MLRNBackgroundLayer.h +0 -1
  17. package/ios/MLRN/MLRNFillExtrusionLayer.h +0 -1
  18. package/ios/MLRN/MLRNFillLayer.h +0 -1
  19. package/ios/MLRN/MLRNFillLayer.m +1 -0
  20. package/ios/MLRN/MLRNLineLayer.h +0 -1
  21. package/ios/MLRN/MLRNMapView.h +1 -1
  22. package/ios/MLRN/MLRNMapView.m +7 -7
  23. package/ios/MLRN/MLRNMapViewManager.m +1 -1
  24. package/ios/MLRN/MLRNModule.m +0 -139
  25. package/ios/MLRN/MLRNRasterLayer.h +0 -1
  26. package/ios/MLRN/MLRNShapeSource.h +0 -11
  27. package/ios/MLRN/MLRNShapeSource.m +0 -38
  28. package/ios/MLRN/MLRNShapeSourceManager.m +0 -68
  29. package/ios/MLRN/MLRNSymbolLayer.h +1 -7
  30. package/ios/MLRN/MLRNSymbolLayer.m +1 -89
  31. package/ios/MLRN/MLRNSymbolLayerManager.m +0 -1
  32. package/lib/commonjs/MLRNModule.js +7 -5
  33. package/lib/commonjs/MLRNModule.js.map +1 -1
  34. package/lib/commonjs/MapLibreRN.js +3 -15
  35. package/lib/commonjs/MapLibreRN.js.map +1 -1
  36. package/lib/commonjs/components/Annotation.js.map +1 -1
  37. package/lib/commonjs/components/Images.js +1 -5
  38. package/lib/commonjs/components/Images.js.map +1 -1
  39. package/lib/commonjs/components/MapView.js +15 -28
  40. package/lib/commonjs/components/MapView.js.map +1 -1
  41. package/lib/commonjs/components/ShapeSource.js +6 -38
  42. package/lib/commonjs/components/ShapeSource.js.map +1 -1
  43. package/lib/commonjs/components/SymbolLayer.js +2 -17
  44. package/lib/commonjs/components/SymbolLayer.js.map +1 -1
  45. package/lib/commonjs/components/UserLocation.js.map +1 -1
  46. package/lib/commonjs/components/VectorSource.js +1 -11
  47. package/lib/commonjs/components/VectorSource.js.map +1 -1
  48. package/lib/commonjs/modules/offline/offlineManager.js +1 -1
  49. package/lib/commonjs/modules/offline/offlineManager.js.map +1 -1
  50. package/lib/commonjs/types/MapLibreRNStyles.js +6 -0
  51. package/lib/commonjs/types/MapLibreRNStyles.js.map +1 -0
  52. package/lib/commonjs/utils/StyleValue.js +2 -2
  53. package/lib/commonjs/utils/StyleValue.js.map +1 -1
  54. package/lib/commonjs/utils/getStylePropertyType.js +252 -0
  55. package/lib/commonjs/utils/getStylePropertyType.js.map +1 -0
  56. package/lib/module/MLRNModule.js +3 -2
  57. package/lib/module/MLRNModule.js.map +1 -1
  58. package/lib/module/MapLibreRN.js +1 -5
  59. package/lib/module/MapLibreRN.js.map +1 -1
  60. package/lib/module/components/Annotation.js.map +1 -1
  61. package/lib/module/components/Images.js +1 -5
  62. package/lib/module/components/Images.js.map +1 -1
  63. package/lib/module/components/MapView.js +15 -28
  64. package/lib/module/components/MapView.js.map +1 -1
  65. package/lib/module/components/ShapeSource.js +5 -37
  66. package/lib/module/components/ShapeSource.js.map +1 -1
  67. package/lib/module/components/SymbolLayer.js +3 -18
  68. package/lib/module/components/SymbolLayer.js.map +1 -1
  69. package/lib/module/components/UserLocation.js.map +1 -1
  70. package/lib/module/components/VectorSource.js +1 -11
  71. package/lib/module/components/VectorSource.js.map +1 -1
  72. package/lib/module/modules/offline/offlineManager.js +1 -1
  73. package/lib/module/modules/offline/offlineManager.js.map +1 -1
  74. package/lib/module/types/MapLibreRNStyles.js +4 -0
  75. package/lib/module/types/MapLibreRNStyles.js.map +1 -0
  76. package/lib/module/utils/StyleValue.js +2 -2
  77. package/lib/module/utils/StyleValue.js.map +1 -1
  78. package/lib/module/utils/getStylePropertyType.js +248 -0
  79. package/lib/module/utils/getStylePropertyType.js.map +1 -0
  80. package/lib/typescript/commonjs/jest.config.d.ts +2 -0
  81. package/lib/typescript/commonjs/jest.config.d.ts.map +1 -0
  82. package/lib/typescript/commonjs/src/MLRNModule.d.ts +3 -7
  83. package/lib/typescript/commonjs/src/MLRNModule.d.ts.map +1 -1
  84. package/lib/typescript/commonjs/src/MapLibreRN.d.ts +5 -8
  85. package/lib/typescript/commonjs/src/MapLibreRN.d.ts.map +1 -1
  86. package/lib/typescript/commonjs/src/components/Annotation.d.ts +2 -2
  87. package/lib/typescript/commonjs/src/components/Annotation.d.ts.map +1 -1
  88. package/lib/typescript/commonjs/src/components/BackgroundLayer.d.ts +2 -2
  89. package/lib/typescript/commonjs/src/components/BackgroundLayer.d.ts.map +1 -1
  90. package/lib/typescript/commonjs/src/components/Camera.d.ts +1 -1
  91. package/lib/typescript/commonjs/src/components/CircleLayer.d.ts +2 -2
  92. package/lib/typescript/commonjs/src/components/CircleLayer.d.ts.map +1 -1
  93. package/lib/typescript/commonjs/src/components/FillExtrusionLayer.d.ts +2 -2
  94. package/lib/typescript/commonjs/src/components/FillExtrusionLayer.d.ts.map +1 -1
  95. package/lib/typescript/commonjs/src/components/FillLayer.d.ts +2 -2
  96. package/lib/typescript/commonjs/src/components/FillLayer.d.ts.map +1 -1
  97. package/lib/typescript/commonjs/src/components/HeatmapLayer.d.ts +2 -2
  98. package/lib/typescript/commonjs/src/components/HeatmapLayer.d.ts.map +1 -1
  99. package/lib/typescript/commonjs/src/components/Images.d.ts.map +1 -1
  100. package/lib/typescript/commonjs/src/components/Light.d.ts +2 -2
  101. package/lib/typescript/commonjs/src/components/Light.d.ts.map +1 -1
  102. package/lib/typescript/commonjs/src/components/LineLayer.d.ts +2 -2
  103. package/lib/typescript/commonjs/src/components/LineLayer.d.ts.map +1 -1
  104. package/lib/typescript/commonjs/src/components/MapView.d.ts +7 -11
  105. package/lib/typescript/commonjs/src/components/MapView.d.ts.map +1 -1
  106. package/lib/typescript/commonjs/src/components/RasterLayer.d.ts +2 -2
  107. package/lib/typescript/commonjs/src/components/RasterLayer.d.ts.map +1 -1
  108. package/lib/typescript/commonjs/src/components/ShapeSource.d.ts +1 -2
  109. package/lib/typescript/commonjs/src/components/ShapeSource.d.ts.map +1 -1
  110. package/lib/typescript/commonjs/src/components/SymbolLayer.d.ts +2 -8
  111. package/lib/typescript/commonjs/src/components/SymbolLayer.d.ts.map +1 -1
  112. package/lib/typescript/commonjs/src/components/VectorSource.d.ts.map +1 -1
  113. package/lib/typescript/commonjs/src/hooks/useAbstractLayer.d.ts +2 -2
  114. package/lib/typescript/commonjs/src/hooks/useAbstractLayer.d.ts.map +1 -1
  115. package/lib/typescript/commonjs/src/modules/offline/OfflinePack.d.ts +1 -1
  116. package/lib/typescript/commonjs/src/modules/offline/OfflinePack.d.ts.map +1 -1
  117. package/lib/typescript/commonjs/src/modules/offline/offlineManager.d.ts +4 -14
  118. package/lib/typescript/commonjs/src/modules/offline/offlineManager.d.ts.map +1 -1
  119. package/lib/typescript/commonjs/src/types/MapLibreRNStyles.d.ts +960 -0
  120. package/lib/typescript/commonjs/src/types/MapLibreRNStyles.d.ts.map +1 -0
  121. package/lib/typescript/commonjs/src/utils/StyleValue.d.ts +2 -2
  122. package/lib/typescript/commonjs/src/utils/StyleValue.d.ts.map +1 -1
  123. package/lib/typescript/commonjs/src/utils/animated/AbstractAnimatedCoordinates.d.ts +1 -0
  124. package/lib/typescript/commonjs/src/utils/animated/AbstractAnimatedCoordinates.d.ts.map +1 -1
  125. package/lib/typescript/commonjs/src/utils/animated/AnimatedExtractCoordinateFromArray.d.ts +1 -0
  126. package/lib/typescript/commonjs/src/utils/animated/AnimatedExtractCoordinateFromArray.d.ts.map +1 -1
  127. package/lib/typescript/commonjs/src/utils/animated/AnimatedPoint.d.ts +1 -0
  128. package/lib/typescript/commonjs/src/utils/animated/AnimatedPoint.d.ts.map +1 -1
  129. package/lib/typescript/commonjs/src/utils/animated/AnimatedShape.d.ts +1 -0
  130. package/lib/typescript/commonjs/src/utils/animated/AnimatedShape.d.ts.map +1 -1
  131. package/lib/typescript/commonjs/src/utils/filterUtils.d.ts +1 -1
  132. package/lib/typescript/commonjs/src/utils/filterUtils.d.ts.map +1 -1
  133. package/lib/typescript/commonjs/src/utils/getStylePropertyType.d.ts +35 -0
  134. package/lib/typescript/commonjs/src/utils/getStylePropertyType.d.ts.map +1 -0
  135. package/lib/typescript/module/jest.config.d.ts +2 -0
  136. package/lib/typescript/module/jest.config.d.ts.map +1 -0
  137. package/lib/typescript/module/src/MLRNModule.d.ts +3 -7
  138. package/lib/typescript/module/src/MLRNModule.d.ts.map +1 -1
  139. package/lib/typescript/module/src/MapLibreRN.d.ts +5 -8
  140. package/lib/typescript/module/src/MapLibreRN.d.ts.map +1 -1
  141. package/lib/typescript/module/src/components/Annotation.d.ts +2 -2
  142. package/lib/typescript/module/src/components/Annotation.d.ts.map +1 -1
  143. package/lib/typescript/module/src/components/BackgroundLayer.d.ts +2 -2
  144. package/lib/typescript/module/src/components/BackgroundLayer.d.ts.map +1 -1
  145. package/lib/typescript/module/src/components/Camera.d.ts +1 -1
  146. package/lib/typescript/module/src/components/CircleLayer.d.ts +2 -2
  147. package/lib/typescript/module/src/components/CircleLayer.d.ts.map +1 -1
  148. package/lib/typescript/module/src/components/FillExtrusionLayer.d.ts +2 -2
  149. package/lib/typescript/module/src/components/FillExtrusionLayer.d.ts.map +1 -1
  150. package/lib/typescript/module/src/components/FillLayer.d.ts +2 -2
  151. package/lib/typescript/module/src/components/FillLayer.d.ts.map +1 -1
  152. package/lib/typescript/module/src/components/HeatmapLayer.d.ts +2 -2
  153. package/lib/typescript/module/src/components/HeatmapLayer.d.ts.map +1 -1
  154. package/lib/typescript/module/src/components/Images.d.ts.map +1 -1
  155. package/lib/typescript/module/src/components/Light.d.ts +2 -2
  156. package/lib/typescript/module/src/components/Light.d.ts.map +1 -1
  157. package/lib/typescript/module/src/components/LineLayer.d.ts +2 -2
  158. package/lib/typescript/module/src/components/LineLayer.d.ts.map +1 -1
  159. package/lib/typescript/module/src/components/MapView.d.ts +7 -11
  160. package/lib/typescript/module/src/components/MapView.d.ts.map +1 -1
  161. package/lib/typescript/module/src/components/RasterLayer.d.ts +2 -2
  162. package/lib/typescript/module/src/components/RasterLayer.d.ts.map +1 -1
  163. package/lib/typescript/module/src/components/ShapeSource.d.ts +1 -2
  164. package/lib/typescript/module/src/components/ShapeSource.d.ts.map +1 -1
  165. package/lib/typescript/module/src/components/SymbolLayer.d.ts +2 -8
  166. package/lib/typescript/module/src/components/SymbolLayer.d.ts.map +1 -1
  167. package/lib/typescript/module/src/components/VectorSource.d.ts.map +1 -1
  168. package/lib/typescript/module/src/hooks/useAbstractLayer.d.ts +2 -2
  169. package/lib/typescript/module/src/hooks/useAbstractLayer.d.ts.map +1 -1
  170. package/lib/typescript/module/src/modules/offline/OfflinePack.d.ts +1 -1
  171. package/lib/typescript/module/src/modules/offline/OfflinePack.d.ts.map +1 -1
  172. package/lib/typescript/module/src/modules/offline/offlineManager.d.ts +4 -14
  173. package/lib/typescript/module/src/modules/offline/offlineManager.d.ts.map +1 -1
  174. package/lib/typescript/module/src/types/MapLibreRNStyles.d.ts +960 -0
  175. package/lib/typescript/module/src/types/MapLibreRNStyles.d.ts.map +1 -0
  176. package/lib/typescript/module/src/utils/StyleValue.d.ts +2 -2
  177. package/lib/typescript/module/src/utils/StyleValue.d.ts.map +1 -1
  178. package/lib/typescript/module/src/utils/animated/AbstractAnimatedCoordinates.d.ts +1 -0
  179. package/lib/typescript/module/src/utils/animated/AbstractAnimatedCoordinates.d.ts.map +1 -1
  180. package/lib/typescript/module/src/utils/animated/AnimatedExtractCoordinateFromArray.d.ts +1 -0
  181. package/lib/typescript/module/src/utils/animated/AnimatedExtractCoordinateFromArray.d.ts.map +1 -1
  182. package/lib/typescript/module/src/utils/animated/AnimatedPoint.d.ts +1 -0
  183. package/lib/typescript/module/src/utils/animated/AnimatedPoint.d.ts.map +1 -1
  184. package/lib/typescript/module/src/utils/animated/AnimatedShape.d.ts +1 -0
  185. package/lib/typescript/module/src/utils/animated/AnimatedShape.d.ts.map +1 -1
  186. package/lib/typescript/module/src/utils/filterUtils.d.ts +1 -1
  187. package/lib/typescript/module/src/utils/filterUtils.d.ts.map +1 -1
  188. package/lib/typescript/module/src/utils/getStylePropertyType.d.ts +35 -0
  189. package/lib/typescript/module/src/utils/getStylePropertyType.d.ts.map +1 -0
  190. package/package.json +31 -38
  191. package/plugin/build/withMapLibre.js +6 -6
  192. package/src/MLRNModule.ts +16 -10
  193. package/src/MapLibreRN.ts +22 -23
  194. package/src/components/Annotation.tsx +3 -3
  195. package/src/components/BackgroundLayer.tsx +2 -2
  196. package/src/components/Camera.tsx +1 -1
  197. package/src/components/CircleLayer.tsx +2 -2
  198. package/src/components/FillExtrusionLayer.tsx +2 -2
  199. package/src/components/FillLayer.tsx +2 -2
  200. package/src/components/HeatmapLayer.tsx +2 -2
  201. package/src/components/Images.tsx +1 -10
  202. package/src/components/Light.tsx +2 -2
  203. package/src/components/LineLayer.tsx +2 -2
  204. package/src/components/MapView.tsx +20 -44
  205. package/src/components/RasterLayer.tsx +2 -2
  206. package/src/components/ShapeSource.tsx +9 -77
  207. package/src/components/SymbolLayer.tsx +7 -35
  208. package/src/components/UserLocation.tsx +2 -2
  209. package/src/components/VectorSource.tsx +5 -21
  210. package/src/hooks/useAbstractLayer.ts +3 -3
  211. package/src/modules/offline/OfflinePack.ts +1 -1
  212. package/src/modules/offline/offlineManager.ts +4 -18
  213. package/src/{utils/MapLibreRNStyles.d.ts → types/MapLibreRNStyles.ts} +85 -405
  214. package/src/utils/StyleValue.ts +4 -4
  215. package/src/utils/filterUtils.ts +1 -1
  216. package/src/utils/getStylePropertyType.ts +265 -0
  217. package/android/install.md +0 -32
  218. package/android/src/main/res/values/strings.xml +0 -3
  219. package/ios/install.md +0 -49
  220. package/lib/commonjs/components/Style.js +0 -266
  221. package/lib/commonjs/components/Style.js.map +0 -1
  222. package/lib/commonjs/types/StyleURL.js +0 -11
  223. package/lib/commonjs/types/StyleURL.js.map +0 -1
  224. package/lib/commonjs/utils/MapLibreRNStyles.d.js +0 -181
  225. package/lib/commonjs/utils/MapLibreRNStyles.d.js.map +0 -1
  226. package/lib/commonjs/utils/deprecation.js +0 -31
  227. package/lib/commonjs/utils/deprecation.js.map +0 -1
  228. package/lib/commonjs/utils/styleMap.js +0 -255
  229. package/lib/commonjs/utils/styleMap.js.map +0 -1
  230. package/lib/module/components/Style.js +0 -261
  231. package/lib/module/components/Style.js.map +0 -1
  232. package/lib/module/types/StyleURL.js +0 -7
  233. package/lib/module/types/StyleURL.js.map +0 -1
  234. package/lib/module/utils/MapLibreRNStyles.d.js +0 -180
  235. package/lib/module/utils/MapLibreRNStyles.d.js.map +0 -1
  236. package/lib/module/utils/deprecation.js +0 -27
  237. package/lib/module/utils/deprecation.js.map +0 -1
  238. package/lib/module/utils/styleMap.js +0 -249
  239. package/lib/module/utils/styleMap.js.map +0 -1
  240. package/lib/typescript/commonjs/src/components/Style.d.ts +0 -81
  241. package/lib/typescript/commonjs/src/components/Style.d.ts.map +0 -1
  242. package/lib/typescript/commonjs/src/types/StyleURL.d.ts +0 -4
  243. package/lib/typescript/commonjs/src/types/StyleURL.d.ts.map +0 -1
  244. package/lib/typescript/commonjs/src/utils/deprecation.d.ts +0 -6
  245. package/lib/typescript/commonjs/src/utils/deprecation.d.ts.map +0 -1
  246. package/lib/typescript/commonjs/src/utils/styleMap.d.ts +0 -231
  247. package/lib/typescript/commonjs/src/utils/styleMap.d.ts.map +0 -1
  248. package/lib/typescript/module/src/components/Style.d.ts +0 -81
  249. package/lib/typescript/module/src/components/Style.d.ts.map +0 -1
  250. package/lib/typescript/module/src/types/StyleURL.d.ts +0 -4
  251. package/lib/typescript/module/src/types/StyleURL.d.ts.map +0 -1
  252. package/lib/typescript/module/src/utils/deprecation.d.ts +0 -6
  253. package/lib/typescript/module/src/utils/deprecation.d.ts.map +0 -1
  254. package/lib/typescript/module/src/utils/styleMap.d.ts +0 -231
  255. package/lib/typescript/module/src/utils/styleMap.d.ts.map +0 -1
  256. package/src/components/Style.tsx +0 -371
  257. package/src/types/StyleURL.ts +0 -3
  258. package/src/utils/deprecation.ts +0 -31
  259. package/src/utils/styleMap.ts +0 -265
package/README.md CHANGED
@@ -15,66 +15,67 @@ supported both Mapbox and MapLibre for some time, but as the MapLibre and Mapbox
15
15
  diverged, it has become necessary to separate the projects into specific wrappers by underlying renderer.
16
16
 
17
17
  <p align="center">
18
- <img src="/docs/assets/indoor-building-map-android.png"
18
+ <img src="/docs/assets/device-android.png"
19
19
  alt="Indoor Building Map Android"
20
- height="300"
20
+ height="320"
21
21
  />
22
- <img src="/docs/assets/indoor-building-map-ios.png"
22
+ <img src="/docs/assets/device-ios.png"
23
23
  alt="Indoor Building Map iOS"
24
- height="300"
24
+ height="320"
25
25
  />
26
26
  </p>
27
27
 
28
28
  ## Documentation
29
29
 
30
- - [Getting Started](/docs/GettingStarted.md)
30
+ - [Getting Started](/docs/guides/setup/GettingStarted.md)
31
31
  - Installation
32
32
  - React Native
33
- - [Android](/android/install.md)
34
- - [iOS](/ios/install.md)
35
- - [Expo](/plugin/install.md)
33
+ - [Android](/docs/guides/setup/Android.md)
34
+ - [iOS](/docs/guides/setup/iOS.md)
35
+ - [Expo](/docs/guides/setup/Expo.md)
36
+ - Migrations
37
+ - [Migrating to v10](/docs/guides/migrations/v10.md)
36
38
 
37
39
  ### Components
38
40
 
39
- - [MapView](/docs/MapView.md)
40
- - [Light](/docs/Light.md)
41
- - [StyleSheet](/docs/StyleSheet.md)
42
- - [PointAnnotation](/docs/PointAnnotation.md)
43
- - [MarkerView](/docs/MarkerView.md)
44
- - [Callout](/docs/Callout.md)
45
- - [Camera](docs/Camera.md)
46
- - [UserLocation](docs/UserLocation.md)
47
- - [Images](docs/Images.md)
41
+ - [MapView](/docs/components/MapView.md)
42
+ - [Light](/docs/components/Light.md)
43
+ - [PointAnnotation](/docs/components/PointAnnotation.md)
44
+ - [MarkerView](/docs/components/MarkerView.md)
45
+ - [Callout](/docs/components/Callout.md)
46
+ - [Camera](/docs/components/Camera.md)
47
+ - [UserLocation](/docs/components/UserLocation.md)
48
+ - [Images](/docs/components/Images.md)
48
49
 
49
50
  ### Sources
50
51
 
51
- - [VectorSource](/docs/VectorSource.md)
52
- - [ShapeSource](/docs/ShapeSource.md)
53
- - [RasterSource](/docs/RasterSource.md)
52
+ - [VectorSource](/docs/components/VectorSource.md)
53
+ - [ShapeSource](/docs/components/ShapeSource.md)
54
+ - [RasterSource](/docs/components/RasterSource.md)
54
55
 
55
56
  ### Layers
56
57
 
57
- - [BackgroundLayer](/docs/BackgroundLayer.md)
58
- - [CircleLayer](/docs/CircleLayer.md)
59
- - [FillExtrusionLayer](/docs/FillExtrusionLayer.md)
60
- - [FillLayer](/docs/FillLayer.md)
61
- - [LineLayer](/docs/LineLayer.md)
62
- - [RasterLayer](/docs/RasterLayer.md)
63
- - [SymbolLayer](/docs/SymbolLayer.md)
64
- - [HeatmapLayer](/docs/HeatmapLayer.md)
58
+ - [BackgroundLayer](/docs/components/BackgroundLayer.md)
59
+ - [CircleLayer](/docs/components/CircleLayer.md)
60
+ - [FillExtrusionLayer](/docs/components/FillExtrusionLayer.md)
61
+ - [FillLayer](/docs/components/FillLayer.md)
62
+ - [LineLayer](/docs/components/LineLayer.md)
63
+ - [RasterLayer](/docs/components/RasterLayer.md)
64
+ - [SymbolLayer](/docs/components/SymbolLayer.md)
65
+ - [HeatmapLayer](/docs/components/HeatmapLayer.md)
65
66
 
66
- ### Offline
67
+ ### Modules
67
68
 
68
- - [OfflineManager](/docs/OfflineManager.md)
69
- - [SnapshotManager](/docs/snapshotManager.md)
69
+ - [OfflineManager](/docs/modules/offlineManager.md)
70
+ - [SnapshotManager](/docs/modules/snapshotManager.md)
70
71
 
71
72
  ### Misc
72
73
 
73
- - [MapLibreGL](/docs/MapLibreGL.md)
74
- - [CustomHttpHeaders](/docs/CustomHttpHeaders.md)
75
- - [Logger](/docs/Logger.md)
74
+ - [MapLibreGL](/docs/guides/MapLibreGL.md)
75
+ - [Custom HTTP Headers](/docs/guides/CustomHTTPHeaders.md)
76
+ - [Logger](/docs/guides/Logger.md)
76
77
 
77
- ## Contributing / local development
78
+ ## Contributing & Development
78
79
 
79
80
  Read the [CONTRIBUTING.md](CONTRIBUTING.md) guide in order to get familiar with how we do things around here and
80
81
  set up your local development environment.
@@ -1,69 +1,116 @@
1
- apply plugin: 'com.android.library'
1
+ buildscript {
2
+ // Buildscript is evaluated before everything else so we can't use getExtOrDefault
3
+ def kotlin_version = rootProject.ext.has("kotlinVersion") ? rootProject.ext.get("kotlinVersion") : project.properties["MapLibreReactNative_kotlinVersion"]
4
+
5
+ repositories {
6
+ google()
7
+ mavenCentral()
8
+ }
9
+
10
+ dependencies {
11
+ classpath "com.android.tools.build:gradle:7.2.1"
12
+ // noinspection DifferentKotlinGradleVersion
13
+ classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
14
+ }
15
+ }
2
16
 
3
- def safeExtGet(prop, fallback) {
4
- rootProject.ext.has(prop) ? rootProject.ext.get(prop) : fallback
17
+ def reactNativeArchitectures() {
18
+ def value = rootProject.getProperties().get("reactNativeArchitectures")
19
+ return value ? value.split(",") : ["armeabi-v7a", "x86", "x86_64", "arm64-v8a"]
5
20
  }
6
21
 
7
22
  def isNewArchitectureEnabled() {
8
- return project.hasProperty("newArchEnabled") && project.newArchEnabled == "true"
23
+ return rootProject.hasProperty("newArchEnabled") && rootProject.getProperty("newArchEnabled") == "true"
9
24
  }
10
25
 
11
- buildscript {
12
- ext {
13
- buildToolsVersion = "33.0.0"
14
- minSdkVersion = 16
15
- compileSdkVersion = 34
16
- targetSdkVersion = 33
17
- supportLibVersion = "28.0.0"
18
- }
26
+ apply plugin: "com.android.library"
27
+ apply plugin: "kotlin-android"
19
28
 
20
- repositories {
21
- google()
22
- mavenCentral()
23
- }
29
+ // TODO: Currently breaks new arch support, but works without
30
+ // if (isNewArchitectureEnabled()) {
31
+ // apply plugin: "com.facebook.react"
32
+ // }
33
+
34
+ def getExtOrDefault(name) {
35
+ return rootProject.ext.has(name) ? rootProject.ext.get(name) : project.properties["MapLibreReactNative_" + name]
36
+ }
37
+
38
+ def getExtOrIntegerDefault(name) {
39
+ return rootProject.ext.has(name) ? rootProject.ext.get(name) : (project.properties["MapLibreReactNative_" + name]).toInteger()
40
+ }
41
+
42
+ def supportsNamespace() {
43
+ def parsed = com.android.Version.ANDROID_GRADLE_PLUGIN_VERSION.tokenize('.')
44
+ def major = parsed[0].toInteger()
45
+ def minor = parsed[1].toInteger()
46
+
47
+ // Namespace support was added in 7.3.0
48
+ return (major == 7 && minor >= 3) || major >= 8
24
49
  }
25
50
 
26
51
  android {
27
- compileSdkVersion safeExtGet("compileSdkVersion", 33)
28
- buildToolsVersion safeExtGet("buildToolsVersion", '33.0.1')
29
-
30
- defaultConfig {
31
- minSdkVersion safeExtGet('minSdkVersion', 16)
32
- targetSdkVersion safeExtGet('targetSdkVersion', 26)
33
- versionCode 1
34
- versionName "1.0"
35
- buildConfigField("boolean", "IS_NEW_ARCHITECTURE_ENABLED", isNewArchitectureEnabled().toString())
36
- }
52
+ if (supportsNamespace()) {
53
+ namespace "org.maplibre.reactnative"
37
54
 
38
- compileOptions {
39
- sourceCompatibility JavaVersion.VERSION_1_8
40
- targetCompatibility JavaVersion.VERSION_1_8
55
+ sourceSets {
56
+ main {
57
+ manifest.srcFile "src/main/AndroidManifestNew.xml"
58
+ }
41
59
  }
60
+ }
61
+
62
+ compileSdkVersion getExtOrIntegerDefault("compileSdkVersion")
63
+
64
+ defaultConfig {
65
+ minSdkVersion getExtOrIntegerDefault("minSdkVersion")
66
+ targetSdkVersion getExtOrIntegerDefault("targetSdkVersion")
42
67
 
43
- buildTypes {
44
- release {
45
- minifyEnabled false
46
- }
68
+ buildConfigField "boolean", "IS_NEW_ARCHITECTURE_ENABLED", isNewArchitectureEnabled().toString()
69
+ }
70
+
71
+ buildTypes {
72
+ release {
73
+ minifyEnabled false
47
74
  }
75
+ }
76
+
77
+ lintOptions {
78
+ disable "GradleCompatible"
79
+ }
80
+
81
+ compileOptions {
82
+ sourceCompatibility JavaVersion.VERSION_1_8
83
+ targetCompatibility JavaVersion.VERSION_1_8
84
+ }
48
85
  }
49
86
 
87
+ repositories {
88
+ mavenCentral()
89
+ google()
90
+ }
91
+
92
+ def kotlin_version = getExtOrDefault("kotlinVersion")
93
+
50
94
  dependencies {
51
- // The version of react-native is set by the React Native Gradle Plugin
52
- implementation("com.facebook.react:react-android")
53
-
54
- // MapLibre SDK
55
- implementation "org.maplibre.gl:android-sdk:11.5.0"
56
- implementation "org.maplibre.gl:android-sdk-turf:6.0.1"
57
-
58
- // Dependencies
59
- implementation "androidx.vectordrawable:vectordrawable:1.1.0"
60
- implementation "androidx.annotation:annotation:1.7.0"
61
- implementation "androidx.appcompat:appcompat:1.6.1"
62
- implementation "com.squareup.okhttp3:okhttp:${safeExtGet('okhttpVersion', '4.9.0')}"
63
- implementation "com.squareup.okhttp3:okhttp-urlconnection:${safeExtGet('okhttpVersion', '4.9.0')}"
64
-
65
- // MapLibre plugins
66
- implementation ("org.maplibre.gl:android-plugin-localization-v9:3.0.1")
67
- implementation ("org.maplibre.gl:android-plugin-annotation-v9:3.0.1")
68
- implementation ("org.maplibre.gl:android-plugin-markerview-v9:3.0.1")
95
+ // For < 0.71, this will be from the local maven repo
96
+ // For > 0.71, this will be replaced by `com.facebook.react:react-android:$version` by react gradle plugin
97
+ //noinspection GradleDynamicVersion
98
+ implementation "com.facebook.react:react-native:+"
99
+ implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
100
+
101
+ // MapLibre SDK
102
+ implementation "org.maplibre.gl:android-sdk:11.5.0"
103
+ implementation "org.maplibre.gl:android-sdk-turf:6.0.1"
104
+
105
+ // Dependencies
106
+ implementation "androidx.vectordrawable:vectordrawable:1.1.0"
107
+ implementation "androidx.annotation:annotation:1.7.0"
108
+ implementation "androidx.appcompat:appcompat:1.6.1"
109
+ implementation "com.squareup.okhttp3:okhttp:${getExtOrDefault('okhttpVersion')}"
110
+ implementation "com.squareup.okhttp3:okhttp-urlconnection:${getExtOrDefault('okhttpVersion')}"
111
+
112
+ // MapLibre plugins
113
+ implementation ("org.maplibre.gl:android-plugin-localization-v9:3.0.1")
114
+ implementation ("org.maplibre.gl:android-plugin-annotation-v9:3.0.1")
115
+ implementation ("org.maplibre.gl:android-plugin-markerview-v9:3.0.1")
69
116
  }
@@ -0,0 +1,7 @@
1
+ MapLibreReactNative_kotlinVersion=1.7.0
2
+ MapLibreReactNative_minSdkVersion=21
3
+ MapLibreReactNative_targetSdkVersion=31
4
+ MapLibreReactNative_compileSdkVersion=31
5
+ MapLibreReactNative_ndkversion=21.4.7075529
6
+
7
+ MapLibreReactNative_okhttpVersion=4.9.0
@@ -1,4 +1,6 @@
1
- <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="org.maplibre.reactnative">
1
+ <manifest xmlns:android="http://schemas.android.com/apk/res/android"
2
+ package="org.maplibre.reactnative">
3
+
2
4
  <uses-permission android:name="android.permission.INTERNET" />
3
- <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
5
+ <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
4
6
  </manifest>
@@ -0,0 +1,5 @@
1
+ <manifest xmlns:android="http://schemas.android.com/apk/res/android">
2
+
3
+ <uses-permission android:name="android.permission.INTERNET" />
4
+ <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
5
+ </manifest>
@@ -52,11 +52,6 @@ public class MLRNPackage implements ReactPackage {
52
52
  return modules;
53
53
  }
54
54
 
55
- @Deprecated
56
- public List<Class<? extends JavaScriptModule>> createJSModules() {
57
- return Collections.emptyList();
58
- }
59
-
60
55
  @Override
61
56
  public List<ViewManager> createViewManagers(ReactApplicationContext reactApplicationContext) {
62
57
  List<ViewManager> managers = new ArrayList<>();
@@ -8,7 +8,6 @@ import android.graphics.RectF;
8
8
  import android.location.Location;
9
9
  import android.os.Handler;
10
10
  import androidx.annotation.NonNull;
11
- import androidx.annotation.UiThread;
12
11
 
13
12
  import android.util.DisplayMetrics;
14
13
  import android.util.Pair;
@@ -53,7 +52,6 @@ import org.maplibre.reactnative.R;
53
52
  import org.maplibre.reactnative.components.AbstractMapFeature;
54
53
  import org.maplibre.reactnative.components.annotation.MLRNPointAnnotation;
55
54
  import org.maplibre.reactnative.components.annotation.MLRNMarkerView;
56
- import org.maplibre.reactnative.components.annotation.MarkerView;
57
55
  import org.maplibre.reactnative.components.annotation.MarkerViewManager;
58
56
  import org.maplibre.reactnative.components.camera.MLRNCamera;
59
57
  import org.maplibre.reactnative.components.images.MLRNImages;
@@ -69,6 +67,7 @@ import org.maplibre.reactnative.events.IEvent;
69
67
  import org.maplibre.reactnative.events.MapChangeEvent;
70
68
  import org.maplibre.reactnative.events.MapClickEvent;
71
69
  import org.maplibre.reactnative.events.constants.EventTypes;
70
+ import org.maplibre.reactnative.modules.MLRNModule;
72
71
  import org.maplibre.reactnative.utils.BitmapUtils;
73
72
  import org.maplibre.reactnative.utils.GeoJSONUtils;
74
73
  import org.maplibre.reactnative.utils.GeoViewport;
@@ -85,7 +84,6 @@ import org.json.*;
85
84
  import javax.annotation.Nullable;
86
85
 
87
86
  import static org.maplibre.android.style.layers.PropertyFactory.visibility;
88
- import static org.maplibre.reactnative.modules.MLRNOfflineModule.DEFAULT_STYLE_URL;
89
87
 
90
88
  @SuppressWarnings({ "MissingPermission" })
91
89
  public class MLRNMapView extends MapView implements OnMapReadyCallback, MapLibreMap.OnMapClickListener,
@@ -117,7 +115,7 @@ public class MLRNMapView extends MapView implements OnMapReadyCallback, MapLibre
117
115
 
118
116
  private LocalizationPlugin mLocalizationPlugin;
119
117
 
120
- private String mStyleURL;
118
+ private String mMapStyle;
121
119
 
122
120
  private Integer mPreferredFramesPerSecond;
123
121
  private boolean mLocalizeLabels;
@@ -171,7 +169,7 @@ public class MLRNMapView extends MapView implements OnMapReadyCallback, MapLibre
171
169
 
172
170
  mHandler = new Handler();
173
171
 
174
- mStyleURL = DEFAULT_STYLE_URL;
172
+ mMapStyle = MLRNModule.DEFAULT_STYLE_URL;
175
173
 
176
174
  setLifecycleListeners();
177
175
 
@@ -436,10 +434,10 @@ public class MLRNMapView extends MapView implements OnMapReadyCallback, MapLibre
436
434
  public void onMapReady(final MapLibreMap mapboxMap) {
437
435
  mMap = mapboxMap;
438
436
 
439
- if (isJSONValid(mStyleURL)) {
440
- mMap.setStyle(new Style.Builder().fromJson(mStyleURL));
437
+ if (isJSONValid(mMapStyle)) {
438
+ mMap.setStyle(new Style.Builder().fromJson(mMapStyle));
441
439
  } else {
442
- mMap.setStyle(new Style.Builder().fromUri(mStyleURL));
440
+ mMap.setStyle(new Style.Builder().fromUri(mMapStyle));
443
441
  }
444
442
 
445
443
  reflow();
@@ -776,21 +774,21 @@ public class MLRNMapView extends MapView implements OnMapReadyCallback, MapLibre
776
774
  return mContext.getResources().getDisplayMetrics().density;
777
775
  }
778
776
 
779
- public void setReactStyleURL(String styleURL) {
780
- mStyleURL = styleURL;
777
+ public void setReactMapStyle(String mapStyle) {
778
+ mMapStyle = mapStyle;
781
779
 
782
780
  if (mMap != null) {
783
781
  removeAllSourcesFromMap();
784
782
 
785
- if (isJSONValid(mStyleURL)) {
786
- mMap.setStyle(new Style.Builder().fromJson(mStyleURL), new Style.OnStyleLoaded() {
783
+ if (isJSONValid(mMapStyle)) {
784
+ mMap.setStyle(new Style.Builder().fromJson(mMapStyle), new Style.OnStyleLoaded() {
787
785
  @Override
788
786
  public void onStyleLoaded(@NonNull Style style) {
789
787
  addAllSourcesToMap();
790
788
  }
791
789
  });
792
790
  } else {
793
- mMap.setStyle(styleURL, new Style.OnStyleLoaded() {
791
+ mMap.setStyle(mapStyle, new Style.OnStyleLoaded() {
794
792
  @Override
795
793
  public void onStyleLoaded(@NonNull Style style) {
796
794
  addAllSourcesToMap();
@@ -1,7 +1,6 @@
1
1
  package org.maplibre.reactnative.components.mapview;
2
2
 
3
3
  import android.util.Log;
4
- import android.view.Gravity;
5
4
  import android.view.View;
6
5
 
7
6
  import com.facebook.react.bridge.ReactApplicationContext;
@@ -11,23 +10,17 @@ import com.facebook.react.common.MapBuilder;
11
10
  import com.facebook.react.uimanager.LayoutShadowNode;
12
11
  import com.facebook.react.uimanager.ThemedReactContext;
13
12
  import com.facebook.react.uimanager.annotations.ReactProp;
14
- import org.maplibre.android.geometry.LatLngBounds;
15
- import org.maplibre.android.log.Logger;
13
+
16
14
  import org.maplibre.android.maps.MapLibreMap;
17
15
  import org.maplibre.reactnative.components.AbstractEventEmitter;
18
16
  import org.maplibre.reactnative.events.constants.EventKeys;
19
17
  import org.maplibre.reactnative.utils.ConvertUtils;
20
18
  import org.maplibre.reactnative.utils.ExpressionParser;
21
19
  import org.maplibre.reactnative.utils.GeoJSONUtils;
22
- import org.maplibre.geojson.FeatureCollection;
23
- import org.maplibre.geojson.Point;
24
20
 
25
21
  import java.util.ArrayList;
26
22
  import java.util.HashMap;
27
23
  import java.util.Map;
28
- import java.util.concurrent.ExecutionException;
29
- import java.util.concurrent.FutureTask;
30
- import java.util.concurrent.RunnableFuture;
31
24
 
32
25
  import javax.annotation.Nullable;
33
26
 
@@ -111,9 +104,9 @@ public class MLRNMapViewManager extends AbstractEventEmitter<MLRNMapView> {
111
104
 
112
105
  //region React Props
113
106
 
114
- @ReactProp(name="styleURL")
115
- public void setStyleURL(MLRNMapView mapView, String styleURL) {
116
- mapView.setReactStyleURL(styleURL);
107
+ @ReactProp(name="mapStyle")
108
+ public void setMapStyle(MLRNMapView mapView, String mapStyle) {
109
+ mapView.setReactMapStyle(mapStyle);
117
110
  }
118
111
 
119
112
  @ReactProp(name="preferredFramesPerSecond")
@@ -35,10 +35,7 @@ public class MLRNStyle {
35
35
 
36
36
  while (it.hasNextKey()) {
37
37
  String key = it.nextKey();
38
-
39
- if (!key.equals("__MAPBOX_STYLESHEET__")) {
40
- keys.add(key);
41
- }
38
+ keys.add(key);
42
39
  }
43
40
 
44
41
  return keys;
@@ -9,7 +9,6 @@ import org.maplibre.android.style.layers.FillExtrusionLayer;
9
9
  import org.maplibre.android.style.layers.FillLayer;
10
10
  import org.maplibre.android.style.layers.LineLayer;
11
11
  import org.maplibre.android.style.layers.PropertyFactory;
12
- import org.maplibre.android.style.layers.PropertyValue;
13
12
  import org.maplibre.android.style.layers.RasterLayer;
14
13
  import org.maplibre.android.style.layers.SymbolLayer;
15
14
  import org.maplibre.android.style.layers.HeatmapLayer;
@@ -28,7 +27,7 @@ public class MLRNStyleFactory {
28
27
  public static void setFillLayerStyle(final FillLayer layer, MLRNStyle style) {
29
28
  List<String> styleKeys = style.getAllStyleKeys();
30
29
 
31
- if (styleKeys.size() == 0) {
30
+ if (styleKeys.isEmpty()) {
32
31
  return;
33
32
  }
34
33
 
@@ -89,7 +88,7 @@ public class MLRNStyleFactory {
89
88
  public static void setLineLayerStyle(final LineLayer layer, MLRNStyle style) {
90
89
  List<String> styleKeys = style.getAllStyleKeys();
91
90
 
92
- if (styleKeys.size() == 0) {
91
+ if (styleKeys.isEmpty()) {
93
92
  return;
94
93
  }
95
94
 
@@ -186,7 +185,7 @@ public class MLRNStyleFactory {
186
185
  public static void setSymbolLayerStyle(final SymbolLayer layer, MLRNStyle style) {
187
186
  List<String> styleKeys = style.getAllStyleKeys();
188
187
 
189
- if (styleKeys.size() == 0) {
188
+ if (styleKeys.isEmpty()) {
190
189
  return;
191
190
  }
192
191
 
@@ -409,7 +408,7 @@ public class MLRNStyleFactory {
409
408
  public static void setCircleLayerStyle(final CircleLayer layer, MLRNStyle style) {
410
409
  List<String> styleKeys = style.getAllStyleKeys();
411
410
 
412
- if (styleKeys.size() == 0) {
411
+ if (styleKeys.isEmpty()) {
413
412
  return;
414
413
  }
415
414
 
@@ -486,7 +485,7 @@ public class MLRNStyleFactory {
486
485
  public static void setHeatmapLayerStyle(final HeatmapLayer layer, MLRNStyle style) {
487
486
  List<String> styleKeys = style.getAllStyleKeys();
488
487
 
489
- if (styleKeys.size() == 0) {
488
+ if (styleKeys.isEmpty()) {
490
489
  return;
491
490
  }
492
491
 
@@ -527,7 +526,7 @@ public class MLRNStyleFactory {
527
526
  public static void setFillExtrusionLayerStyle(final FillExtrusionLayer layer, MLRNStyle style) {
528
527
  List<String> styleKeys = style.getAllStyleKeys();
529
528
 
530
- if (styleKeys.size() == 0) {
529
+ if (styleKeys.isEmpty()) {
531
530
  return;
532
531
  }
533
532
 
@@ -591,7 +590,7 @@ public class MLRNStyleFactory {
591
590
  public static void setRasterLayerStyle(final RasterLayer layer, MLRNStyle style) {
592
591
  List<String> styleKeys = style.getAllStyleKeys();
593
592
 
594
- if (styleKeys.size() == 0) {
593
+ if (styleKeys.isEmpty()) {
595
594
  return;
596
595
  }
597
596
 
@@ -650,7 +649,7 @@ public class MLRNStyleFactory {
650
649
  public static void setHillshadeLayerStyle(final HillshadeLayer layer, MLRNStyle style) {
651
650
  List<String> styleKeys = style.getAllStyleKeys();
652
651
 
653
- if (styleKeys.size() == 0) {
652
+ if (styleKeys.isEmpty()) {
654
653
  return;
655
654
  }
656
655
 
@@ -697,7 +696,7 @@ public class MLRNStyleFactory {
697
696
  public static void setBackgroundLayerStyle(final BackgroundLayer layer, MLRNStyle style) {
698
697
  List<String> styleKeys = style.getAllStyleKeys();
699
698
 
700
- if (styleKeys.size() == 0) {
699
+ if (styleKeys.isEmpty()) {
701
700
  return;
702
701
  }
703
702
 
@@ -737,7 +736,7 @@ public class MLRNStyleFactory {
737
736
  public static void setLightLayerStyle(final Light layer, MLRNStyle style) {
738
737
  List<String> styleKeys = style.getAllStyleKeys();
739
738
 
740
- if (styleKeys.size() == 0) {
739
+ if (styleKeys.isEmpty()) {
741
740
  return;
742
741
  }
743
742
 
@@ -243,70 +243,4 @@ public class MLRNShapeSource extends MLRNSource<GeoJsonSource> {
243
243
  AndroidCallbackEvent event = new AndroidCallbackEvent(this, callbackID, payload);
244
244
  mManager.handleEvent(event);
245
245
  }
246
-
247
- // Deprecated. Will be removed in 9+ ver.
248
- public void getClusterExpansionZoomById(String callbackID, int clusterId) {
249
- if (mSource == null) {
250
- WritableMap payload = new WritableNativeMap();
251
- payload.putString("error", "source is not yet loaded");
252
- AndroidCallbackEvent event = new AndroidCallbackEvent(this, callbackID, payload);
253
- mManager.handleEvent(event);
254
- return;
255
- }
256
- List<Feature> features = mSource.querySourceFeatures(Expression.eq(Expression.id(), clusterId));
257
- int zoom = -1;
258
- if (features.size() > 0) {
259
- zoom = mSource.getClusterExpansionZoom(features.get(0));
260
- }
261
-
262
- if (zoom == -1) {
263
- WritableMap payload = new WritableNativeMap();
264
- payload.putString("error", "Could not get zoom for cluster id " + clusterId);
265
- AndroidCallbackEvent event = new AndroidCallbackEvent(this, callbackID, payload);
266
- mManager.handleEvent(event);
267
- return;
268
- }
269
-
270
- WritableMap payload = new WritableNativeMap();
271
- payload.putInt("data", zoom);
272
-
273
- AndroidCallbackEvent event = new AndroidCallbackEvent(this, callbackID, payload);
274
- mManager.handleEvent(event);
275
- }
276
-
277
- // Deprecated. Will be removed in 9+ ver.
278
- public void getClusterLeavesById(String callbackID, int clusterId, int number, int offset) {
279
- if (mSource == null) {
280
- WritableMap payload = new WritableNativeMap();
281
- payload.putString("error", "source is not yet loaded");
282
- AndroidCallbackEvent event = new AndroidCallbackEvent(this, callbackID, payload);
283
- mManager.handleEvent(event);
284
- return;
285
- }
286
- Feature clusterFeature = mSource.querySourceFeatures(Expression.eq(Expression.get("cluster_id"), clusterId)).get(0);
287
- FeatureCollection leaves = mSource.getClusterLeaves(clusterFeature, number, offset);
288
- WritableMap payload = new WritableNativeMap();
289
- payload.putString("data", leaves.toJson());
290
-
291
- AndroidCallbackEvent event = new AndroidCallbackEvent(this, callbackID, payload);
292
- mManager.handleEvent(event);
293
- }
294
-
295
- // Deprecated. Will be removed in 9+ ver.
296
- public void getClusterChildrenById(String callbackID, int clusterId) {
297
- if (mSource == null) {
298
- WritableMap payload = new WritableNativeMap();
299
- payload.putString("error", "source is not yet loaded");
300
- AndroidCallbackEvent event = new AndroidCallbackEvent(this, callbackID, payload);
301
- mManager.handleEvent(event);
302
- return;
303
- }
304
- Feature clusterFeature = mSource.querySourceFeatures(Expression.eq(Expression.get("cluster_id"), clusterId)).get(0);
305
- FeatureCollection leaves = mSource.getClusterChildren(clusterFeature);
306
- WritableMap payload = new WritableNativeMap();
307
- payload.putString("data", leaves.toJson());
308
-
309
- AndroidCallbackEvent event = new AndroidCallbackEvent(this, callbackID, payload);
310
- mManager.handleEvent(event);
311
- }
312
246
  }