-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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: CSS transition shorthand property behavior in react-native-web #7019
Merged
Conversation
This file contains 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
4758801
to
61992a0
Compare
8a31475
to
1d01d03
Compare
MatiPl01
commented
Feb 13, 2025
packages/react-native-reanimated/src/css/platform/native/normalization/transition/config.ts
Show resolved
Hide resolved
MatiPl01
commented
Feb 13, 2025
packages/react-native-reanimated/src/css/platform/web/normalization/transition.ts
Show resolved
Hide resolved
61992a0
to
2db4ac2
Compare
39a007a
to
eb04501
Compare
piaskowyk
approved these changes
Feb 18, 2025
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.
I haven't tested it, but I didn't find anything controversial in these changes, so I can approve it 👍
2db4ac2
to
b3350c3
Compare
f7e16a6
to
cd2882f
Compare
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
This PR fixes CSS transition properties being overridden by
react-native-web
. It happened because we didn't filter out CSS props from the style object passed to the component in therender()
method of theAnimatedComponent
.I also made a few other changes to ensure that the transition shorthand is validated on web as well and preprocessed in a similar way to the native implementation.
Example Recordings
In the previous implementation, the
transitionTimingFunction
prop specified before thetransition
property shorthand was overriding thetransition
prop easing. Web also shown an error in the console that shorthand props shouldn't be mixed with longhand ones. We don't want this error to show up and want to support usage of both at the same time.Web
Screen.Recording.2025-02-13.at.14.28.49.mp4
Screen.Recording.2025-02-13.at.14.24.37.mp4
iOS
This recording is just for comparison to see that the behavior on web is also correct (the same as on the recording below) after changes implemented in this PR
Simulator.Screen.Recording.-.iPhone.16.Pro.-.2025-02-13.at.14.25.02.mp4
Source code