Skip to content

Commit 80eb158

Browse files
authored
feat: add Snow and Rain particle effect components (#4179)
* feat: add Snow and Rain particle effect components Implements <Snow /> and <Rain /> components backed by Mapbox Maps SDK v11.9+ experimental precipitation APIs (@_spi(Experimental)). - Add snow/rain to the code generator (generateCodeWithEjs.mjs, globals.mjs) - Generate SnowLayerStyleProps / RainLayerStyleProps TypeScript types - Add RNMBXSnow / RNMBXRain iOS singleton layer implementations - Add RNMBXSnow / RNMBXRain Fabric component views (iOS) - Add RNMBXSnow / RNMBXRain Android implementations + managers - Register components in RNMBXPackage and package.json codegenConfig - Export Snow and Rain from src/Mapbox.native.ts - Add SnowAndRain example (V11) and integrate into TerrainSkyAtmosphere - Bump Mapbox SDK iOS + Android to 11.20.1 - Work around MapContentReconciler reset of rain by async re-applying after initial style load completes * fix: set explicit Rain color/vignetteColor to avoid measure-light expression errors The default color and vignetteColor for Rain use measure-light(brightness) expressions which fail with 'Brightness is unavailable in the current evaluation context' in terrain/atmosphere map styles. Set explicit static colors to bypass the failing expressions. * docs: note measure-light limitation in Rain component JSDoc * fix: use Standard style in TerrainSkyAtmosphere so Rain measure-light works natively * fix: deduplicate shared property names in styleMap.ts, add precommit script * fix: add Snow and Rain to public interface test * chore: regenerate generated files (new style spec properties) * fix: correct Snow/Rain import paths and remove unsupported rasterElevationReference Fix Android build by using precipitations.generated package path for Snow/Rain. Remove rasterElevationReference (not in SDK 11.20.1 despite spec claiming 11.19.0). Add measure-light availability warning to Rain. * fix: use getStyleLights() method instead of styleLights property
1 parent fa0be11 commit 80eb158

35 files changed

Lines changed: 2285 additions & 34 deletions

__tests__/interface.test.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,8 @@ describe('Public Interface', () => {
4444
'SkyLayer',
4545
'Terrain',
4646
'Atmosphere',
47+
'Snow',
48+
'Rain',
4749

4850
// sources
4951
'VectorSource',

android/src/main/java/com/rnmapbox/rnmbx/RNMBXPackage.kt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@ import com.rnmapbox.rnmbx.components.mapview.NativeMapViewModule
2626
import com.rnmapbox.rnmbx.components.mapview.RNMBXMapViewManager
2727
import com.rnmapbox.rnmbx.components.styles.RNMBXStyleImportManager
2828
import com.rnmapbox.rnmbx.components.styles.atmosphere.RNMBXAtmosphereManager
29+
import com.rnmapbox.rnmbx.components.styles.snow.RNMBXSnowManager
30+
import com.rnmapbox.rnmbx.components.styles.rain.RNMBXRainManager
2931
import com.rnmapbox.rnmbx.components.styles.layers.RNMBXBackgroundLayerManager
3032
import com.rnmapbox.rnmbx.components.styles.layers.RNMBXCircleLayerManager
3133
import com.rnmapbox.rnmbx.components.styles.layers.RNMBXFillExtrusionLayerManager
@@ -169,6 +171,8 @@ class RNMBXPackage : TurboReactPackage() {
169171
managers.add(RNMBXSkyLayerManager())
170172
managers.add(RNMBXTerrainManager())
171173
managers.add(RNMBXAtmosphereManager())
174+
managers.add(RNMBXSnowManager())
175+
managers.add(RNMBXRainManager())
172176
managers.add(RNMBXBackgroundLayerManager())
173177
managers.add(RNMBXLightManager())
174178
managers.add(RNMBXModelLayerManager())

0 commit comments

Comments
 (0)