@rnmapbox/maps 10.2.7 → 10.2.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (125) hide show
  1. package/android/build.gradle +9 -1
  2. package/android/src/main/java/com/rnmapbox/rnmbx/RNMBXPackage.kt +10 -0
  3. package/android/src/main/java/com/rnmapbox/rnmbx/components/location/RNMBXCustomLocationProvider.kt +7 -0
  4. package/android/src/main/java/com/rnmapbox/rnmbx/components/mapview/RNMBXMapView.kt +7 -1
  5. package/android/src/main/java/com/rnmapbox/rnmbx/components/styles/RNMBXStyleFactory.kt +180 -0
  6. package/android/src/main/java/com/rnmapbox/rnmbx/components/styles/RNMBXStyleValue.kt +4 -0
  7. package/android/src/main/java/com/rnmapbox/rnmbx/events/MapSteadyEvent.kt +50 -0
  8. package/android/src/main/java/com/rnmapbox/rnmbx/events/RNMBXCameraGestureObserver.kt +296 -0
  9. package/android/src/main/java/com/rnmapbox/rnmbx/events/RNMBXCameraGestureObserverManager.kt +74 -0
  10. package/android/src/main/java/com/rnmapbox/rnmbx/modules/RNMBXModule.kt +2 -2
  11. package/android/src/main/java/com/rnmapbox/rnmbx/modules/RNMBXOfflineModuleLegacy.kt +10 -0
  12. package/android/src/main/mapbox-v11-compat/v10/com/mapbox/maps/extension/style/layers/generated/RasterParticleLayer.kt +58 -0
  13. package/android/src/main/mapbox-v11-compat/v10/com/mapbox/maps/extension/style/sources/generated/RasterArraySource.kt +20 -0
  14. package/android/src/main/mapbox-v11-compat/v10/com/rnmapbox/rnmbx/components/styles/layers/RNMBXRasterParticleLayer.kt +22 -0
  15. package/android/src/main/mapbox-v11-compat/v10/com/rnmapbox/rnmbx/components/styles/layers/RNMBXRasterParticleLayerManager.kt +59 -0
  16. package/android/src/main/mapbox-v11-compat/v10/com/rnmapbox/rnmbx/components/styles/sources/RNMBXRasterArraySource.kt +16 -0
  17. package/android/src/main/mapbox-v11-compat/v10/com/rnmapbox/rnmbx/components/styles/sources/RNMBXRasterArraySourceManager.kt +59 -0
  18. package/android/src/main/mapbox-v11-compat/v10/com/rnmapbox/rnmbx/v11compat/StyleFactory.kt +45 -0
  19. package/android/src/main/mapbox-v11-compat/v11/com/rnmapbox/rnmbx/components/styles/layers/RNMBXRasterParticleLayer.kt +38 -0
  20. package/android/src/main/mapbox-v11-compat/v11/com/rnmapbox/rnmbx/components/styles/layers/RNMBXRasterParticleLayerManager.kt +85 -0
  21. package/android/src/main/mapbox-v11-compat/v11/com/rnmapbox/rnmbx/components/styles/sources/RNMBXRasterArraySource.kt +41 -0
  22. package/android/src/main/mapbox-v11-compat/v11/com/rnmapbox/rnmbx/components/styles/sources/RNMBXRasterArraySourceManager.kt +76 -0
  23. package/android/src/main/old-arch/com/facebook/react/viewmanagers/RNMBXCameraGestureObserverManagerDelegate.java +39 -0
  24. package/android/src/main/old-arch/com/facebook/react/viewmanagers/RNMBXCameraGestureObserverManagerInterface.java +18 -0
  25. package/android/src/main/old-arch/com/facebook/react/viewmanagers/RNMBXRasterArraySourceManagerDelegate.java +54 -0
  26. package/android/src/main/old-arch/com/facebook/react/viewmanagers/RNMBXRasterArraySourceManagerInterface.java +23 -0
  27. package/android/src/main/old-arch/com/facebook/react/viewmanagers/RNMBXRasterParticleLayerManagerDelegate.java +66 -0
  28. package/android/src/main/old-arch/com/facebook/react/viewmanagers/RNMBXRasterParticleLayerManagerInterface.java +27 -0
  29. package/ios/RNMBX/Offline/RNMBXOfflineModuleLegacy.m +2 -0
  30. package/ios/RNMBX/Offline/RNMBXOfflineModuleLegacy.swift +5 -0
  31. package/ios/RNMBX/RNMBXCamera.swift +88 -17
  32. package/ios/RNMBX/RNMBXCameraGestureObserver.swift +218 -0
  33. package/ios/RNMBX/RNMBXCameraGestureObserverComponentView.h +15 -0
  34. package/ios/RNMBX/RNMBXCameraGestureObserverComponentView.mm +119 -0
  35. package/ios/RNMBX/RNMBXCameraModule.h +3 -2
  36. package/ios/RNMBX/RNMBXCameraModule.mm +8 -16
  37. package/ios/RNMBX/RNMBXCustomLocationProvider.swift +22 -24
  38. package/ios/RNMBX/RNMBXImageModule.h +3 -2
  39. package/ios/RNMBX/RNMBXImageModule.mm +8 -16
  40. package/ios/RNMBX/RNMBXImages.swift +1 -4
  41. package/ios/RNMBX/RNMBXInteractiveElement.swift +22 -15
  42. package/ios/RNMBX/RNMBXMapView.swift +118 -12
  43. package/ios/RNMBX/RNMBXNativeUserLocation.swift +6 -6
  44. package/ios/RNMBX/RNMBXPointAnnotation.swift +6 -8
  45. package/ios/RNMBX/RNMBXPointAnnotationModule.h +3 -2
  46. package/ios/RNMBX/RNMBXPointAnnotationModule.mm +8 -16
  47. package/ios/RNMBX/RNMBXRasterArraySource.swift +47 -0
  48. package/ios/RNMBX/RNMBXRasterArraySourceComponentView.h +15 -0
  49. package/ios/RNMBX/RNMBXRasterArraySourceComponentView.mm +161 -0
  50. package/ios/RNMBX/RNMBXRasterArraySourceViewManager.swift +16 -0
  51. package/ios/RNMBX/RNMBXRasterParticleLayer.swift +100 -0
  52. package/ios/RNMBX/RNMBXRasterParticleLayerComponentView.h +15 -0
  53. package/ios/RNMBX/RNMBXRasterParticleLayerComponentView.mm +110 -0
  54. package/ios/RNMBX/RNMBXRasterParticleLayerViewManager.swift +17 -0
  55. package/ios/RNMBX/RNMBXShapeSource.swift +5 -4
  56. package/ios/RNMBX/RNMBXShapeSourceModule.h +3 -2
  57. package/ios/RNMBX/RNMBXShapeSourceModule.mm +8 -16
  58. package/ios/RNMBX/RNMBXSource.swift +51 -21
  59. package/ios/RNMBX/RNMBXStyle.swift +152 -27
  60. package/ios/RNMBX/RNMBXStyleValue.swift +27 -0
  61. package/ios/RNMBX/RNMBXViewport.swift +13 -13
  62. package/ios/RNMBX/RNMBXViewportModule.h +3 -2
  63. package/ios/RNMBX/RNMBXViewportModule.mm +8 -16
  64. package/lib/commonjs/plugin/build/withMapbox.js +1 -1
  65. package/lib/commonjs/plugin/src/withMapbox.ts +13 -3
  66. package/lib/module/Mapbox.native.js +4 -0
  67. package/lib/module/Mapbox.native.js.map +1 -1
  68. package/lib/module/RNMBXModule.js.map +1 -1
  69. package/lib/module/components/CameraGestureObserver.js +17 -0
  70. package/lib/module/components/CameraGestureObserver.js.map +1 -0
  71. package/lib/module/components/PointAnnotation.js.map +1 -1
  72. package/lib/module/components/RasterArraySource.js +67 -0
  73. package/lib/module/components/RasterArraySource.js.map +1 -0
  74. package/lib/module/components/RasterParticleLayer.js +40 -0
  75. package/lib/module/components/RasterParticleLayer.js.map +1 -0
  76. package/lib/module/modules/offline/offlineManagerLegacy.js +14 -0
  77. package/lib/module/modules/offline/offlineManagerLegacy.js.map +1 -1
  78. package/lib/module/specs/RNMBXCameraGestureObserverNativeComponent.ts +28 -0
  79. package/lib/module/specs/RNMBXRasterArraySourceNativeComponent.ts +22 -0
  80. package/lib/module/specs/RNMBXRasterParticleLayerNativeComponent.ts +39 -0
  81. package/lib/module/utils/MapboxStyles.js.map +1 -1
  82. package/lib/module/utils/styleMap.js +9 -0
  83. package/lib/module/utils/styleMap.js.map +1 -1
  84. package/lib/typescript/plugin/src/withMapbox.d.ts.map +1 -1
  85. package/lib/typescript/scripts/autogenHelpers/generateCodeWithEjs.d.mts.map +1 -1
  86. package/lib/typescript/scripts/autogenHelpers/globals.d.mts +1 -1
  87. package/lib/typescript/scripts/autogenHelpers/globals.d.mts.map +1 -1
  88. package/lib/typescript/src/Mapbox.native.d.ts +5 -1
  89. package/lib/typescript/src/Mapbox.native.d.ts.map +1 -1
  90. package/lib/typescript/src/RNMBXModule.d.ts.map +1 -1
  91. package/lib/typescript/src/components/CameraGestureObserver.d.ts +27 -0
  92. package/lib/typescript/src/components/CameraGestureObserver.d.ts.map +1 -0
  93. package/lib/typescript/src/components/PointAnnotation.d.ts +1 -1
  94. package/lib/typescript/src/components/PointAnnotation.d.ts.map +1 -1
  95. package/lib/typescript/src/components/RasterArraySource.d.ts +72 -0
  96. package/lib/typescript/src/components/RasterArraySource.d.ts.map +1 -0
  97. package/lib/typescript/src/components/RasterParticleLayer.d.ts +80 -0
  98. package/lib/typescript/src/components/RasterParticleLayer.d.ts.map +1 -0
  99. package/lib/typescript/src/modules/offline/offlineManagerLegacy.d.ts +11 -0
  100. package/lib/typescript/src/modules/offline/offlineManagerLegacy.d.ts.map +1 -1
  101. package/lib/typescript/src/specs/RNMBXCameraGestureObserverNativeComponent.d.ts +20 -0
  102. package/lib/typescript/src/specs/RNMBXCameraGestureObserverNativeComponent.d.ts.map +1 -0
  103. package/lib/typescript/src/specs/RNMBXRasterArraySourceNativeComponent.d.ts +16 -0
  104. package/lib/typescript/src/specs/RNMBXRasterArraySourceNativeComponent.d.ts.map +1 -0
  105. package/lib/typescript/src/specs/RNMBXRasterParticleLayerNativeComponent.d.ts +25 -0
  106. package/lib/typescript/src/specs/RNMBXRasterParticleLayerNativeComponent.d.ts.map +1 -0
  107. package/lib/typescript/src/utils/MapboxStyles.d.ts +44 -2
  108. package/lib/typescript/src/utils/MapboxStyles.d.ts.map +1 -1
  109. package/lib/typescript/src/utils/styleMap.d.ts.map +1 -1
  110. package/package.json +19 -2
  111. package/plugin/build/withMapbox.js +1 -1
  112. package/plugin/src/withMapbox.ts +13 -3
  113. package/rnmapbox-maps.podspec +1 -1
  114. package/src/Mapbox.native.ts +5 -0
  115. package/src/RNMBXModule.ts +1 -4
  116. package/src/components/CameraGestureObserver.tsx +37 -0
  117. package/src/components/PointAnnotation.tsx +2 -2
  118. package/src/components/RasterArraySource.tsx +134 -0
  119. package/src/components/RasterParticleLayer.tsx +117 -0
  120. package/src/modules/offline/offlineManagerLegacy.ts +14 -0
  121. package/src/specs/RNMBXCameraGestureObserverNativeComponent.ts +28 -0
  122. package/src/specs/RNMBXRasterArraySourceNativeComponent.ts +22 -0
  123. package/src/specs/RNMBXRasterParticleLayerNativeComponent.ts +39 -0
  124. package/src/utils/MapboxStyles.ts +47 -1
  125. package/src/utils/styleMap.ts +10 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rnmapbox/maps",
3
- "version": "10.2.7",
3
+ "version": "10.2.9",
4
4
  "description": "Community-supported, open-source React Native library for building maps using Mapbox native maps SDK for iOS and Android",
5
5
  "main": "./lib/module/index.js",
6
6
  "types": "./lib/typescript/src/index.native.d.ts",
@@ -11,7 +11,8 @@
11
11
  "default": "./lib/module/index.js"
12
12
  },
13
13
  "./package.json": "./package.json",
14
- "./app.plugin.js": "./app.plugin.js"
14
+ "./app.plugin.js": "./app.plugin.js",
15
+ "./setup-jest": "./setup-jest.js"
15
16
  },
16
17
  "files": [
17
18
  "src",
@@ -72,6 +73,10 @@
72
73
  "url": "https://github.com/rnmapbox/maps/issues"
73
74
  },
74
75
  "homepage": "https://github.com/rnmapbox/maps#readme",
76
+ "mapbox": {
77
+ "ios": "~> 11.16.2",
78
+ "android": "11.16.2"
79
+ },
75
80
  "publishConfig": {
76
81
  "registry": "https://registry.npmjs.org/",
77
82
  "access": "public"
@@ -196,6 +201,9 @@
196
201
  "RNMBXCallout": {
197
202
  "className": "RNMBXCalloutComponentView"
198
203
  },
204
+ "RNMBXCameraGestureObserver": {
205
+ "className": "RNMBXCameraGestureObserverComponentView"
206
+ },
199
207
  "RNMBXCamera": {
200
208
  "className": "RNMBXCameraComponentView"
201
209
  },
@@ -250,12 +258,18 @@
250
258
  "RNMBXPointAnnotation": {
251
259
  "className": "RNMBXPointAnnotationComponentView"
252
260
  },
261
+ "RNMBXRasterArraySource": {
262
+ "className": "RNMBXRasterArraySourceComponentView"
263
+ },
253
264
  "RNMBXRasterDemSource": {
254
265
  "className": "RNMBXRasterDemSourceComponentView"
255
266
  },
256
267
  "RNMBXRasterLayer": {
257
268
  "className": "RNMBXRasterLayerComponentView"
258
269
  },
270
+ "RNMBXRasterParticleLayer": {
271
+ "className": "RNMBXRasterParticleLayerComponentView"
272
+ },
259
273
  "RNMBXRasterSource": {
260
274
  "className": "RNMBXRasterSourceComponentView"
261
275
  },
@@ -285,6 +299,7 @@
285
299
  "RNMBXAtmosphere": "RNMBXAtmosphereComponentView",
286
300
  "RNMBXBackgroundLayer": "RNMBXBackgroundLayerComponentView",
287
301
  "RNMBXCallout": "RNMBXCalloutComponentView",
302
+ "RNMBXCameraGestureObserver": "RNMBXCameraGestureObserverComponentView",
288
303
  "RNMBXCamera": "RNMBXCameraComponentView",
289
304
  "RNMBXCircleLayer": "RNMBXCircleLayerComponentView",
290
305
  "RNMBXCustomLocationProvider": "RNMBXCustomLocationProviderComponentView",
@@ -303,8 +318,10 @@
303
318
  "RNMBXModels": "RNMBXModelsComponentView",
304
319
  "RNMBXNativeUserLocation": "RNMBXNativeUserLocationComponentView",
305
320
  "RNMBXPointAnnotation": "RNMBXPointAnnotationComponentView",
321
+ "RNMBXRasterArraySource": "RNMBXRasterArraySourceComponentView",
306
322
  "RNMBXRasterDemSource": "RNMBXRasterDemSourceComponentView",
307
323
  "RNMBXRasterLayer": "RNMBXRasterLayerComponentView",
324
+ "RNMBXRasterParticleLayer": "RNMBXRasterParticleLayerComponentView",
308
325
  "RNMBXRasterSource": "RNMBXRasterSourceComponentView",
309
326
  "RNMBXShapeSource": "RNMBXShapeSourceComponentView",
310
327
  "RNMBXSkyLayer": "RNMBXSkyLayerComponentView",
@@ -148,7 +148,7 @@ const withAndroidPropertiesDownloadToken = (config, { RNMapboxMapsDownloadToken
148
148
  }
149
149
  return config;
150
150
  };
151
- const withAndroidPropertiesImpl2 = (config, { RNMapboxMapsImpl, RNMapboxMapsVersion, RNMapboxMapsUseV11 } = {}) => {
151
+ const withAndroidPropertiesImpl2 = (config, { RNMapboxMapsImpl, RNMapboxMapsVersion, RNMapboxMapsUseV11, } = {}) => {
152
152
  const keyValues = {
153
153
  expoRNMapboxMapsImpl: RNMapboxMapsImpl,
154
154
  expoRNMapboxMapsVersion: RNMapboxMapsVersion,
@@ -247,7 +247,11 @@ const withAndroidPropertiesDownloadToken: ConfigPlugin<MapboxPlugProps> = (
247
247
 
248
248
  const withAndroidPropertiesImpl2: ConfigPlugin<MapboxPlugProps> = (
249
249
  config,
250
- { RNMapboxMapsImpl, RNMapboxMapsVersion, RNMapboxMapsUseV11 }: MapboxPlugProps = {},
250
+ {
251
+ RNMapboxMapsImpl,
252
+ RNMapboxMapsVersion,
253
+ RNMapboxMapsUseV11,
254
+ }: MapboxPlugProps = {},
251
255
  ) => {
252
256
  const keyValues = {
253
257
  expoRNMapboxMapsImpl: RNMapboxMapsImpl,
@@ -391,7 +395,10 @@ export const addMapboxMavenRepo = (src: string): string =>
391
395
  comment: '//',
392
396
  }).contents;
393
397
 
394
- const withAndroidAppGradle: ConfigPlugin<MapboxPlugProps> = (config, _props: MapboxPlugProps = {}) =>
398
+ const withAndroidAppGradle: ConfigPlugin<MapboxPlugProps> = (
399
+ config,
400
+ _props: MapboxPlugProps = {},
401
+ ) =>
395
402
  withAppBuildGradle(config, ({ modResults, ...exportedConfig }) => {
396
403
  if (modResults.language !== 'groovy') {
397
404
  WarningAggregator.addWarningAndroid(
@@ -407,7 +414,10 @@ const withAndroidAppGradle: ConfigPlugin<MapboxPlugProps> = (config, _props: Map
407
414
  return { modResults, ...exportedConfig };
408
415
  });
409
416
 
410
- const withAndroidProjectGradle: ConfigPlugin<MapboxPlugProps> = (config, _props: MapboxPlugProps = {}) =>
417
+ const withAndroidProjectGradle: ConfigPlugin<MapboxPlugProps> = (
418
+ config,
419
+ _props: MapboxPlugProps = {},
420
+ ) =>
411
421
  withProjectBuildGradle(config, ({ modResults, ...exportedConfig }) => {
412
422
  if (modResults.language !== 'groovy') {
413
423
  WarningAggregator.addWarningAndroid(
@@ -20,7 +20,7 @@ require 'json'
20
20
  package = JSON.parse(File.read(File.join(__dir__, 'package.json')))
21
21
 
22
22
  ## Warning: these lines are scanned by autogenerate.js
23
- rnMapboxMapsDefaultMapboxVersion = '~> 11.15.2'
23
+ rnMapboxMapsDefaultMapboxVersion = package['mapbox']['ios']
24
24
 
25
25
  rnMapboxMapsDefaultImpl = 'mapbox'
26
26
 
@@ -23,6 +23,7 @@ export { default as LocationPuck } from './components/LocationPuck';
23
23
  export { default as VectorSource } from './components/VectorSource';
24
24
  export { ShapeSource } from './components/ShapeSource';
25
25
  export { default as RasterSource } from './components/RasterSource';
26
+ export { default as RasterArraySource } from './components/RasterArraySource';
26
27
  export { default as RasterDemSource } from './components/RasterDemSource';
27
28
  export { default as ImageSource } from './components/ImageSource';
28
29
  export { Viewport } from './components/Viewport';
@@ -38,9 +39,12 @@ export { default as SkyLayer } from './components/SkyLayer';
38
39
  export { default as ModelLayer } from './components/ModelLayer';
39
40
  export { SymbolLayer } from './components/SymbolLayer';
40
41
  export { default as RasterLayer } from './components/RasterLayer';
42
+ export { default as RasterParticleLayer } from './components/RasterParticleLayer';
41
43
  export { default as BackgroundLayer } from './components/BackgroundLayer';
42
44
  export { default as CustomLocationProvider } from './components/CustomLocationProvider';
43
45
  export { Terrain } from './components/Terrain';
46
+ export { default as CameraGestureObserver } from './components/CameraGestureObserver';
47
+ export { OnMapSteadyEvent } from './specs/RNMBXCameraGestureObserverNativeComponent';
44
48
  export {
45
49
  default as locationManager,
46
50
  type Location,
@@ -76,6 +80,7 @@ export type {
76
80
  HeatmapLayerStyleProps as HeatmapLayerStyle,
77
81
  FillExtrusionLayerStyleProps as FillExtrusionLayerStyle,
78
82
  RasterLayerStyleProps as RasterLayerStyle,
83
+ RasterParticleLayerStyleProps as RasterParticleLayerStyle,
79
84
  HillshadeLayerStyleProps as HillshadeLayerStyle,
80
85
  BackgroundLayerStyleProps as BackgroundLayerStyle,
81
86
  SkyLayerStyleProps as SkyLayerStyle,
@@ -27,10 +27,7 @@ interface RNMBXModule {
27
27
  Mapbox: string;
28
28
  };
29
29
  removeCustomHeader(headerName: string): void;
30
- addCustomHeader(
31
- headerName: string,
32
- headerValue: string
33
- ): void;
30
+ addCustomHeader(headerName: string, headerValue: string): void;
34
31
  addCustomHeaderWithOptions(
35
32
  headerName: string,
36
33
  headerValue: string,
@@ -0,0 +1,37 @@
1
+ import { memo } from 'react';
2
+ import type { ViewProps } from 'react-native';
3
+ import RNMBXCameraGestureObserverNativeComponent, {
4
+ OnMapSteadyEvent,
5
+ } from '../specs/RNMBXCameraGestureObserverNativeComponent';
6
+
7
+ type Props = ViewProps & {
8
+ /**
9
+ * Time in milliseconds to wait after last camera change before emitting 'steady' event.
10
+ * Default is 200ms.
11
+ */
12
+ quietPeriodMs?: number;
13
+
14
+ /**
15
+ * Maximum time in milliseconds before emitting 'timeout' event during continuous activity.
16
+ */
17
+ maxIntervalMs?: number;
18
+
19
+ /**
20
+ * Callback when the map reaches a steady state (no active gestures or animations).
21
+ */
22
+ onMapSteady?: (event: { nativeEvent: OnMapSteadyEvent }) => void;
23
+ };
24
+
25
+ /**
26
+ * CameraGestureObserver
27
+ *
28
+ * Unified native observer optimized for onMapSteady.
29
+ */
30
+ export default memo((props: Props) => {
31
+ return (
32
+ <RNMBXCameraGestureObserverNativeComponent
33
+ {...props}
34
+ hasOnMapSteady={props.onMapSteady ? true : false}
35
+ />
36
+ );
37
+ });
@@ -206,7 +206,7 @@ class PointAnnotation extends NativeBridgeComponent(
206
206
  this._runNativeMethod('refresh', this._nativeRef, []);
207
207
  }
208
208
 
209
- _setNativeRef(nativeRef: NativePointAnnotationRef | null) {
209
+ _setNativeRef(nativeRef: NativePointAnnotationRef) {
210
210
  this._nativeRef = nativeRef;
211
211
  super._runPendingNativeMethods(nativeRef);
212
212
  }
@@ -214,7 +214,7 @@ class PointAnnotation extends NativeBridgeComponent(
214
214
  render() {
215
215
  const props = {
216
216
  ...this.props,
217
- ref: (nativeRef: NativePointAnnotationRef | null) =>
217
+ ref: (nativeRef: NativePointAnnotationRef) =>
218
218
  this._setNativeRef(nativeRef),
219
219
  id: this.props.id,
220
220
  title: this.props.title,
@@ -0,0 +1,134 @@
1
+ import React from 'react';
2
+ import { NativeModules } from 'react-native';
3
+
4
+ import { cloneReactChildrenWithProps } from '../utils';
5
+ import { BaseProps } from '../types/BaseProps';
6
+ import RNMBXRasterArraySourceNativeComponent from '../specs/RNMBXRasterArraySourceNativeComponent';
7
+
8
+ import AbstractSource from './AbstractSource';
9
+
10
+ const Mapbox = NativeModules.RNMBXModule;
11
+
12
+ const isTileTemplateUrl = (url?: string): url is string =>
13
+ !!url &&
14
+ (url.includes('{z}') || url.includes('{bbox-') || url.includes('{quadkey}'));
15
+
16
+ type Props = BaseProps & {
17
+ /**
18
+ * A string that uniquely identifies the source.
19
+ */
20
+ id: string;
21
+
22
+ /**
23
+ * The id refers to an existing source in the style. Does not create a new source.
24
+ */
25
+ existing?: boolean;
26
+
27
+ /**
28
+ * A URL to a TileJSON configuration file describing the source's contents and other metadata.
29
+ */
30
+ url?: string;
31
+
32
+ /**
33
+ * An array of tile URL templates. If multiple endpoints are specified, clients may use any combination of endpoints.
34
+ * Example: https://example.com/raster-tiles/{z}/{x}/{y}.png
35
+ */
36
+ tileUrlTemplates?: string[];
37
+
38
+ /**
39
+ * An unsigned integer that specifies the minimum zoom level at which to display tiles from the source.
40
+ * The value should be between 0 and 22, inclusive, and less than
41
+ * maxZoomLevel, if specified. The default value for this option is 0.
42
+ */
43
+ minZoomLevel?: number;
44
+
45
+ /**
46
+ * An unsigned integer that specifies the maximum zoom level at which to display tiles from the source.
47
+ * The value should be between 0 and 22, inclusive, and less than
48
+ * minZoomLevel, if specified. The default value for this option is 22.
49
+ */
50
+ maxZoomLevel?: number;
51
+
52
+ /**
53
+ * Size of the map tiles.
54
+ * Defaults to 512.
55
+ *
56
+ * @platform android
57
+ * Note: This property is not supported on iOS due to SDK limitations.
58
+ * On iOS, tileSize will be derived from the TileJSON when using url, or use the default value.
59
+ * If you need custom tile size on iOS, include it in your TileJSON response.
60
+ */
61
+ tileSize?: number;
62
+
63
+ children?: React.ReactElement | React.ReactElement[];
64
+
65
+ /**
66
+ * An array containing the longitude and latitude of the southwest and northeast corners of
67
+ * the source's bounding box in the following order: `[sw.lng, sw.lat, ne.lng, ne.lat]`.
68
+ * When this property is included in a source, no tiles outside of the given bounds are requested by Mapbox GL.
69
+ *
70
+ * @platform android
71
+ * Note: This property is not supported on iOS due to SDK limitations.
72
+ * On iOS, bounds will be derived from the TileJSON when using url.
73
+ * If you need custom bounds on iOS, include them in your TileJSON response.
74
+ */
75
+ sourceBounds?: number[];
76
+ };
77
+
78
+ type NativeProps = Props;
79
+
80
+ /**
81
+ * RasterArraySource is a map content source that supplies raster array image tiles to be shown on the map.
82
+ * This is typically used for particle animations like wind or precipitation patterns.
83
+ * The location of and metadata about the tiles are defined either by an option dictionary
84
+ * or by an external file that conforms to the TileJSON specification.
85
+ *
86
+ * @experimental This component requires Mapbox Maps SDK v11.4.0 or later
87
+ */
88
+ class RasterArraySource extends AbstractSource<Props, NativeProps> {
89
+ static defaultProps: Props = {
90
+ id: Mapbox.StyleSource.DefaultSourceID,
91
+ };
92
+
93
+ constructor(props: Props) {
94
+ super(props);
95
+ if (isTileTemplateUrl(props.url)) {
96
+ console.warn(
97
+ `RasterArraySource 'url' property contains a Tile URL Template, but is intended for a StyleJSON URL. Please migrate your RasterArraySource to use: \`tileUrlTemplates=["${props.url}"]\` instead.`,
98
+ );
99
+ }
100
+ }
101
+
102
+ render() {
103
+ let { url } = this.props;
104
+ let { tileUrlTemplates } = this.props;
105
+
106
+ // Swapping url for tileUrlTemplates to provide backward compatibility
107
+ // when RasterArraySource supported only tile url as url prop
108
+ if (isTileTemplateUrl(url)) {
109
+ tileUrlTemplates = [url];
110
+ url = undefined;
111
+ }
112
+
113
+ const props = {
114
+ ...this.props,
115
+ id: this.props.id,
116
+ existing: this.props.existing,
117
+ url,
118
+ tileUrlTemplates,
119
+ minZoomLevel: this.props.minZoomLevel,
120
+ maxZoomLevel: this.props.maxZoomLevel,
121
+ tileSize: this.props.tileSize,
122
+ };
123
+ return (
124
+ // @ts-expect-error just codegen stuff
125
+ <RNMBXRasterArraySourceNativeComponent ref={this.setNativeRef} {...props}>
126
+ {cloneReactChildrenWithProps(this.props.children, {
127
+ sourceID: this.props.id,
128
+ })}
129
+ </RNMBXRasterArraySourceNativeComponent>
130
+ );
131
+ }
132
+ }
133
+
134
+ export default RasterArraySource;
@@ -0,0 +1,117 @@
1
+ import React from 'react';
2
+ import { NativeModules } from 'react-native';
3
+
4
+ import type {
5
+ FilterExpression,
6
+ RasterParticleLayerStyleProps,
7
+ } from '../utils/MapboxStyles';
8
+ import { StyleValue } from '../utils/StyleValue';
9
+ import RNMBXRasterParticleLayerNativeComponent from '../specs/RNMBXRasterParticleLayerNativeComponent';
10
+
11
+ import AbstractLayer from './AbstractLayer';
12
+
13
+ const Mapbox = NativeModules.RNMBXModule;
14
+
15
+ // @{codepart-replace-start(LayerPropsCommon.codepart-tsx)}
16
+ type Slot = 'bottom' | 'middle' | 'top';
17
+
18
+ type LayerPropsCommon = {
19
+ /**
20
+ * A string that uniquely identifies the source in the style to which it is added.
21
+ */
22
+ id: string;
23
+
24
+ /**
25
+ * The id refers to an existing layer in the style. Does not create a new layer.
26
+ */
27
+ existing?: boolean;
28
+
29
+ /**
30
+ * The source from which to obtain the data to style.
31
+ * If the source has not yet been added to the current style, the behavior is undefined.
32
+ * Inferred from parent source only if the layer is a direct child to it.
33
+ */
34
+ sourceID?: string;
35
+
36
+ /**
37
+ * Identifier of the layer within the source identified by the sourceID property from which the receiver obtains the data to style.
38
+ */
39
+ sourceLayerID?: string;
40
+
41
+ /**
42
+ * Inserts a layer above aboveLayerID.
43
+ */
44
+ aboveLayerID?: string;
45
+
46
+ /**
47
+ * Inserts a layer below belowLayerID
48
+ */
49
+ belowLayerID?: string;
50
+
51
+ /**
52
+ * Inserts a layer at a specified index
53
+ */
54
+ layerIndex?: number;
55
+
56
+ /**
57
+ * Filter only the features in the source layer that satisfy a condition that you define
58
+ */
59
+ filter?: FilterExpression;
60
+
61
+ /**
62
+ * The minimum zoom level at which the layer gets parsed and appears.
63
+ */
64
+ minZoomLevel?: number;
65
+
66
+ /**
67
+ * The maximum zoom level at which the layer gets parsed and appears.
68
+ */
69
+ maxZoomLevel?: number;
70
+
71
+ /**
72
+ * The slot this layer is assigned to. If specified, and a slot with that name exists, it will be placed at that position in the layer order.
73
+ *
74
+ * v11 only
75
+ */
76
+ slot?: Slot;
77
+ };
78
+ // @{codepart-replace-end}
79
+
80
+ export type Props = LayerPropsCommon & {
81
+ /**
82
+ * Customizable style attributes
83
+ */
84
+ style: RasterParticleLayerStyleProps;
85
+ } & React.ComponentProps<typeof AbstractLayer>;
86
+
87
+ type NativeTypeProps = Omit<Props, 'style'> & {
88
+ reactStyle?: { [key: string]: StyleValue };
89
+ };
90
+
91
+ /**
92
+ * RasterParticleLayer renders a particle animation driven by velocity data from a raster array source.
93
+ * This is typically used to visualize wind patterns, ocean currents, or other directional flow data.
94
+ *
95
+ * @experimental This component requires Mapbox Maps SDK v11.4.0 or later
96
+ */
97
+ class RasterParticleLayer extends AbstractLayer<Props, NativeTypeProps> {
98
+ static defaultProps = {
99
+ sourceID: Mapbox.StyleSource.DefaultSourceID,
100
+ };
101
+
102
+ render() {
103
+ const props = {
104
+ ...this.baseProps,
105
+ sourceLayerID: this.props.sourceLayerID,
106
+ };
107
+ return (
108
+ // @ts-expect-error just codegen stuff
109
+ <RNMBXRasterParticleLayerNativeComponent
110
+ ref={this.setNativeLayer}
111
+ {...props}
112
+ />
113
+ );
114
+ }
115
+ }
116
+
117
+ export default RasterParticleLayer;
@@ -159,6 +159,20 @@ class OfflineManagerLegacy {
159
159
  return this._offlinePacks[name];
160
160
  }
161
161
 
162
+ /**
163
+ * Sets the maximum number of Mapbox-hosted tiles that may be downloaded and stored on the current device.
164
+ * The Mapbox Terms of Service prohibit changing or bypassing this limit without permission from Mapbox.
165
+ *
166
+ * @example
167
+ * Mapbox.offlineManagerLegacy.setTileCountLimit(1000);
168
+ *
169
+ * @param {Number} limit Map tile limit count.
170
+ * @return {void}
171
+ */
172
+ setTileCountLimit(limit: number): void {
173
+ MapboxOfflineManager.setTileCountLimit(limit);
174
+ }
175
+
162
176
  async _initialize(forceInit?: boolean): Promise<boolean> {
163
177
  if (this._hasInitialized && !forceInit) {
164
178
  return true;
@@ -0,0 +1,28 @@
1
+ import type { ViewProps } from 'react-native';
2
+ import codegenNativeComponent from 'react-native/Libraries/Utilities/codegenNativeComponent';
3
+ // @ts-ignore - CI environment type resolution issue for CodegenTypes
4
+ import { DirectEventHandler, Double, } from 'react-native/Libraries/Types/CodegenTypes';
5
+
6
+ import type { UnsafeMixed } from './codegenUtils';
7
+
8
+ export type OnMapSteadyEvent = {
9
+ reason: 'steady' | 'timeout';
10
+ // ms since last camera change when reason === 'steady'
11
+ idleDurationMs?: Double;
12
+ // e.g., 'pan' | 'pinch' | 'rotate' | 'pitch'
13
+ lastGestureType?: string | null | undefined;
14
+ // Unix epoch in milliseconds
15
+ timestamp: Double;
16
+ };
17
+
18
+ export interface NativeProps extends ViewProps {
19
+ quietPeriodMs?: UnsafeMixed<number>;
20
+ maxIntervalMs?: UnsafeMixed<number>;
21
+
22
+ hasOnMapSteady: UnsafeMixed<boolean>;
23
+ onMapSteady?: DirectEventHandler<OnMapSteadyEvent>;
24
+ }
25
+
26
+ export default codegenNativeComponent<NativeProps>(
27
+ 'RNMBXCameraGestureObserver',
28
+ );
@@ -0,0 +1,22 @@
1
+ import type { HostComponent, ViewProps } from 'react-native';
2
+ import codegenNativeComponent from 'react-native/Libraries/Utilities/codegenNativeComponent';
3
+ // @ts-ignore - CI environment type resolution issue for CodegenTypes
4
+ import { Double } from 'react-native/Libraries/Types/CodegenTypes';
5
+
6
+ import { UnsafeMixed } from './codegenUtils';
7
+
8
+ export interface NativeProps extends ViewProps {
9
+ id: UnsafeMixed<string>;
10
+ existing: UnsafeMixed<boolean>;
11
+ url: UnsafeMixed<string>;
12
+ tileUrlTemplates: UnsafeMixed<Array<string>>;
13
+ minZoomLevel: UnsafeMixed<Double>;
14
+ maxZoomLevel: UnsafeMixed<Double>;
15
+ tileSize: UnsafeMixed<Double>;
16
+ sourceBounds: UnsafeMixed<Array<number>>;
17
+ }
18
+
19
+ // @ts-ignore-error - Codegen requires single cast but TypeScript prefers double cast
20
+ export default codegenNativeComponent<NativeProps>(
21
+ 'RNMBXRasterArraySource',
22
+ ) as HostComponent<NativeProps>;
@@ -0,0 +1,39 @@
1
+ import type { HostComponent, ViewProps } from 'react-native';
2
+ import codegenNativeComponent from 'react-native/Libraries/Utilities/codegenNativeComponent';
3
+ // @ts-ignore - CI environment type resolution issue for CodegenTypes
4
+ import { Double, Int32 } from 'react-native/Libraries/Types/CodegenTypes';
5
+
6
+ import type { FilterExpression } from '../utils/MapboxStyles';
7
+
8
+ import type { UnsafeMixed } from './codegenUtils';
9
+
10
+ // @{codepart-replace-start(CommonLayerNativeComponentsProps.codepart-ts)}
11
+ // see https://github.com/rnmapbox/maps/wiki/FabricOptionalProp
12
+ type OptionalProp<T> = UnsafeMixed<T>;
13
+ type Slot = 'bottom' | 'middle' | 'top';
14
+
15
+ type CommonProps = {
16
+ sourceID?: OptionalProp<string>;
17
+ existing?: OptionalProp<boolean>;
18
+ filter?: UnsafeMixed<FilterExpression>;
19
+
20
+ aboveLayerID?: OptionalProp<string>;
21
+ belowLayerID?: OptionalProp<string>;
22
+ layerIndex?: OptionalProp<Int32>;
23
+
24
+ maxZoomLevel?: OptionalProp<Double>;
25
+ minZoomLevel?: OptionalProp<Double>;
26
+ sourceLayerID?: OptionalProp<string>;
27
+ slot?: OptionalProp<Slot>;
28
+ };
29
+ // @{codepart-replace-end}
30
+
31
+ export interface NativeProps extends ViewProps, CommonProps {
32
+ id?: OptionalProp<string>;
33
+ reactStyle: UnsafeMixed<any>;
34
+ }
35
+
36
+ // @ts-ignore-error - Codegen requires single cast but TypeScript prefers double cast
37
+ export default codegenNativeComponent<NativeProps>(
38
+ 'RNMBXRasterParticleLayer',
39
+ ) as HostComponent<NativeProps>;
@@ -125,7 +125,8 @@ type ExpressionParameters =
125
125
  | 'line-progress'
126
126
  | 'heatmap-density'
127
127
  | 'measure-light'
128
- | 'raster-value';
128
+ | 'raster-value'
129
+ | 'raster-particle-speed';
129
130
 
130
131
  type ResolvedImageType = ImageSourcePropType | string;
131
132
 
@@ -1913,6 +1914,50 @@ export interface RasterLayerStyleProps {
1913
1914
  */
1914
1915
  rasterElevationTransition?: Transition;
1915
1916
  }
1917
+ export interface RasterParticleLayerStyleProps {
1918
+ /**
1919
+ * Whether this layer is displayed.
1920
+ */
1921
+ visibility?: Value<Enum<VisibilityEnum, VisibilityEnumValues>>;
1922
+ /**
1923
+ * Displayed band of raster array source layer
1924
+ */
1925
+ rasterParticleArrayBand?: string;
1926
+ /**
1927
+ * Defines the amount of particles per tile.
1928
+ */
1929
+ rasterParticleCount?: number;
1930
+ /**
1931
+ * Defines a color map by which to colorize a raster particle layer, parameterized by the `["rasterParticleSpeed"]` expression and evaluated at 256 uniformly spaced steps over the range specified by `rasterParticleMaxSpeed`.
1932
+ */
1933
+ rasterParticleColor?: Value<string, ['raster-particle-speed']>;
1934
+ /**
1935
+ * Defines the maximum speed for particles. Velocities with magnitudes equal to or exceeding this value are clamped to the max value.
1936
+ */
1937
+ rasterParticleMaxSpeed?: number;
1938
+ /**
1939
+ * Defines a coefficient for the speed of particles’ motion.
1940
+ */
1941
+ rasterParticleSpeedFactor?: Value<number, ['zoom']>;
1942
+
1943
+ /**
1944
+ * The transition affecting any changes to this layer’s rasterParticleSpeedFactor property.
1945
+ */
1946
+ rasterParticleSpeedFactorTransition?: Transition;
1947
+ /**
1948
+ * Defines defines the opacity coefficient applied to the faded particles in each frame. In practice, this property controls the length of the particle tail.
1949
+ */
1950
+ rasterParticleFadeOpacityFactor?: Value<number, ['zoom']>;
1951
+
1952
+ /**
1953
+ * The transition affecting any changes to this layer’s rasterParticleFadeOpacityFactor property.
1954
+ */
1955
+ rasterParticleFadeOpacityFactorTransition?: Transition;
1956
+ /**
1957
+ * Defines a coefficient for a time period at which particles will restart at a random position, to avoid degeneration (empty areas without particles).
1958
+ */
1959
+ rasterParticleResetRateFactor?: number;
1960
+ }
1916
1961
  export interface HillshadeLayerStyleProps {
1917
1962
  /**
1918
1963
  * Whether this layer is displayed.
@@ -2307,6 +2352,7 @@ export type AllLayerStyleProps =
2307
2352
  | HeatmapLayerStyleProps
2308
2353
  | FillExtrusionLayerStyleProps
2309
2354
  | RasterLayerStyleProps
2355
+ | RasterParticleLayerStyleProps
2310
2356
  | HillshadeLayerStyleProps
2311
2357
  | ModelLayerStyleProps
2312
2358
  | BackgroundLayerStyleProps