fix(android): crash on resetting borderStyle with props 2.0#56228
Closed
hannojg wants to merge 1 commit into
Closed
fix(android): crash on resetting borderStyle with props 2.0#56228hannojg wants to merge 1 commit into
hannojg wants to merge 1 commit into
Conversation
Collaborator
|
This pull request was successfully merged by @hannojg in 9e058db When will my fix make it into a release? | How to file a pick request? |
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.
Summary:
The problem
When enabling props 2.0 with the feature flags:
setting the style for
borderStyleto undefined causes a crash:Screen_recording_20260326_092132.mp4
Expand for crash stack
The bug & its fix
The problem is that we clear the value of
borderStyleusingNULL:https://github.com/facebook/react-native/blob/4f908f433044279b7340c1933792b15aa5796a32/packages/react-native/ReactCommon/react/renderer/components/view/platform/android/react/renderer/components/view/HostPlatformViewProps.cpp#L382
where
NULLseems to be defined as0:so, folly treats this as a
0.0and we get a double for a value meant to benull/ optional.The fix is to change this to a proper folly nullish-value, as this PR does. This fixes the crash:
Screen_recording_20260326_091533.mp4
(I think there are other places where this is being misused, but i will make individual PRs for those cases!)
Changelog:
[ANDROID] [FIXED] - Fixed crash when enabling props 2.0 and setting
borderStyletoundefinedTest Plan:
You can test the crash before with the following code in the playground app:
https://github.com/facebook/react-native/compare/main...hannojg:react-native:hannojg/reproduction-borderstyle-issue?expand=1
You can then test and see how this fix resolves the crash.