-
Notifications
You must be signed in to change notification settings - Fork 1.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
Keyframe Animation only works with StyleSheet.create and within on Animated.View #2387
Comments
FWIW inline style animations haven't been supported for a long time. I'll look into why the Animated one doesn't work |
Oh it's because |
I might have a fix for this. I'll hopefully get a patch up soon for you to try in your environment |
Animated should now work with compiled and extracted styles. The original styles are passed to components, rather than being flattened into a new object that cannot be used by the style runtime to either lookup the results of StyleSheet.create calls or consume extracted styles. Inline styles that use AnimatedValue are moved into a seperate object that is appended to the original styles. Fix #2387
The reason for it was a single component for web and native, but using css animations on web and native Animated otherwise. Using Animated for the loading indicator was especially fragile as the indicator hides a lot of JS main thread work. There is also a loading placeholder component that can get the opacity animated value from the parent, while also having an additional css animation that runs every time. I solved that by wrapping it into another Animated.View. Is there a specific reason why inline animations are not supported? (I guess performance?) |
Why not use View for web and Animated.View for native? That seems like a relatively simple conditional that avoids the overhead of all the Animated implementation on web if you're not using it at all
Because inline styles are not converted to CSS rules, but animations require CSS rules and keyframes. |
🤷♂️ Well, now I am since 0.18 😜 Thanks for the insight, makes sense! |
Animated should now work with compiled and extracted styles. The original styles are passed to components, rather than being flattened into a new object that cannot be used by the style runtime to either lookup the results of StyleSheet.create calls or consume extracted styles. Inline styles that use AnimatedValue are moved into a seperate object that is appended to the original styles. Fix #2387
Animated should now work with compiled and extracted styles. The original styles are passed to components, rather than being flattened into a new object that cannot be used by the style runtime to either lookup the results of StyleSheet.create calls or consume extracted styles. Inline styles that use AnimatedValue are moved into a seperate object that is appended to the original styles. Fix #2387
Animated should now work with compiled and extracted styles. The original styles are passed to components, rather than being flattened into a new object that cannot be used by the style runtime to either lookup the results of StyleSheet.create calls or consume extracted styles. Inline styles that use AnimatedValue are moved into a seperate object that is appended to the original styles. Fix #2387
Awesome, you are the best, @necolas! 👍 |
Is there an existing issue for this?
Describe the issue
(this might be too issues, but I guess that they are probably based on the same underlying problem)
Hi 👋
I recently upgraded from 0.11 to 0.18 and noticed that our loading indicators are broken (no longer animated). I noticed that the CSS property
animationKeyframes
is only respected ifStyleSheet.create
, inline styling does not workThe generated CSS contains all CSS animation properties (like
animation-timing-function
) exceptanimation-name
.Expected behavior
Animation keyframes should be generated and work when using inline styles and/or
Animated.View
.All Views should rotate in the provided test case.
Steps to reproduce
Use React Native Web 0.18.0. (See attached codesandbox)
then render views
Observe that only the last View (with Text "View StyleSheet!") will start to rotate.
Test case
https://codesandbox.io/s/react-native-keyframe-animation-bug-ts4ib9
Additional comments
Thanks for being such a pillar of the React (Native) community!
The text was updated successfully, but these errors were encountered: