Repository navigation
fix(android): accept null anchors in hand-written layer managers - #4421
Merged
Merged
Conversation
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
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
Follow-up to #4362.
RNMBXBackgroundLayerManager,RNMBXFillExtrusionLayerManagerandRNMBXSkyLayerManagerare hand-written (they don't use theLayerManagerCommonPropscodepart), so they still callDynamic.asString()onaboveLayerID/belowLayerID(andsourceLayerIDfor fill-extrusion). These now useasStringOrNull().With that alone, unsetting
sourceLayerIDon a mountedFillExtrusionLayermoved the crash to an NPE inRNMBXFillExtrusionLayer.setSourceLayerID(mSourceLayerID!!), so a null is now ignored there and the current source layer is kept.Checklist
CONTRIBUTING.mdyarn generatein the root folder/exampleapp./example)Screenshot OR Video
Tested on an Android emulator (API 34, debug build). Each button toggles that layer's anchor props to
undefined.Before, each toggle throws:
With only the manager change, fill-extrusion then fails with:
After: I toggled all three layers off and on through 3 rounds. There were no exceptions in logcat and the app stayed up.
Component to reproduce the issue you're fixing