fix(ios): guard null oldProps in EaseView Fabric updates#12
Open
oferRounds wants to merge 1 commit intoAppAndFlow:mainfrom
Open
fix(ios): guard null oldProps in EaseView Fabric updates#12oferRounds wants to merge 1 commit intoAppAndFlow:mainfrom
oferRounds wants to merge 1 commit intoAppAndFlow:mainfrom
Conversation
Fabric can pass a null oldProps shared_ptr; dereferencing caused EXC_BAD_ACCESS when comparing transform props. Resolve previous EaseViewProps from oldProps, then _props (before super), then props as fallback. Made-with: Cursor
| } | ||
| if (!previousEaseViewPropsForDiff) { | ||
| previousEaseViewPropsForDiff = | ||
| std::static_pointer_cast<const EaseViewProps>(_props); |
Collaborator
There was a problem hiding this comment.
Do we really need to check both _props and props?
Could we just use props if old props is null? (remove _props check)
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.
Problem
EaseViewcould crash withEXC_BAD_ACCESSinupdateProps:oldProps:when reading fields onoldViewProps(e.g.animateTranslateX). On React Native Fabric,oldPropsmay be a nullshared_ptron some update paths. Dereferencing the result ofstatic_pointer_castwithout a null check is undefined behavior.Solution
Before
[super updateProps:...], resolve a non-nullEaseViewPropspointer for prop diffing:oldPropswhen non-null and the cast succeeds._props(still the previous generation beforesuperupdates it).propsso the diff sees no artificial changes.Context
Observed on React Native 0.84 with the New Architecture enabled, with transform-related
EaseViewupdates.Testing
Made with Cursor