Repository navigation
fix(android): accept null numeric props on ShapeSource - #4451
Merged
mfazekas merged 2 commits intoNov 23, 2026
Merged
Conversation
Unsetting tolerance, buffer, maxZoomLevel, minZoomLevel, clusterRadius or clusterMaxZoomLevel sends null to the manager, which threw a ClassCastException from Dynamic.asInt()/asDouble(). Null now clears the stored value so the Mapbox default applies. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…gers Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
mfazekas
approved these changes
Nov 23, 2026
mfazekas
left a comment
Contributor
There was a problem hiding this comment.
Thanks, this fixes it: I reproduced all six crashes on main on an emulator, and with this PR each prop unsets cleanly. Unsetting goes back to the Mapbox default once the source is rebuilt, which is how changing these props behaves today as well.
lineMetrics and clusterProperties still crash the same way when unset (asBoolean() / asMap() on null). If you'd like to cover them too, a follow-up PR would be welcome: if (lineMetrics.isNull) null else lineMetrics.asBoolean(), and an isNull check before asMap(). That would make every prop on ShapeSource safe to unset. Merging this one now.
3 of 8 tasks
4 of 8 tasks
Contributor
Author
3 of 7 tasks
Contributor
Author
This branch was previously deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
On Android, unsetting a numeric prop on a mounted
ShapeSourcecrashes. React Native sendsnullto the view manager, andRNMBXShapeSourceManagercallsDynamic.asInt()/asDouble()on it:tolerancebuffermaxZoomLevelminZoomLevelclusterRadiusclusterMaxZoomLevelThe integer setters now read
if (value.isNull) null else value.asInt().toLong(), likeRNMBXMarkerViewManagerandRNMBXRasterSourceManager, andtoleranceusesasDoubleOrNull(), likeRNMBXCameraManager.RNMBXShapeSourcestores thenull, so the property goes back to the Mapbox default the next time the source is built: the builder already skips null fields. WithclusterMaxZoomLevelset tonull, the livesetStyleSourcePropertyupdate is skipped.We hit this in production with
tolerance, which our app never sets.Checklist
CONTRIBUTING.mdyarn generatein the root folder (no spec or doc change)/exampleapp./example)Screenshot OR Video
Tested on a physical Samsung Android phone with a debug build of
/example, using the reproducer below in place ofBugReportExample.js.Before: the first tap on "Unset numeric props" throws.
The crash we saw in production, with
tolerance:After: 20 set/unset toggles, no exception in logcat, the app stays up and the layer still renders.
Component to reproduce the issue you're fixing
BugReportExample.js
🤖 Generated with Claude Code