@rnmapbox/maps 10.3.0-rc.0 → 10.3.1

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 (115) hide show
  1. package/android/src/main/java/com/rnmapbox/rnmbx/RNMBXPackage.kt +4 -0
  2. package/android/src/main/java/com/rnmapbox/rnmbx/components/annotation/RNMBXMarkerViewContent.kt +55 -0
  3. package/android/src/main/java/com/rnmapbox/rnmbx/components/annotation/RNMBXMarkerViewContentManager.kt +7 -2
  4. package/android/src/main/java/com/rnmapbox/rnmbx/components/annotation/RNMBXMarkerViewManager.kt +0 -2
  5. package/android/src/main/java/com/rnmapbox/rnmbx/components/location/RNMBXNativeUserLocationManager.kt +25 -24
  6. package/android/src/main/java/com/rnmapbox/rnmbx/components/mapview/NativeMapViewModule.kt +3 -2
  7. package/android/src/main/java/com/rnmapbox/rnmbx/components/mapview/RNMBXMapView.kt +57 -39
  8. package/android/src/main/java/com/rnmapbox/rnmbx/components/mapview/RNMBXMapViewManager.kt +0 -9
  9. package/android/src/main/java/com/rnmapbox/rnmbx/components/styles/RNMBXStyleFactory.kt +638 -0
  10. package/android/src/main/java/com/rnmapbox/rnmbx/components/styles/atmosphere/RNMBXAtmosphere.kt +4 -4
  11. package/android/src/main/java/com/rnmapbox/rnmbx/components/styles/atmosphere/RNMBXAtmosphereManager.kt +2 -1
  12. package/android/src/main/java/com/rnmapbox/rnmbx/components/styles/light/RNMBXLightManager.kt +2 -1
  13. package/android/src/main/java/com/rnmapbox/rnmbx/components/styles/rain/RNMBXRain.kt +83 -0
  14. package/android/src/main/java/com/rnmapbox/rnmbx/components/styles/rain/RNMBXRainManager.kt +40 -0
  15. package/android/src/main/java/com/rnmapbox/rnmbx/components/styles/snow/RNMBXSnow.kt +66 -0
  16. package/android/src/main/java/com/rnmapbox/rnmbx/components/styles/snow/RNMBXSnowManager.kt +40 -0
  17. package/android/src/main/java/com/rnmapbox/rnmbx/components/styles/sources/RNMBXSource.kt +2 -6
  18. package/android/src/main/java/com/rnmapbox/rnmbx/components/styles/terrain/RNMBXTerrainManager.kt +2 -1
  19. package/android/src/main/java/com/rnmapbox/rnmbx/events/FeatureClickEvent.java +5 -6
  20. package/android/src/main/java/com/rnmapbox/rnmbx/modules/RNMBXModule.kt +1 -0
  21. package/android/src/main/java/com/rnmapbox/rnmbx/utils/ConvertUtils.kt +0 -30
  22. package/android/src/main/java/com/rnmapbox/rnmbx/utils/extensions/Dynamic.kt +3 -1
  23. package/android/src/main/java/com/rnmapbox/rnmbx/utils/extensions/ReadableArray.kt +16 -14
  24. package/ios/RNMBX/RNMBXAtmosphereComponentView.mm +2 -1
  25. package/ios/RNMBX/RNMBXBackgroundLayerComponentView.mm +2 -1
  26. package/ios/RNMBX/RNMBXBridgeManager.h +8 -0
  27. package/ios/RNMBX/RNMBXBridgeManager.m +16 -0
  28. package/ios/RNMBX/RNMBXCircleLayerComponentView.mm +2 -1
  29. package/ios/RNMBX/RNMBXFillExtrusionLayerComponentView.mm +2 -1
  30. package/ios/RNMBX/RNMBXFillLayerComponentView.mm +2 -1
  31. package/ios/RNMBX/RNMBXHeatmapLayerComponentView.mm +2 -1
  32. package/ios/RNMBX/RNMBXHillshadeLayerComponentView.mm +2 -1
  33. package/ios/RNMBX/RNMBXImageModule.h +1 -0
  34. package/ios/RNMBX/RNMBXImageModule.mm +15 -2
  35. package/ios/RNMBX/RNMBXImageQueue.swift +9 -1
  36. package/ios/RNMBX/RNMBXImages.swift +4 -0
  37. package/ios/RNMBX/RNMBXImagesComponentView.mm +2 -1
  38. package/ios/RNMBX/RNMBXLightComponentView.mm +2 -1
  39. package/ios/RNMBX/RNMBXLineLayerComponentView.mm +2 -1
  40. package/ios/RNMBX/RNMBXMapViewModule.mm +1 -1
  41. package/ios/RNMBX/RNMBXModelLayerComponentView.mm +2 -1
  42. package/ios/RNMBX/RNMBXModule.swift +1 -0
  43. package/ios/RNMBX/RNMBXRain.swift +92 -0
  44. package/ios/RNMBX/RNMBXRainComponentView.h +14 -0
  45. package/ios/RNMBX/RNMBXRainComponentView.mm +80 -0
  46. package/ios/RNMBX/RNMBXRasterLayerComponentView.mm +2 -1
  47. package/ios/RNMBX/RNMBXRasterParticleLayerComponentView.mm +2 -1
  48. package/ios/RNMBX/RNMBXSkyLayerComponentView.mm +2 -1
  49. package/ios/RNMBX/RNMBXSnow.swift +76 -0
  50. package/ios/RNMBX/RNMBXSnowComponentView.h +14 -0
  51. package/ios/RNMBX/RNMBXSnowComponentView.mm +80 -0
  52. package/ios/RNMBX/RNMBXStyle.swift +415 -9
  53. package/ios/RNMBX/RNMBXStyleValue.swift +7 -1
  54. package/ios/RNMBX/RNMBXSymbolLayerComponentView.mm +2 -1
  55. package/ios/RNMBX/RNMBXTerrainComponentView.mm +2 -1
  56. package/lib/commonjs/plugin/install.md +2 -2
  57. package/lib/module/Mapbox.native.js +2 -0
  58. package/lib/module/Mapbox.native.js.map +1 -1
  59. package/lib/module/components/MapView.js +95 -113
  60. package/lib/module/components/MapView.js.map +1 -1
  61. package/lib/module/components/MarkerView.js +93 -76
  62. package/lib/module/components/MarkerView.js.map +1 -1
  63. package/lib/module/components/Rain.js +19 -0
  64. package/lib/module/components/Rain.js.map +1 -0
  65. package/lib/module/components/Snow.js +19 -0
  66. package/lib/module/components/Snow.js.map +1 -0
  67. package/lib/module/modules/offline/offlineManager.js +2 -12
  68. package/lib/module/modules/offline/offlineManager.js.map +1 -1
  69. package/lib/module/specs/RNMBXMarkerViewContentNativeComponent.ts +13 -1
  70. package/lib/module/specs/RNMBXRainNativeComponent.ts +13 -0
  71. package/lib/module/specs/RNMBXSnowNativeComponent.ts +13 -0
  72. package/lib/module/utils/styleMap.js +20 -0
  73. package/lib/module/utils/styleMap.js.map +1 -1
  74. package/lib/typescript/scripts/autogenHelpers/generateCodeWithEjs.d.mts +71 -2
  75. package/lib/typescript/scripts/autogenHelpers/generateCodeWithEjs.d.mts.map +1 -1
  76. package/lib/typescript/scripts/autogenHelpers/globals.d.mts +1 -1
  77. package/lib/typescript/scripts/autogenHelpers/globals.d.mts.map +1 -1
  78. package/lib/typescript/src/Mapbox.native.d.ts +3 -1
  79. package/lib/typescript/src/Mapbox.native.d.ts.map +1 -1
  80. package/lib/typescript/src/components/Callout.d.ts +3 -3
  81. package/lib/typescript/src/components/Camera.d.ts +2 -2
  82. package/lib/typescript/src/components/Camera.d.ts.map +1 -1
  83. package/lib/typescript/src/components/MapView.d.ts +53 -41
  84. package/lib/typescript/src/components/MapView.d.ts.map +1 -1
  85. package/lib/typescript/src/components/MarkerView.d.ts +10 -17
  86. package/lib/typescript/src/components/MarkerView.d.ts.map +1 -1
  87. package/lib/typescript/src/components/Rain.d.ts +17 -0
  88. package/lib/typescript/src/components/Rain.d.ts.map +1 -0
  89. package/lib/typescript/src/components/Snow.d.ts +8 -0
  90. package/lib/typescript/src/components/Snow.d.ts.map +1 -0
  91. package/lib/typescript/src/modules/offline/offlineManager.d.ts.map +1 -1
  92. package/lib/typescript/src/specs/RNMBXMarkerViewContentNativeComponent.d.ts +6 -0
  93. package/lib/typescript/src/specs/RNMBXMarkerViewContentNativeComponent.d.ts.map +1 -1
  94. package/lib/typescript/src/specs/RNMBXRainNativeComponent.d.ts +8 -0
  95. package/lib/typescript/src/specs/RNMBXRainNativeComponent.d.ts.map +1 -0
  96. package/lib/typescript/src/specs/RNMBXSnowNativeComponent.d.ts +8 -0
  97. package/lib/typescript/src/specs/RNMBXSnowNativeComponent.d.ts.map +1 -0
  98. package/lib/typescript/src/utils/MapboxStyles.d.ts +171 -1
  99. package/lib/typescript/src/utils/MapboxStyles.d.ts.map +1 -1
  100. package/lib/typescript/src/utils/styleMap.d.ts.map +1 -1
  101. package/package.json +12 -3
  102. package/plugin/install.md +2 -2
  103. package/setup-jest.js +1 -1
  104. package/src/Mapbox.native.ts +7 -1
  105. package/src/components/Camera.tsx +2 -2
  106. package/src/components/MapView.tsx +137 -154
  107. package/src/components/MarkerView.tsx +118 -95
  108. package/src/components/Rain.tsx +31 -0
  109. package/src/components/Snow.tsx +22 -0
  110. package/src/modules/offline/offlineManager.ts +2 -14
  111. package/src/specs/RNMBXMarkerViewContentNativeComponent.ts +13 -1
  112. package/src/specs/RNMBXRainNativeComponent.ts +13 -0
  113. package/src/specs/RNMBXSnowNativeComponent.ts +13 -0
  114. package/src/utils/MapboxStyles.ts +191 -0
  115. package/src/utils/styleMap.ts +22 -0
@@ -1,15 +1,19 @@
1
- import React from 'react';
2
- import { NativeModules, Platform, type ViewProps } from 'react-native';
1
+ import React, { useCallback, useMemo, useRef, useState } from 'react';
2
+ import {
3
+ PixelRatio,
4
+ StyleSheet,
5
+ type NativeSyntheticEvent,
6
+ type ViewProps,
7
+ } from 'react-native';
3
8
 
4
9
  import RNMBXMakerViewContentComponent from '../specs/RNMBXMarkerViewContentNativeComponent';
5
10
  import NativeMarkerViewComponent from '../specs/RNMBXMarkerViewNativeComponent';
6
11
  import { type Position } from '../types/Position';
7
- import { toJSONString } from '../utils';
8
- import { makePoint } from '../utils/geoUtils';
9
12
 
10
- import PointAnnotation from './PointAnnotation';
13
+ // Device pixel ratio is constant for the lifetime of the app.
14
+ const PIXEL_RATIO = PixelRatio.get();
11
15
 
12
- const Mapbox = NativeModules.RNMBXModule;
16
+ const DEFAULT_ANCHOR = { x: 0.5, y: 0.5 };
13
17
 
14
18
  type Props = ViewProps & {
15
19
  /**
@@ -21,29 +25,28 @@ type Props = ViewProps & {
21
25
  * Any coordinate between (0, 0) and (1, 1), where (0, 0) is the top-left corner of
22
26
  * the view, and (1, 1) is the bottom-right corner. Defaults to the center at (0.5, 0.5).
23
27
  */
24
- anchor: {
28
+ anchor?: {
25
29
  x: number;
26
30
  y: number;
27
31
  };
28
32
 
29
33
  /**
30
- * @v10
31
- *
32
34
  * Whether or not nearby markers on the map should all be displayed. If false, adjacent
33
35
  * markers will 'collapse' and only one will be shown. Defaults to false.
34
36
  */
35
- allowOverlap: boolean;
37
+ allowOverlap?: boolean;
36
38
 
37
39
  /**
38
40
  * Whether or not nearby markers on the map should be hidden if close to a
39
41
  * UserLocation puck. Defaults to false.
40
42
  */
41
- allowOverlapWithPuck: boolean;
43
+ allowOverlapWithPuck?: boolean;
42
44
 
43
- isSelected: boolean;
45
+ isSelected?: boolean;
44
46
 
45
47
  /**
46
- * One or more valid React Native views.
48
+ * One or more valid React Native views. You can use Pressable, TouchableOpacity,
49
+ * etc. directly as children — onPress and touch feedback work correctly.
47
50
  */
48
51
  children: React.ReactElement;
49
52
  };
@@ -58,93 +61,113 @@ type Props = ViewProps & {
58
61
  * This is implemented with view annotations on [Android](https://docs.mapbox.com/android/maps/guides/annotations/view-annotations/)
59
62
  * and [iOS](https://docs.mapbox.com/ios/maps/guides/annotations/view-annotations).
60
63
  *
61
- * This component has no dedicated `onPress` method. Instead, you should handle gestures
62
- * with the React views passed in as `children`.
64
+ * This component has no dedicated `onPress` method. Instead, handle gestures
65
+ * with the React views passed in as `children` — Pressable, TouchableOpacity,
66
+ * etc. all work including their visual feedback (opacity, scale, etc.).
63
67
  */
64
- class MarkerView extends React.PureComponent<Props> {
65
- static defaultProps: Partial<Props> = {
66
- anchor: { x: 0.5, y: 0.5 },
67
- allowOverlap: false,
68
- allowOverlapWithPuck: false,
69
- isSelected: false,
70
- };
71
-
72
- static lastId = 0;
73
- __idForPointAnnotation?: string;
74
-
75
- _idForPointAnnotation(): string {
76
- if (this.__idForPointAnnotation === undefined) {
77
- MarkerView.lastId = MarkerView.lastId + 1;
78
- this.__idForPointAnnotation = `MV-${MarkerView.lastId}`;
79
- }
80
- return this.__idForPointAnnotation;
81
- }
82
-
83
- _getCoordinate(coordinate: Position): string | undefined {
84
- if (!coordinate) {
85
- return undefined;
86
- }
87
- return toJSONString(makePoint(coordinate));
68
+ const MarkerView = ({
69
+ anchor = DEFAULT_ANCHOR,
70
+ allowOverlap = false,
71
+ allowOverlapWithPuck = false,
72
+ isSelected = false,
73
+ coordinate,
74
+ style,
75
+ children,
76
+ }: Props) => {
77
+ // Android new-arch (Fabric) fix: UIManager.measure reads from the Fabric shadow
78
+ // tree, which doesn't include Mapbox's native setTranslationX/Y positioning.
79
+ // Strategy: intercept setTranslationX/Y on the native side (see
80
+ // RNMBXMarkerViewContent.kt), relay the values as an onAnnotationPosition event,
81
+ // then apply them as a React `transform` on RNMBXMarkerView so the shadow tree
82
+ // reflects the actual on-screen position. This makes
83
+ // Pressability._responderRegion correct and onPress / touch feedback work.
84
+ //
85
+ // Key details:
86
+ // • position:'absolute' on RNMBXMarkerView → all markers have Yoga pos (0,0)
87
+ // in MapView, so the only shadow-tree offset is the transform itself.
88
+ // • Transform goes on RNMBXMarkerView (not RNMBXMarkerViewContent) so Fabric
89
+ // never fights Mapbox's native positioning.
90
+ // • PIXEL_RATIO: Android translationX/Y is in device pixels; React transform
91
+ // expects logical pixels (points).
92
+ const [annotationTranslate, setAnnotationTranslate] = useState<{
93
+ x: number;
94
+ y: number;
95
+ } | null>(null);
96
+
97
+ // Mirror of Kotlin-side dedup: skip setState when position hasn't changed so
98
+ // we don't trigger a re-render for no-op native position re-applications.
99
+ const lastTranslateRef = useRef<{ x: number; y: number } | null>(null);
100
+
101
+ const handleTouchEnd = useCallback((e: { stopPropagation: () => void }) => {
102
+ e.stopPropagation();
103
+ }, []);
104
+
105
+ const handleAnnotationPosition = useCallback(
106
+ (e: NativeSyntheticEvent<{ x: number; y: number }>) => {
107
+ const x = e.nativeEvent.x / PIXEL_RATIO;
108
+ const y = e.nativeEvent.y / PIXEL_RATIO;
109
+ const last = lastTranslateRef.current;
110
+ if (last !== null && last.x === x && last.y === y) return;
111
+ lastTranslateRef.current = { x, y };
112
+ setAnnotationTranslate({ x, y });
113
+ },
114
+ [],
115
+ );
116
+
117
+ if (anchor.x < 0 || anchor.y < 0 || anchor.x > 1 || anchor.y > 1) {
118
+ console.warn(
119
+ `[MarkerView] Anchor with value (${anchor.x}, ${anchor.y}) should not be outside the range [(0, 0), (1, 1)]`,
120
+ );
88
121
  }
89
122
 
90
- render() {
91
- if (
92
- this.props.anchor.x < 0 ||
93
- this.props.anchor.y < 0 ||
94
- this.props.anchor.x > 1 ||
95
- this.props.anchor.y > 1
96
- ) {
97
- console.warn(
98
- `[MarkerView] Anchor with value (${this.props.anchor.x}, ${this.props.anchor.y}) should not be outside the range [(0, 0), (1, 1)]`,
99
- );
100
- }
101
-
102
- if (Platform.OS === 'ios' && !Mapbox.MapboxV10) {
103
- return (
104
- <PointAnnotation id={this._idForPointAnnotation()} {...this.props} />
105
- );
106
- }
107
-
108
- const { anchor = { x: 0.5, y: 0.5 } } = this.props;
109
-
110
- return (
111
- <RNMBXMarkerView
112
- style={[
113
- {
114
- flex: 0,
115
- alignSelf: 'flex-start',
116
- },
117
- this.props.style,
118
- ]}
119
- coordinate={[
120
- Number(this.props.coordinate[0]),
121
- Number(this.props.coordinate[1]),
122
- ]}
123
- anchor={anchor}
124
- allowOverlap={this.props.allowOverlap}
125
- allowOverlapWithPuck={this.props.allowOverlapWithPuck}
126
- isSelected={this.props.isSelected}
127
- onTouchEnd={(e) => {
128
- e.stopPropagation();
129
- }}
123
+ const nativeCoordinate = useMemo(
124
+ () => [Number(coordinate[0]), Number(coordinate[1])] as [number, number],
125
+ // eslint-disable-next-line react-hooks/exhaustive-deps
126
+ [coordinate[0], coordinate[1]],
127
+ );
128
+
129
+ const nativeStyle = useMemo(
130
+ () => [
131
+ styles.absolutePosition,
132
+ style,
133
+ annotationTranslate != null
134
+ ? {
135
+ transform: [
136
+ { translateX: annotationTranslate.x },
137
+ { translateY: annotationTranslate.y },
138
+ ],
139
+ }
140
+ : undefined,
141
+ ],
142
+ [style, annotationTranslate],
143
+ );
144
+
145
+ return (
146
+ <RNMBXMarkerView
147
+ style={nativeStyle}
148
+ coordinate={nativeCoordinate}
149
+ anchor={anchor}
150
+ allowOverlap={allowOverlap}
151
+ allowOverlapWithPuck={allowOverlapWithPuck}
152
+ isSelected={isSelected}
153
+ onTouchEnd={handleTouchEnd}
154
+ >
155
+ <RNMBXMakerViewContentComponent
156
+ collapsable={false}
157
+ style={styles.contentContainer}
158
+ onAnnotationPosition={handleAnnotationPosition}
130
159
  >
131
- <RNMBXMakerViewContentComponent
132
- collapsable={false}
133
- style={{ flex: 0, alignSelf: 'flex-start' }}
134
- onStartShouldSetResponder={(_event) => {
135
- return true;
136
- }}
137
- onTouchEnd={(e) => {
138
- e.stopPropagation();
139
- }}
140
- >
141
- {this.props.children}
142
- </RNMBXMakerViewContentComponent>
143
- </RNMBXMarkerView>
144
- );
145
- }
146
- }
160
+ {children}
161
+ </RNMBXMakerViewContentComponent>
162
+ </RNMBXMarkerView>
163
+ );
164
+ };
147
165
 
148
166
  const RNMBXMarkerView = NativeMarkerViewComponent;
149
167
 
168
+ const styles = StyleSheet.create({
169
+ absolutePosition: { position: 'absolute' },
170
+ contentContainer: { flex: 0, alignSelf: 'flex-start' },
171
+ });
172
+
150
173
  export default MarkerView;
@@ -0,0 +1,31 @@
1
+ import { memo, useMemo } from 'react';
2
+
3
+ import type { RainLayerStyleProps } from '../utils/MapboxStyles';
4
+ import { transformStyle } from '../utils/StyleValue';
5
+ import type { BaseProps } from '../types/BaseProps';
6
+ import RNMBXRainNativeComponent from '../specs/RNMBXRainNativeComponent';
7
+
8
+ type Props = BaseProps & {
9
+ /** Rain particle effect style properties.
10
+ *
11
+ * @note The default `color` and `vignetteColor` values use `measure-light("brightness")`
12
+ * expressions that are only available in Mapbox Standard-based styles
13
+ * (`mapbox://styles/mapbox/standard`, `mapbox://styles/mapbox/standard-satellite`).
14
+ * When using legacy or custom styles, set `color` and `vignetteColor` explicitly to
15
+ * avoid "Brightness is unavailable in the current evaluation context" warnings and
16
+ * invisible rain. For example: `color="#a8adbc" vignetteColor="#464646"`.
17
+ */
18
+ style?: RainLayerStyleProps;
19
+ };
20
+
21
+ export const Rain = memo((props: Props) => {
22
+ const baseProps = useMemo(() => {
23
+ return {
24
+ ...props,
25
+ reactStyle: transformStyle(props.style),
26
+ style: undefined,
27
+ };
28
+ }, [props]);
29
+
30
+ return <RNMBXRainNativeComponent {...baseProps} />;
31
+ });
@@ -0,0 +1,22 @@
1
+ import { memo, useMemo } from 'react';
2
+
3
+ import type { SnowLayerStyleProps } from '../utils/MapboxStyles';
4
+ import { transformStyle } from '../utils/StyleValue';
5
+ import type { BaseProps } from '../types/BaseProps';
6
+ import RNMBXSnowNativeComponent from '../specs/RNMBXSnowNativeComponent';
7
+
8
+ type Props = BaseProps & {
9
+ style?: SnowLayerStyleProps;
10
+ };
11
+
12
+ export const Snow = memo((props: Props) => {
13
+ const baseProps = useMemo(() => {
14
+ return {
15
+ ...props,
16
+ reactStyle: transformStyle(props.style),
17
+ style: undefined,
18
+ };
19
+ }, [props]);
20
+
21
+ return <RNMBXSnowNativeComponent {...baseProps} />;
22
+ });
@@ -182,14 +182,7 @@ class OfflineManager {
182
182
  * @return {void}
183
183
  */
184
184
  async invalidateAmbientCache(): Promise<void> {
185
- if (RNMBXModule.MapboxV10) {
186
- console.warn(
187
- 'RNMapbox: invalidateAmbientCache is not implemented on v10',
188
- );
189
- return;
190
- }
191
- await this._initialize();
192
- await MapboxOfflineManager.invalidateAmbientCache();
185
+ console.warn('RNMapbox: invalidateAmbientCache is not implemented on v10');
193
186
  }
194
187
 
195
188
  /**
@@ -204,12 +197,7 @@ class OfflineManager {
204
197
  * @return {void}
205
198
  */
206
199
  async clearAmbientCache(): Promise<void> {
207
- if (RNMBXModule.MapboxV10) {
208
- console.warn('RNMapbox: clearAmbientCache is not implemented on v10');
209
- return;
210
- }
211
- await this._initialize();
212
- await MapboxOfflineManager.clearAmbientCache();
200
+ console.warn('RNMapbox: clearAmbientCache is not implemented on v10');
213
201
  }
214
202
 
215
203
  /**
@@ -1,7 +1,19 @@
1
1
  import type { HostComponent, ViewProps } from 'react-native';
2
2
  import codegenNativeComponent from 'react-native/Libraries/Utilities/codegenNativeComponent';
3
+ // @ts-ignore - CI environment type resolution issue for CodegenTypes
4
+ import { DirectEventHandler, Float } from 'react-native/Libraries/Types/CodegenTypes';
3
5
 
4
- export interface NativeProps extends ViewProps {}
6
+ type OnAnnotationPositionEvent = {
7
+ x: Float;
8
+ y: Float;
9
+ };
10
+
11
+ export interface NativeProps extends ViewProps {
12
+ // Fired by native when Mapbox repositions the annotation via setTranslationX/Y.
13
+ // JS uses this to keep the Fabric shadow tree transform in sync so that
14
+ // UIManager.measure returns the correct on-screen position for Pressable hit-testing.
15
+ onAnnotationPosition?: DirectEventHandler<OnAnnotationPositionEvent>;
16
+ }
5
17
 
6
18
  // @ts-ignore-error - Codegen requires single cast but TypeScript prefers double cast
7
19
  export default codegenNativeComponent<NativeProps>(
@@ -0,0 +1,13 @@
1
+ import type { HostComponent, ViewProps } from 'react-native';
2
+ import codegenNativeComponent from 'react-native/Libraries/Utilities/codegenNativeComponent';
3
+
4
+ import type { UnsafeMixed } from './codegenUtils';
5
+
6
+ export interface NativeProps extends ViewProps {
7
+ reactStyle: UnsafeMixed<any>;
8
+ }
9
+
10
+ // @ts-ignore-error - Codegen requires single cast but TypeScript prefers double cast
11
+ export default codegenNativeComponent<NativeProps>(
12
+ 'RNMBXRain',
13
+ ) as HostComponent<NativeProps>;
@@ -0,0 +1,13 @@
1
+ import type { HostComponent, ViewProps } from 'react-native';
2
+ import codegenNativeComponent from 'react-native/Libraries/Utilities/codegenNativeComponent';
3
+
4
+ import type { UnsafeMixed } from './codegenUtils';
5
+
6
+ export interface NativeProps extends ViewProps {
7
+ reactStyle: UnsafeMixed<any>;
8
+ }
9
+
10
+ // @ts-ignore-error - Codegen requires single cast but TypeScript prefers double cast
11
+ export default codegenNativeComponent<NativeProps>(
12
+ 'RNMBXSnow',
13
+ ) as HostComponent<NativeProps>;
@@ -767,6 +767,20 @@ export interface LineLayerStyleProps {
767
767
  * @requires lineZOffset
768
768
  */
769
769
  lineCrossSlope?: Value<number>;
770
+ /**
771
+ * Controls how much the elevation of lines with `lineElevationReference` set to `sea` scales with terrain exaggeration. A value of 0 keeps the line at a fixed altitude above sea level. A value of 1 scales the elevation proportionally with terrain exaggeration.
772
+ *
773
+ * @requires lineZOffset
774
+ */
775
+ lineElevationGroundScale?: Value<
776
+ number,
777
+ ['zoom', 'feature', 'line-progress']
778
+ >;
779
+
780
+ /**
781
+ * The transition affecting any changes to this layer’s lineElevationGroundScale property.
782
+ */
783
+ lineElevationGroundScaleTransition?: Transition;
770
784
  /**
771
785
  * Controls the transition progress between the image variants of linePattern. Zero means the first variant is used, one is the second, and in between they are blended together. Both images should be the same size and have the same type (either raster or vector).
772
786
  *
@@ -2365,6 +2379,181 @@ export interface AtmosphereLayerStyleProps {
2365
2379
  */
2366
2380
  verticalRangeTransition?: Transition;
2367
2381
  }
2382
+ export interface SnowLayerStyleProps {
2383
+ /**
2384
+ * Snow particles density. Controls the overall particles number.
2385
+ */
2386
+ density?: Value<number, ['zoom', 'measure-light']>;
2387
+
2388
+ /**
2389
+ * The transition affecting any changes to this layer’s density property.
2390
+ */
2391
+ densityTransition?: Transition;
2392
+ /**
2393
+ * Snow particles movement factor. Controls the overall particles movement speed.
2394
+ */
2395
+ intensity?: Value<number, ['zoom', 'measure-light']>;
2396
+
2397
+ /**
2398
+ * The transition affecting any changes to this layer’s intensity property.
2399
+ */
2400
+ intensityTransition?: Transition;
2401
+ /**
2402
+ * Snow particles color.
2403
+ */
2404
+ color?: Value<string, ['zoom', 'measure-light']>;
2405
+
2406
+ /**
2407
+ * The transition affecting any changes to this layer’s color property.
2408
+ */
2409
+ colorTransition?: Transition;
2410
+ /**
2411
+ * Snow particles opacity.
2412
+ */
2413
+ opacity?: Value<number, ['zoom', 'measure-light']>;
2414
+
2415
+ /**
2416
+ * The transition affecting any changes to this layer’s opacity property.
2417
+ */
2418
+ opacityTransition?: Transition;
2419
+ /**
2420
+ * Snow vignette screenSpace effect. Adds snow tint to screen corners
2421
+ */
2422
+ vignette?: Value<number, ['zoom', 'measure-light']>;
2423
+
2424
+ /**
2425
+ * The transition affecting any changes to this layer’s vignette property.
2426
+ */
2427
+ vignetteTransition?: Transition;
2428
+ /**
2429
+ * Snow vignette screenSpace corners tint color.
2430
+ */
2431
+ vignetteColor?: Value<string, ['zoom', 'measure-light']>;
2432
+
2433
+ /**
2434
+ * The transition affecting any changes to this layer’s vignetteColor property.
2435
+ */
2436
+ vignetteColorTransition?: Transition;
2437
+ /**
2438
+ * Thinning factor of snow particles from center. 0 no thinning. 1 maximal central area thinning.
2439
+ */
2440
+ centerThinning?: Value<number, ['zoom', 'measure-light']>;
2441
+
2442
+ /**
2443
+ * The transition affecting any changes to this layer’s centerThinning property.
2444
+ */
2445
+ centerThinningTransition?: Transition;
2446
+ /**
2447
+ * Main snow particles direction. Azimuth and polar angles
2448
+ */
2449
+ direction?: Value<number[], ['zoom', 'measure-light']>;
2450
+
2451
+ /**
2452
+ * The transition affecting any changes to this layer’s direction property.
2453
+ */
2454
+ directionTransition?: Transition;
2455
+ /**
2456
+ * Snow flake particle size. Correlates with individual particle screen size
2457
+ */
2458
+ flakeSize?: Value<number, ['zoom', 'measure-light']>;
2459
+
2460
+ /**
2461
+ * The transition affecting any changes to this layer’s flakeSize property.
2462
+ */
2463
+ flakeSizeTransition?: Transition;
2464
+ }
2465
+ export interface RainLayerStyleProps {
2466
+ /**
2467
+ * Rain particles density. Controls the overall screen density of the rain.
2468
+ */
2469
+ density?: Value<number, ['zoom', 'measure-light']>;
2470
+
2471
+ /**
2472
+ * The transition affecting any changes to this layer’s density property.
2473
+ */
2474
+ densityTransition?: Transition;
2475
+ /**
2476
+ * Rain particles movement factor. Controls the overall rain particles speed
2477
+ */
2478
+ intensity?: Value<number, ['zoom', 'measure-light']>;
2479
+
2480
+ /**
2481
+ * The transition affecting any changes to this layer’s intensity property.
2482
+ */
2483
+ intensityTransition?: Transition;
2484
+ /**
2485
+ * Individual rain particle dorplets color.
2486
+ */
2487
+ color?: Value<string, ['zoom', 'measure-light']>;
2488
+
2489
+ /**
2490
+ * The transition affecting any changes to this layer’s color property.
2491
+ */
2492
+ colorTransition?: Transition;
2493
+ /**
2494
+ * Rain particles opacity.
2495
+ */
2496
+ opacity?: Value<number, ['zoom', 'measure-light']>;
2497
+
2498
+ /**
2499
+ * The transition affecting any changes to this layer’s opacity property.
2500
+ */
2501
+ opacityTransition?: Transition;
2502
+ /**
2503
+ * ScreenSpace vignette rain tinting effect intensity.
2504
+ */
2505
+ vignette?: Value<number, ['zoom', 'measure-light']>;
2506
+
2507
+ /**
2508
+ * The transition affecting any changes to this layer’s vignette property.
2509
+ */
2510
+ vignetteTransition?: Transition;
2511
+ /**
2512
+ * Rain vignette screenSpace corners tint color.
2513
+ */
2514
+ vignetteColor?: Value<string, ['zoom', 'measure-light']>;
2515
+
2516
+ /**
2517
+ * The transition affecting any changes to this layer’s vignetteColor property.
2518
+ */
2519
+ vignetteColorTransition?: Transition;
2520
+ /**
2521
+ * Thinning factor of rain particles from center. 0 no thinning. 1 maximal central area thinning.
2522
+ */
2523
+ centerThinning?: Value<number, ['zoom', 'measure-light']>;
2524
+
2525
+ /**
2526
+ * The transition affecting any changes to this layer’s centerThinning property.
2527
+ */
2528
+ centerThinningTransition?: Transition;
2529
+ /**
2530
+ * Main rain particles direction. Azimuth and polar angles.
2531
+ */
2532
+ direction?: Value<number[], ['zoom', 'measure-light']>;
2533
+
2534
+ /**
2535
+ * The transition affecting any changes to this layer’s direction property.
2536
+ */
2537
+ directionTransition?: Transition;
2538
+ /**
2539
+ * Rain droplet size. x normal to direction, y along direction
2540
+ */
2541
+ dropletSize?: Value<number[], ['zoom', 'measure-light']>;
2542
+
2543
+ /**
2544
+ * The transition affecting any changes to this layer’s dropletSize property.
2545
+ */
2546
+ dropletSizeTransition?: Transition;
2547
+ /**
2548
+ * Rain particles screenSpace distortion strength.
2549
+ */
2550
+ distortionStrength?: Value<number, ['zoom', 'measure-light']>;
2551
+
2552
+ /**
2553
+ * The transition affecting any changes to this layer’s distortionStrength property.
2554
+ */
2555
+ distortionStrengthTransition?: Transition;
2556
+ }
2368
2557
  export interface TerrainLayerStyleProps {
2369
2558
  /**
2370
2559
  * Exaggerates the elevation of the terrain by multiplying the data from the DEM with this value.
@@ -2389,4 +2578,6 @@ export type AllLayerStyleProps =
2389
2578
  | SkyLayerStyleProps
2390
2579
  | LightLayerStyleProps
2391
2580
  | AtmosphereLayerStyleProps
2581
+ | SnowLayerStyleProps
2582
+ | RainLayerStyleProps
2392
2583
  | TerrainLayerStyleProps;
@@ -73,6 +73,8 @@ const styleMap = {
73
73
  lineZOffset: StyleTypes.Constant,
74
74
  lineElevationReference: StyleTypes.Enum,
75
75
  lineCrossSlope: StyleTypes.Constant,
76
+ lineElevationGroundScale: StyleTypes.Constant,
77
+ lineElevationGroundScaleTransition: StyleTypes.Transition,
76
78
  linePatternCrossFade: StyleTypes.Constant,
77
79
  lineTrimFadeRange: StyleTypes.Constant,
78
80
  lineTrimColor: StyleTypes.Color,
@@ -357,6 +359,26 @@ const styleMap = {
357
359
  verticalRange: StyleTypes.Constant,
358
360
  verticalRangeTransition: StyleTypes.Transition,
359
361
 
362
+ density: StyleTypes.Constant,
363
+ densityTransition: StyleTypes.Transition,
364
+ opacity: StyleTypes.Constant,
365
+ opacityTransition: StyleTypes.Transition,
366
+ vignette: StyleTypes.Constant,
367
+ vignetteTransition: StyleTypes.Transition,
368
+ vignetteColor: StyleTypes.Color,
369
+ vignetteColorTransition: StyleTypes.Transition,
370
+ centerThinning: StyleTypes.Constant,
371
+ centerThinningTransition: StyleTypes.Transition,
372
+ direction: StyleTypes.Constant,
373
+ directionTransition: StyleTypes.Transition,
374
+ flakeSize: StyleTypes.Constant,
375
+ flakeSizeTransition: StyleTypes.Transition,
376
+
377
+ dropletSize: StyleTypes.Constant,
378
+ dropletSizeTransition: StyleTypes.Transition,
379
+ distortionStrength: StyleTypes.Constant,
380
+ distortionStrengthTransition: StyleTypes.Transition,
381
+
360
382
  exaggeration: StyleTypes.Constant,
361
383
 
362
384
  color: StyleTypes.Color,