@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
@@ -26,9 +26,9 @@ import useNativeBridge from "../hooks/useNativeBridge";
26
26
  import useOnce from "../hooks/useOnce";
27
27
  import { type Location } from "../modules/location/locationManager";
28
28
  import { type BaseProps } from "../types/BaseProps";
29
+ import { type FilterExpression } from "../types/MapLibreRNStyles";
29
30
  import { isFunction, isAndroid } from "../utils";
30
31
  import Logger from "../utils/Logger";
31
- import { type FilterExpression } from "../utils/MapLibreRNStyles";
32
32
  import { getFilter } from "../utils/filterUtils";
33
33
 
34
34
  const MapLibreRN = NativeModules.MLRNModule;
@@ -46,8 +46,6 @@ const styles = StyleSheet.create({
46
46
  matchParent: { flex: 1 },
47
47
  });
48
48
 
49
- const defaultStyleURL = MapLibreRN.StyleURL.Street;
50
-
51
49
  export interface RegionPayload {
52
50
  zoomLevel: number;
53
51
  heading: number;
@@ -69,13 +67,9 @@ interface MapViewProps extends BaseProps {
69
67
  */
70
68
  style?: ViewProps["style"];
71
69
  /**
72
- * Style URL for map - notice, if non is set it _will_ default to `MapLibreGL.StyleURL.Default`
73
- */
74
- styleURL?: string;
75
- /**
76
- * StyleJSON for map - according to TileJSON specs: https://github.com/mapbox/tilejson-spec
70
+ * Style for map - either a URL or a Style JSON (https://maplibre.org/maplibre-style-spec/). Default: `MapLibreRN.StyleURL.Default`
77
71
  */
78
- styleJSON?: string;
72
+ mapStyle?: string | object;
79
73
  /**
80
74
  * iOS: The preferred frame rate at which the map view is rendered.
81
75
  * The default value for this property is MLNMapViewPreferredFramesPerSecondDefault,
@@ -165,7 +159,7 @@ interface MapViewProps extends BaseProps {
165
159
  /**
166
160
  * This event is triggered whenever the currently displayed map region is about to change.
167
161
  *
168
- * @param {PointFeature} feature - The geojson point feature at the camera center, properties contains zoomLevel, visibleBounds
162
+ * @param {GeoJSON.Feature<GeoJSON.Point, RegionPayload>} feature - The geojson point feature at the camera center, properties contains zoomLevel, visibleBounds
169
163
  */
170
164
  onRegionWillChange?(
171
165
  feature: GeoJSON.Feature<GeoJSON.Point, RegionPayload>,
@@ -173,7 +167,7 @@ interface MapViewProps extends BaseProps {
173
167
  /**
174
168
  * This event is triggered whenever the currently displayed map region is changing.
175
169
  *
176
- * @param {PointFeature} feature - The geojson point feature at the camera center, properties contains zoomLevel, visibleBounds
170
+ * @param {GeoJSON.Feature<GeoJSON.Point, RegionPayload>} feature - The geojson point feature at the camera center, properties contains zoomLevel, visibleBounds
177
171
  */
178
172
  onRegionIsChanging?(
179
173
  feature: GeoJSON.Feature<GeoJSON.Point, RegionPayload>,
@@ -181,7 +175,7 @@ interface MapViewProps extends BaseProps {
181
175
  /**
182
176
  * This event is triggered whenever the currently displayed map region finished changing
183
177
  *
184
- * @param {PointFeature} feature - The geojson point feature at the camera center, properties contains zoomLevel, visibleBounds
178
+ * @param {GeoJSON.Feature<GeoJSON.Point, RegionPayload>} feature - The geojson point feature at the camera center, properties contains zoomLevel, visibleBounds
185
179
  */
186
180
  onRegionDidChange?(
187
181
  feature: GeoJSON.Feature<GeoJSON.Point, RegionPayload>,
@@ -250,6 +244,7 @@ type CallableProps = {
250
244
  }[keyof MapViewProps];
251
245
 
252
246
  interface NativeProps extends Omit<MapViewProps, "onPress" | "onLongPress"> {
247
+ mapStyle?: string;
253
248
  onPress(event: NativeSyntheticEvent<{ payload: GeoJSON.Feature }>): void;
254
249
  onLongPress(event: NativeSyntheticEvent<{ payload: GeoJSON.Feature }>): void;
255
250
  }
@@ -268,7 +263,6 @@ export interface MapViewRef {
268
263
  filter: FilterExpression | undefined,
269
264
  layerIDs: string[],
270
265
  ) => Promise<GeoJSON.FeatureCollection>;
271
- setCamera: () => void;
272
266
  takeSnap: (writeToDisk?: boolean) => Promise<string>;
273
267
  getZoom: () => Promise<number>;
274
268
  getCenter: () => Promise<GeoJSON.Position>;
@@ -359,10 +353,6 @@ const MapView = memo(
359
353
  * @return {GeoJSON.FeatureCollection}
360
354
  */
361
355
  queryRenderedFeaturesInRect,
362
- /**
363
- * Map camera will perform updates based on provided config. Deprecated use Camera#setCamera.
364
- */
365
- setCamera,
366
356
  /**
367
357
  * Takes snapshot of map with current tiles and returns a URI to the image
368
358
  * @param {Boolean} writeToDisk If true will create a temp file, otherwise it is in base64
@@ -571,12 +561,6 @@ const MapView = memo(
571
561
  return res.data as GeoJSON.FeatureCollection;
572
562
  };
573
563
 
574
- const setCamera = (): void => {
575
- console.warn(
576
- "MapView.setCamera is deprecated - please use Camera#setCamera",
577
- );
578
- };
579
-
580
564
  const takeSnap = async (writeToDisk = false): Promise<string> => {
581
565
  const res: { uri: string } = await _runNativeCommand(
582
566
  "takeSnap",
@@ -782,27 +766,20 @@ const MapView = memo(
782
766
  }
783
767
  };
784
768
 
785
- const _setStyleURL = (props: MapViewProps): void => {
786
- // user set a styleURL, no need to alter props
787
- if (props.styleURL) {
788
- return;
789
- }
790
-
791
- // user set styleJSON pass it to styleURL
792
- if (props.styleJSON && !props.styleURL) {
793
- props.styleURL = props.styleJSON;
794
- }
795
-
796
- // user neither set styleJSON nor styleURL
797
- // set defaultStyleUrl
798
- if (!props.styleJSON || !props.styleURL) {
799
- props.styleURL = defaultStyleURL;
769
+ const nativeProps = useMemo(() => {
770
+ const { mapStyle, ...otherProps } = props;
771
+
772
+ let nativeMapStyle = undefined;
773
+ if (mapStyle) {
774
+ if (typeof mapStyle === "string") {
775
+ nativeMapStyle = mapStyle;
776
+ } else if (typeof mapStyle === "object") {
777
+ nativeMapStyle = JSON.stringify(mapStyle);
778
+ }
800
779
  }
801
- };
802
780
 
803
- const nativeProps = useMemo(() => {
804
781
  return {
805
- ...props,
782
+ ...otherProps,
806
783
  localizeLabels,
807
784
  scrollEnabled,
808
785
  pitchEnabled,
@@ -812,10 +789,12 @@ const MapView = memo(
812
789
  surfaceView,
813
790
  regionWillChangeDebounceTime,
814
791
  regionDidChangeDebounceTime,
792
+ mapStyle: nativeMapStyle,
815
793
  contentInset: contentInsetValue,
816
794
  style: styles.matchParent,
817
795
  };
818
796
  }, [
797
+ props,
819
798
  localizeLabels,
820
799
  scrollEnabled,
821
800
  pitchEnabled,
@@ -825,12 +804,9 @@ const MapView = memo(
825
804
  surfaceView,
826
805
  regionWillChangeDebounceTime,
827
806
  regionDidChangeDebounceTime,
828
- props,
829
807
  contentInsetValue,
830
808
  ]);
831
809
 
832
- _setStyleURL(nativeProps);
833
-
834
810
  const callbacks = {
835
811
  ref: (ref: MLRNMapViewRefType): void => _setNativeRef(ref),
836
812
  onPress: _onPress,
@@ -6,7 +6,7 @@ import useAbstractLayer, {
6
6
  type NativeBaseProps,
7
7
  } from "../hooks/useAbstractLayer";
8
8
  import { type BaseProps } from "../types/BaseProps";
9
- import { type RasterLayerStyleProps } from "../utils/MapLibreRNStyles";
9
+ import { type RasterLayerStyle } from "../types/MapLibreRNStyles";
10
10
 
11
11
  const MapLibreRN = NativeModules.MLRNModule;
12
12
 
@@ -16,7 +16,7 @@ export interface RasterLayerProps extends BaseProps, BaseLayerProps {
16
16
  /**
17
17
  * Customizable style attributes
18
18
  */
19
- style?: RasterLayerStyleProps;
19
+ style?: RasterLayerStyle;
20
20
  }
21
21
 
22
22
  interface NativeProps
@@ -15,6 +15,10 @@ import {
15
15
 
16
16
  import useNativeBridge from "../hooks/useNativeBridge";
17
17
  import { type BaseProps } from "../types/BaseProps";
18
+ import {
19
+ type ExpressionField,
20
+ type FilterExpression,
21
+ } from "../types/MapLibreRNStyles";
18
22
  import { type OnPressEvent } from "../types/OnPressEvent";
19
23
  import {
20
24
  cloneReactChildrenWithProps,
@@ -22,16 +26,10 @@ import {
22
26
  isFunction,
23
27
  toJSONString,
24
28
  } from "../utils";
25
- import {
26
- type ExpressionField,
27
- type FilterExpression,
28
- } from "../utils/MapLibreRNStyles";
29
- import { copyPropertiesAsDeprecated } from "../utils/deprecation";
30
29
  import { getFilter } from "../utils/filterUtils";
31
30
 
32
31
  const MapLibreRN = NativeModules.MLRNModule;
33
32
  export const NATIVE_MODULE_NAME = "MLRNShapeSource";
34
- export const SHAPE_SOURCE_NATIVE_ASSETS_KEY = "assets";
35
33
 
36
34
  interface NativeProps {
37
35
  shape?: string;
@@ -252,18 +250,6 @@ const ShapeSource = memo(
252
250
  async function getClusterExpansionZoom(
253
251
  feature: GeoJSON.Feature,
254
252
  ): Promise<number> {
255
- if (typeof feature === "number") {
256
- console.warn(
257
- "Using cluster_id is deprecated and will be removed from the future releases. Please use cluster as an argument instead.",
258
- );
259
- const res: { data: number } = await _runNativeCommand(
260
- "getClusterExpansionZoomById",
261
- _nativeRef.current,
262
- [feature],
263
- );
264
- return res.data;
265
- }
266
-
267
253
  const res: { data: number } = await _runNativeCommand(
268
254
  "getClusterExpansionZoom",
269
255
  _nativeRef.current,
@@ -277,24 +263,6 @@ const ShapeSource = memo(
277
263
  limit: number,
278
264
  offset: number,
279
265
  ): Promise<GeoJSON.FeatureCollection> {
280
- if (typeof feature === "number") {
281
- console.warn(
282
- "Using cluster_id is deprecated and will be removed from the future releases. Please use cluster as an argument instead.",
283
- );
284
- const res: { data: string | GeoJSON.FeatureCollection } =
285
- await _runNativeCommand(
286
- "getClusterLeavesById",
287
- _nativeRef.current,
288
- [feature, limit, offset],
289
- );
290
-
291
- if (isAndroid()) {
292
- return JSON.parse(res.data as string);
293
- }
294
-
295
- return res.data as GeoJSON.FeatureCollection;
296
- }
297
-
298
266
  const res: { data: string | GeoJSON.FeatureCollection } =
299
267
  await _runNativeCommand("getClusterLeaves", _nativeRef.current, [
300
268
  JSON.stringify(feature),
@@ -312,24 +280,6 @@ const ShapeSource = memo(
312
280
  async function getClusterChildren(
313
281
  feature: GeoJSON.Feature,
314
282
  ): Promise<GeoJSON.FeatureCollection> {
315
- if (typeof feature === "number") {
316
- console.warn(
317
- "Using cluster_id is deprecated and will be removed from the future releases. Please use cluster as an argument instead.",
318
- );
319
- const res: { data: string | GeoJSON.FeatureCollection } =
320
- await _runNativeCommand(
321
- "getClusterChildrenById",
322
- _nativeRef.current,
323
- [feature],
324
- );
325
-
326
- if (isAndroid()) {
327
- return JSON.parse(res.data as string);
328
- }
329
-
330
- return res.data as GeoJSON.FeatureCollection;
331
- }
332
-
333
283
  const res: { data: string | GeoJSON.FeatureCollection } =
334
284
  await _runNativeCommand("getClusterChildren", _nativeRef.current, [
335
285
  JSON.stringify(feature),
@@ -372,31 +322,13 @@ const ShapeSource = memo(
372
322
  payload: { features, coordinates, point },
373
323
  },
374
324
  } = event;
375
- let newEvent = {
376
- features,
377
- coordinates,
378
- point,
379
- };
380
- newEvent = copyPropertiesAsDeprecated(
381
- event,
382
- newEvent,
383
- (key: string): void => {
384
- console.warn(
385
- `event.${key} is deprecated on ShapeSource#onPress, please use event.features`,
386
- );
387
- },
388
- {
389
- nativeEvent: (
390
- origNativeEvent: NativeSyntheticEvent<{ payload: OnPressEvent }>,
391
- ) => ({
392
- ...origNativeEvent,
393
- payload: features[0],
394
- }),
395
- },
396
- );
397
325
 
398
326
  if (props.onPress) {
399
- props.onPress(newEvent);
327
+ props.onPress({
328
+ features,
329
+ coordinates,
330
+ point,
331
+ });
400
332
  }
401
333
  }
402
334
 
@@ -1,12 +1,11 @@
1
- import { Children, type ReactElement } from "react";
2
- import { View, NativeModules, requireNativeComponent } from "react-native";
1
+ import { NativeModules, requireNativeComponent } from "react-native";
3
2
 
4
3
  import useAbstractLayer, {
5
4
  type BaseLayerProps,
6
5
  type NativeBaseProps,
7
6
  } from "../hooks/useAbstractLayer";
8
7
  import { type BaseProps } from "../types/BaseProps";
9
- import { type SymbolLayerStyleProps } from "../utils/MapLibreRNStyles";
8
+ import { type SymbolLayerStyle } from "../types/MapLibreRNStyles";
10
9
 
11
10
  const MapLibreRN = NativeModules.MLRNModule;
12
11
 
@@ -16,18 +15,12 @@ export interface SymbolLayerProps extends BaseProps, BaseLayerProps {
16
15
  /**
17
16
  * Customizable style attributes
18
17
  */
19
- style?: SymbolLayerStyleProps;
20
-
21
- /**
22
- * @deprecated passed children used to create an image with id of symbol in style and also set the iconImageName property accordingly.
23
- * This is now deprecated, use Image component instead.
24
- */
25
- children?: ReactElement | ReactElement[];
18
+ style?: SymbolLayerStyle;
26
19
  }
27
20
 
28
- interface NativeProps extends Omit<SymbolLayerProps, "style">, NativeBaseProps {
29
- snapshot: boolean;
30
- }
21
+ interface NativeProps
22
+ extends Omit<SymbolLayerProps, "style">,
23
+ NativeBaseProps {}
31
24
 
32
25
  const MLRNSymbolLayer = requireNativeComponent<NativeProps>(NATIVE_MODULE_NAME);
33
26
 
@@ -46,32 +39,11 @@ const SymbolLayer: React.FC<SymbolLayerProps> = ({
46
39
  sourceID,
47
40
  });
48
41
 
49
- const _shouldSnapshot = (): boolean => {
50
- let isSnapshot = false;
51
-
52
- if (Children.count(props.children) <= 0) {
53
- return isSnapshot;
54
- }
55
-
56
- Children.forEach(props.children, (child) => {
57
- if (child?.type === View) {
58
- isSnapshot = true;
59
- }
60
- });
61
-
62
- return isSnapshot;
63
- };
64
-
65
42
  const updatedProps = {
66
43
  ...baseProps,
67
- snapshot: _shouldSnapshot(),
68
44
  };
69
45
 
70
- return (
71
- <MLRNSymbolLayer ref={setNativeLayer} {...updatedProps}>
72
- {props.children}
73
- </MLRNSymbolLayer>
74
- );
46
+ return <MLRNSymbolLayer ref={setNativeLayer} {...updatedProps} />;
75
47
  };
76
48
 
77
49
  export default SymbolLayer;
@@ -15,11 +15,11 @@ import NativeUserLocation from "./NativeUserLocation";
15
15
  import locationManager, {
16
16
  type Location,
17
17
  } from "../modules/location/locationManager";
18
- import { type CircleLayerStyleProps } from "../utils/MapLibreRNStyles";
18
+ import { type CircleLayerStyle } from "../types/MapLibreRNStyles";
19
19
 
20
20
  const mapboxBlue = "rgba(51, 181, 229, 100)";
21
21
 
22
- const layerStyles: Record<string, CircleLayerStyleProps> = {
22
+ const layerStyles: Record<string, CircleLayerStyle> = {
23
23
  pluse: {
24
24
  circleRadius: 15,
25
25
  circleColor: mapboxBlue,
@@ -9,10 +9,9 @@ import {
9
9
  import useAbstractSource from "../hooks/useAbstractSource";
10
10
  import useNativeBridge from "../hooks/useNativeBridge";
11
11
  import { type BaseProps } from "../types/BaseProps";
12
+ import { type FilterExpression } from "../types/MapLibreRNStyles";
12
13
  import { type OnPressEvent } from "../types/OnPressEvent";
13
14
  import { cloneReactChildrenWithProps, isFunction, isAndroid } from "../utils";
14
- import { type FilterExpression } from "../utils/MapLibreRNStyles";
15
- import { copyPropertiesAsDeprecated } from "../utils/deprecation";
16
15
  import { getFilter } from "../utils/filterUtils";
17
16
 
18
17
  const MapLibreRN = NativeModules.MLRNModule;
@@ -160,33 +159,18 @@ const VectorSource = memo(
160
159
  if (!onPress) {
161
160
  return;
162
161
  }
162
+
163
163
  const {
164
164
  nativeEvent: {
165
165
  payload: { features, coordinates, point },
166
166
  },
167
167
  } = event;
168
- let newEvent = {
168
+
169
+ onPress({
169
170
  features,
170
171
  coordinates,
171
172
  point,
172
- };
173
- newEvent = copyPropertiesAsDeprecated(
174
- event,
175
- newEvent,
176
- (key: string) => {
177
- console.warn(
178
- `event.${key} is deprecated on VectorSource#onPress, please use event.features`,
179
- );
180
- },
181
- {
182
- nativeEvent: (origNativeEvent: OnPressEvent) => ({
183
- ...origNativeEvent,
184
- payload: features[0],
185
- }),
186
- },
187
- );
188
-
189
- onPress(newEvent);
173
+ });
190
174
  };
191
175
 
192
176
  const allProps = {
@@ -3,11 +3,11 @@ import { processColor, type NativeMethods } from "react-native";
3
3
 
4
4
  import { type BaseProps } from "../types/BaseProps";
5
5
  import {
6
- type AllLayerStyleProps,
6
+ type AllLayerStyle,
7
7
  type ExpressionField,
8
8
  type ExpressionName,
9
9
  type FilterExpression,
10
- } from "../utils/MapLibreRNStyles";
10
+ } from "../types/MapLibreRNStyles";
11
11
  import { type StyleValue, transformStyle } from "../utils/StyleValue";
12
12
  import { getFilter } from "../utils/filterUtils";
13
13
 
@@ -53,7 +53,7 @@ export interface BaseLayerProps {
53
53
  /**
54
54
  * Customizable style attributes
55
55
  */
56
- style?: AllLayerStyleProps;
56
+ style?: AllLayerStyle;
57
57
  }
58
58
 
59
59
  export interface NativeBaseProps {
@@ -10,8 +10,8 @@ export type OfflinePackStatus = {
10
10
  percentage: number;
11
11
  completedResourceCount: number;
12
12
  completedResourceSize: number;
13
- completedTileSize: number;
14
13
  completedTileCount: number;
14
+ completedTileSize: number;
15
15
  requiredResourceCount: number;
16
16
  };
17
17
 
@@ -7,7 +7,7 @@ import {
7
7
  import OfflineCreatePackOptions, {
8
8
  type OfflineCreatePackInputOptions,
9
9
  } from "./OfflineCreatePackOptions";
10
- import OfflinePack from "./OfflinePack";
10
+ import OfflinePack, { type OfflinePackStatus } from "./OfflinePack";
11
11
  import { isUndefined, isFunction, isAndroid } from "../../utils";
12
12
 
13
13
  const MapLibreRN = NativeModules.MLRNModule;
@@ -16,17 +16,6 @@ export const OfflineModuleEventEmitter = new NativeEventEmitter(
16
16
  MLRNOfflineModule,
17
17
  );
18
18
 
19
- export type OfflineProgressStatus = {
20
- name: string;
21
- state: number;
22
- percentage: number;
23
- completedResourceSize: number;
24
- completedTileCount: number;
25
- completedResourceCount: number;
26
- requiredResourceCount: number;
27
- completedTileSize: number;
28
- };
29
-
30
19
  export type OfflinePackError = {
31
20
  name: string;
32
21
  message: string;
@@ -37,13 +26,10 @@ type ErrorEvent = {
37
26
  };
38
27
 
39
28
  type ProgressEvent = {
40
- payload: OfflineProgressStatus;
29
+ payload: OfflinePackStatus;
41
30
  };
42
31
 
43
- type ProgressListener = (
44
- pack: OfflinePack,
45
- status: OfflineProgressStatus,
46
- ) => void;
32
+ type ProgressListener = (pack: OfflinePack, status: OfflinePackStatus) => void;
47
33
  type ErrorListener = (pack: OfflinePack, err: OfflinePackError) => void;
48
34
 
49
35
  /**
@@ -83,7 +69,7 @@ class OfflineManager {
83
69
  *
84
70
  * await MapLibreGL.offlineManager.createPack({
85
71
  * name: 'offlinePack',
86
- * styleURL: 'mapbox://...',
72
+ * styleURL: 'https://demotiles.maplibre.org/tiles/tiles.json',
87
73
  * minZoom: 14,
88
74
  * maxZoom: 20,
89
75
  * bounds: [[neLng, neLat], [swLng, swLat]]