-
Notifications
You must be signed in to change notification settings - Fork 25k
Fix prototype check in AnimatedObject.js #54820
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
| value !== null && | ||
| typeof value === 'object' && |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The value !== null and typeof checks are duplicated here. Can we simplify this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done. simplified the checks, and adds early return for non-object scenario
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
got this comment: #54820 (comment), but I didn't change the return type / any of RN public js api 🤔
manually running the diff-api-snapshot script returns NON_BREAKING rather than BREAKING:
codespace:/workspaces/react-native> git show 9fb2eb517ae017629a1e43bad729068df87780ac:packages/react-native/ReactNativeApi.d.ts
> ReactNativeApi-after.d.ts
codespace:/workspaces/react-native> node ./scripts/js-api/diff-api-snapshot packages/react-native/ReactNativeApi.d.ts ReactNati
veApi-after.d.ts
{
"result": "NON_BREAKING",
"changedApis": []
}
is there anything missing from my side?
|
packages/react-native/Libraries/Animated/nodes/AnimatedObject.js
Outdated
Show resolved
Hide resolved
packages/react-native/Libraries/Animated/nodes/AnimatedObject.js
Outdated
Show resolved
Hide resolved
flow lint error (1) Co-authored-by: Zeya Peng <[email protected]>
flow lint error (2) Co-authored-by: Zeya Peng <[email protected]>
|
This pull request was successfully merged by @maman in 4e0b923 When will my fix make it into a release? | How to file a pick request? |
Summary:
isPlainObjectfunction defined inAnimatedObject.jsdoesn't handleObject.create(null)correctly.this will throws when encountering objects with null prototype:
This breaks compatibility with libraries that use
Object.create(null)for creating clean dictionary objects.Changelog:
[GENERAL] [FIXED] - Handle
Object.create(null)correctly in AnimatedObject.js'isPlainObjectfunctionTest Plan: