Commit e3f43f8
feat: Add RasterParticleLayer and RasterArraySource for Mapbox v11 (#4082)
* feat: Add RasterParticleLayer and RasterArraySource for Mapbox v11
Add support for particle layer animations (wind, ocean currents, etc.)
for Mapbox Maps SDK v11.4.0+. This feature requires both a new source
type (RasterArraySource) and layer type (RasterParticleLayer).
Changes:
- Add RasterArraySource component for raster array tile data
- Add RasterParticleLayer component for particle animations
- Implement native iOS support (old + new architecture)
- Implement native Android support (old + new architecture)
- Add TypeScript specs for both components
- Export new components in Mapbox.native.ts
Features:
- Supports velocity-based particle animations
- Paint properties: raster-particle-speed-factor, raster-particle-count,
raster-particle-color, raster-particle-max-speed, etc.
- Marked as experimental (matches Mapbox SDK)
- Requires Mapbox v11.4.0+ on both platforms
- New architecture (Fabric) support included
Note: Run 'yarn generate' to generate style types and native setters
* docs: Add wind particle animation example for RasterParticleLayer
Add a comprehensive example demonstrating the new RasterParticleLayer
and RasterArraySource components. The example visualizes wind patterns
across the United States using particle animations.
Changes:
- Add RasterParticle.tsx example in V11 directory
- Configure particle properties (speed, count, color gradient)
- Add detailed documentation about the feature
- Register example in GroupAndItem.tsx navigation
Features demonstrated:
- RasterArraySource with Mapbox wind data
- RasterParticleLayer with customized styling
- Dynamic color gradient based on particle speed
- Particle count, fade, and reset rate configuration
* fix: Add TypeScript types and style mappings for RasterParticleLayer
Add manual type definitions and style mappings for RasterParticleLayer
since yarn generate cannot be run without dependencies.
Changes:
- Update generateCodeWithEjs.mjs to support v11-only layers
- Add RasterParticleLayerStyleProps to MapboxStyles.ts
- Add raster-particle style properties to styleMap.ts
- Include all particle properties: count, color, speed, fade, etc.
This fixes the "rasterParticleSpeedFactor is not a valid Mapbox layer style" error.
Note: When yarn install is run, developers should run 'yarn generate'
to regenerate these files from the style-spec v8.json templates.
* remove test file
* fix: Add autogenerate support for RasterParticleLayer and new v11 layers
- Fix getSupportedProperties to handle layers without paint/layout attributes
- Add layer type mappings for raster-particle, slot, and clip layers
- Generate native code and docs for RasterParticleLayer and RasterArraySource
- Generate old-arch Java files for new components
- Update TypeScript types and style mappings
This fixes the yarn generate script which was broken due to new Mapbox v11
layers (slot, clip, raster-particle) that have different attribute structures
than traditional layers.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
* fix: Add raster-particle-speed to ExpressionParameters and fix lint issues
- Add 'raster-particle-speed' to ExpressionParameters type for particle layer color expressions
- Remove unused React import from RasterParticle example
- Auto-fix prettier formatting issues
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
* test: Add RasterParticleLayer and RasterArraySource to interface test
Update the public interface test to include the new RasterParticleLayer
and RasterArraySource exports.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
* fix: Fix Swift template generation for layers without properties
The template was generating invalid Swift code for layers that have no
properties (like 'slot' which has no paint or layout properties).
Changes:
- Add check for layer.properties.length > 0 before generating if-else chain
- For layers with no properties, directly output error message
- Add 'raster-particle-speed' to ExpressionParameters in MapboxStyles template
- Regenerate all files with fixed templates
This fixes the Swift syntax error: "extraneous '}' at top level" and
"consecutive statements on a line must be separated by ';'"
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
* fix: Exclude rasterParticleElevation and fix clipLayerTypes array handling
Two iOS compilation errors fixed:
1. rasterParticleElevation property:
- Added to UnsupportedProperties list
- Style spec says it's available in iOS 11.7.0
- Not actually implemented in Mapbox Maps SDK yet
- Removed from generated code until SDK implements it
2. clipLayerTypes array of enum handling:
- Fixed template to use mglStyleValueArrayString() for enum arrays
- Only textWritingMode and textVariableAnchor need custom array methods
- Other enum arrays use generic string array method
Changes:
- Add 'raster-particle-elevation' to UnsupportedProperties list
- Update Swift template to handle enum arrays properly
- Regenerate all native code files
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
* fix: Add @_spi(Experimental) import for RasterParticleLayer and RasterArraySource
Both RasterParticleLayer and RasterArraySource are experimental APIs in
Mapbox Maps SDK v11. They require the @_spi(Experimental) import annotation
to access these experimental features.
This fixes the iOS compilation error:
"Cannot find type 'RasterParticleLayer' in scope"
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
* fix: Remove unsupported tileSize and bounds setters for iOS RasterArraySource
The Mapbox Maps SDK for iOS marks tileSize and bounds as read-only properties
(public private(set)) in RasterArraySource. These properties can only be:
- Derived from TileJSON when using url
- Set during source construction (not available in current API)
Changes:
- Remove attempts to set tileSize and bounds after source creation on iOS
- Add detailed comments explaining the limitation
- Update TypeScript documentation with @platform android annotation
- Suggest using TileJSON for custom values on iOS
Android implementation continues to work as both properties are settable
through the Builder pattern.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
* feat: Implement mglStyleValueArrayClipLayerTypes for iOS ClipLayer
Add proper type conversion for clipLayerTypes property which expects
Value<[ClipLayerTypes]> instead of Value<[String]>.
Changes:
- Add mglStyleValueArrayClipLayerTypes() method in RNMBXStyleValue.swift
- Converts string array to ClipLayerTypes enum array (model, symbol)
- Follows same pattern as textWritingMode and textVariableAnchor
- Update template to use custom method for clipLayerTypes enum array
- Regenerate RNMBXStyle.swift with correct type conversion
This fixes the iOS compilation error:
"Cannot assign value of type 'Value<[String]>' to type 'Value<[ClipLayerTypes]>'"
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
* fix: Complete RasterParticleLayer and RasterArraySource implementation
Fixes for code generation and Android/iOS compilation:
- Fixed code generation to handle layers without properties (slot, clip)
- Excluded slot and clip layers from generation (no RN components yet)
- Added RasterParticleLayer and RasterArraySource to Android package registration
- Added getLong() method to RNMBXStyleValue for rasterParticleCount
- Added special handling for rasterParticleColor (uses getIntExpression)
- Added special handling for rasterParticleCount (Long type)
- Added raster-particle-speed to ExpressionParameters type
- Updated example documentation about MRT tileset requirements
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
* build on v10
* fix build
* genereate
* fix: v10 compatibility for RasterParticleLayer and RasterArraySource
- Restore RasterParticleLayer.kt v10 stub file
- Remove TileSet reference from RasterArraySource.kt v10 stub (not available in v10)
- Regenerate iOS code with proper #if RNMBX_11 guards for RasterParticleLayer
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
* fix: v10 compatibility for RasterParticleLayer and RasterArraySource
---------
Co-authored-by: Claude <noreply@anthropic.com>1 parent 97a2342 commit e3f43f8
File tree
63 files changed
+7116
-341
lines changed- __tests__
- android/src/main
- java/com/rnmapbox/rnmbx
- components/styles
- mapbox-v11-compat
- v10/com
- mapbox/maps/extension/style
- layers/generated
- sources/generated
- rnmapbox/rnmbx
- components/styles
- layers
- sources
- v11compat
- v11/com/rnmapbox/rnmbx/components/styles
- layers
- sources
- old-arch/com/facebook/react/viewmanagers
- docs
- example
- ios
- src
- examples/V11
- scenes
- ios/RNMBX
- plugin
- build
- src
- scripts
- autogenHelpers
- templates
- src
- components
- specs
- utils
- temp-issue-3909
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
63 files changed
+7116
-341
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
38 | 38 | | |
39 | 39 | | |
40 | 40 | | |
| 41 | + | |
41 | 42 | | |
42 | 43 | | |
43 | 44 | | |
| |||
46 | 47 | | |
47 | 48 | | |
48 | 49 | | |
| 50 | + | |
49 | 51 | | |
50 | 52 | | |
51 | 53 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
34 | 34 | | |
35 | 35 | | |
36 | 36 | | |
| 37 | + | |
37 | 38 | | |
38 | 39 | | |
39 | 40 | | |
40 | 41 | | |
41 | 42 | | |
| 43 | + | |
42 | 44 | | |
43 | 45 | | |
44 | 46 | | |
| |||
140 | 142 | | |
141 | 143 | | |
142 | 144 | | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
143 | 148 | | |
144 | 149 | | |
145 | 150 | | |
| |||
154 | 159 | | |
155 | 160 | | |
156 | 161 | | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
157 | 165 | | |
158 | 166 | | |
159 | 167 | | |
| |||
Lines changed: 180 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
| 16 | + | |
16 | 17 | | |
17 | 18 | | |
18 | 19 | | |
| |||
704 | 705 | | |
705 | 706 | | |
706 | 707 | | |
| 708 | + | |
| 709 | + | |
| 710 | + | |
| 711 | + | |
| 712 | + | |
| 713 | + | |
| 714 | + | |
| 715 | + | |
| 716 | + | |
| 717 | + | |
| 718 | + | |
| 719 | + | |
| 720 | + | |
| 721 | + | |
| 722 | + | |
| 723 | + | |
| 724 | + | |
| 725 | + | |
| 726 | + | |
| 727 | + | |
| 728 | + | |
| 729 | + | |
| 730 | + | |
| 731 | + | |
| 732 | + | |
| 733 | + | |
| 734 | + | |
| 735 | + | |
| 736 | + | |
| 737 | + | |
| 738 | + | |
| 739 | + | |
| 740 | + | |
| 741 | + | |
| 742 | + | |
| 743 | + | |
| 744 | + | |
| 745 | + | |
707 | 746 | | |
708 | 747 | | |
709 | 748 | | |
| |||
4354 | 4393 | | |
4355 | 4394 | | |
4356 | 4395 | | |
| 4396 | + | |
| 4397 | + | |
| 4398 | + | |
| 4399 | + | |
| 4400 | + | |
| 4401 | + | |
| 4402 | + | |
| 4403 | + | |
| 4404 | + | |
| 4405 | + | |
| 4406 | + | |
| 4407 | + | |
| 4408 | + | |
| 4409 | + | |
| 4410 | + | |
| 4411 | + | |
| 4412 | + | |
| 4413 | + | |
| 4414 | + | |
| 4415 | + | |
| 4416 | + | |
| 4417 | + | |
| 4418 | + | |
| 4419 | + | |
| 4420 | + | |
| 4421 | + | |
| 4422 | + | |
| 4423 | + | |
| 4424 | + | |
| 4425 | + | |
| 4426 | + | |
| 4427 | + | |
| 4428 | + | |
| 4429 | + | |
| 4430 | + | |
| 4431 | + | |
| 4432 | + | |
| 4433 | + | |
| 4434 | + | |
| 4435 | + | |
| 4436 | + | |
| 4437 | + | |
| 4438 | + | |
| 4439 | + | |
| 4440 | + | |
| 4441 | + | |
| 4442 | + | |
| 4443 | + | |
| 4444 | + | |
| 4445 | + | |
| 4446 | + | |
| 4447 | + | |
| 4448 | + | |
| 4449 | + | |
| 4450 | + | |
| 4451 | + | |
| 4452 | + | |
| 4453 | + | |
| 4454 | + | |
| 4455 | + | |
| 4456 | + | |
| 4457 | + | |
| 4458 | + | |
| 4459 | + | |
| 4460 | + | |
| 4461 | + | |
| 4462 | + | |
| 4463 | + | |
| 4464 | + | |
| 4465 | + | |
| 4466 | + | |
| 4467 | + | |
| 4468 | + | |
| 4469 | + | |
| 4470 | + | |
| 4471 | + | |
| 4472 | + | |
| 4473 | + | |
| 4474 | + | |
| 4475 | + | |
| 4476 | + | |
| 4477 | + | |
| 4478 | + | |
| 4479 | + | |
| 4480 | + | |
| 4481 | + | |
| 4482 | + | |
| 4483 | + | |
| 4484 | + | |
| 4485 | + | |
| 4486 | + | |
| 4487 | + | |
| 4488 | + | |
| 4489 | + | |
| 4490 | + | |
| 4491 | + | |
| 4492 | + | |
| 4493 | + | |
| 4494 | + | |
| 4495 | + | |
| 4496 | + | |
| 4497 | + | |
| 4498 | + | |
| 4499 | + | |
| 4500 | + | |
| 4501 | + | |
| 4502 | + | |
| 4503 | + | |
| 4504 | + | |
| 4505 | + | |
| 4506 | + | |
| 4507 | + | |
| 4508 | + | |
| 4509 | + | |
| 4510 | + | |
| 4511 | + | |
| 4512 | + | |
| 4513 | + | |
| 4514 | + | |
| 4515 | + | |
| 4516 | + | |
| 4517 | + | |
| 4518 | + | |
| 4519 | + | |
| 4520 | + | |
| 4521 | + | |
| 4522 | + | |
| 4523 | + | |
| 4524 | + | |
| 4525 | + | |
| 4526 | + | |
| 4527 | + | |
| 4528 | + | |
| 4529 | + | |
| 4530 | + | |
| 4531 | + | |
| 4532 | + | |
| 4533 | + | |
| 4534 | + | |
| 4535 | + | |
| 4536 | + | |
4357 | 4537 | | |
4358 | 4538 | | |
4359 | 4539 | | |
| |||
Lines changed: 4 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
33 | 33 | | |
34 | 34 | | |
35 | 35 | | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
36 | 40 | | |
37 | 41 | | |
38 | 42 | | |
| |||
Lines changed: 58 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
Lines changed: 20 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
Lines changed: 22 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
0 commit comments