-
Notifications
You must be signed in to change notification settings - Fork 46.8k
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
Fix fastAddProperties to properly nullify style props #30334
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
it('should nullify previously defined style prop that is subsequently set to null or undefined', () => { | ||
expect( | ||
create({style: [{a: 0}, {a: undefined}]}, {style: {a: true}}), | ||
).toEqual({a: null}); | ||
expect(create({style: [{a: 0}, {a: null}]}, {style: {a: true}})).toEqual({ | ||
a: null, | ||
}); | ||
}); |
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.
Is fastAddProperties tested in this codepath? Can we run these tests with enableAddPropertiesFastPath
enabled?
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.
Yes, with
yarn test packages/react-native-renderer -r=xplat --variant=true
25ff830
to
b0d469e
Compare
## Summary This PR fixes the `fastAddProperties` function. Now it nullifies a prop if it was defined in one of the items of a style array, but then set to `undefined` or `null` in one of the subsequent items. E.g. `style: [{top: 0}, {top: undefined}]` should evaluate to `{top: null}`. Also added a test case for that. ## How did you test this change? ``` yarn test packages/react-native-renderer -r=xplat --variant=false yarn test packages/react-native-renderer -r=xplat --variant=true yarn flow native ``` DiffTrain build for commit f510ece.
## Summary This PR fixes the `fastAddProperties` function. Now it nullifies a prop if it was defined in one of the items of a style array, but then set to `undefined` or `null` in one of the subsequent items. E.g. `style: [{top: 0}, {top: undefined}]` should evaluate to `{top: null}`. Also added a test case for that. ## How did you test this change? ``` yarn test packages/react-native-renderer -r=xplat --variant=false yarn test packages/react-native-renderer -r=xplat --variant=true yarn flow native ```
## Summary This PR fixes the `fastAddProperties` function. Now it nullifies a prop if it was defined in one of the items of a style array, but then set to `undefined` or `null` in one of the subsequent items. E.g. `style: [{top: 0}, {top: undefined}]` should evaluate to `{top: null}`. Also added a test case for that. ## How did you test this change? ``` yarn test packages/react-native-renderer -r=xplat --variant=false yarn test packages/react-native-renderer -r=xplat --variant=true yarn flow native ```
Summary
This PR fixes the
fastAddProperties
function. Now it nullifies a prop if it was defined in one of the items of a style array, but then set toundefined
ornull
in one of the subsequent items. E.g.style: [{top: 0}, {top: undefined}]
should evaluate to{top: null}
. Also added a test case for that.How did you test this change?