Skip to content

fix(android): crash when changing Polygon render position in example app - #4362

Merged
mfazekas merged 1 commit into
rnmapbox:mainfrom
lochstar:android-layer-crash-fix
Oct 27, 2026
Merged

mfazekas merged 1 commit into
rnmapbox:mainfrom
lochstar:android-layer-crash-fix

Conversation

@lochstar

@lochstar lochstar commented Oct 15, 2026 •

Copy link
Copy Markdown
Contributor

Description

I've added asStringOrNull check to setAboveLayerID, setBelow, sourceLayerID and slot.

Steps to reproduce

  1. Run example app on Android: Annotations > Show Point Annotations
  2. Press "Render Polygon above"
  3. Observe crash

Checklist

  • I've read CONTRIBUTING.md
  • I updated the doc/other generated code with running yarn generate in the root folder
  • I have tested the new feature on /example app.
    • In V11 mode/ios
    • In New Architecture mode/ios
    • In V11 mode/android
    • In New Architecture mode/android
  • I added/updated a sample - if a new feature was implemented (/example)

@mfazekas mfazekas left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, the fix is right. Two things before it can go in:

  1. The layer managers are generated, so CI's yarn generate check reverts the change. Please make it in the shared template, android/src/main/java/com/rnmapbox/rnmbx/components/styles/layers/codeparts/LayerManagerCommonProps.codepart-kt.ejs, and run yarn generate. That also applies it to the other layer managers with the same pattern: RNMBXBackgroundLayerManager, RNMBXCircleLayerManager, RNMBXFillExtrusionLayerManager, RNMBXHeatmapLayerManager, RNMBXHillshadeLayerManager, RNMBXLineLayerManager, RNMBXModelLayerManager, RNMBXRasterLayerManager, RNMBXSkyLayerManager and RNMBXSymbolLayerManager.
  2. Yes, please use asStringOrNull() for sourceLayerID and slot too. Both setters take a String? and the props can be removed the same way.

@lochstar
lochstar force-pushed the android-layer-crash-fix branch from 2f1e19a to 6e1af7b Compare October 25, 2026 22:37
@lochstar
lochstar force-pushed the android-layer-crash-fix branch from 6e1af7b to 12bda86 Compare October 25, 2026 22:39
@lochstar

Copy link
Copy Markdown
Contributor Author

@mfazekas Have updated the PR with the requested changes.

@mfazekas
mfazekas merged commit 971fa5d into rnmapbox:main Oct 27, 2026
10 checks passed
mfazekas added a commit that referenced this pull request Oct 27, 2026
BackgroundLayer, FillExtrusionLayer and SkyLayer managers don't use the
LayerManagerCommonProps codepart, so they still called Dynamic.asString()
on aboveLayerID/belowLayerID/sourceLayerID, which throws when a prop goes
from a value to undefined. Follow-up to #4362.

This branch was previously deployed

1 inactive deployment
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants