-
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
[Animated] Cannot animate string transform properties (v0.19) #2528
Comments
This comment was marked as duplicate.
This comment was marked as duplicate.
This is a bug in React Native too 34425 |
Here is patch that works for us in interim
|
That doesn't "work", it just skips over the issue |
Fair enough, we're not doing a lot with transforms and it enabled us to migrate to latest version. |
This comment was marked as off-topic.
This comment was marked as off-topic.
Aashu-Dubey in the test case, you're trying to stringify an animated object:
That will never work. What you can do is interpolate the whole string value (which will work in RN), or animate only the
Or
|
This comment was marked as off-topic.
This comment was marked as off-topic.
@necolas it is not working on It appears to be functioning correctly with the <Animated.View style={ {transform: 'scale(2)'}} >
....
</Animated.View> |
Is there a way to combine 2+ animated values into a single transform string? const translateX = Animated.divide(Animated.multiply(progress, progressBarWidth), 2).interpolate({
inputRange: [0, 1],
outputRange: ['translateX(0)', 'translateX(1)'],
});
const scaleX = Animated.multiply(progress, progressBarWidth).interpolate({
inputRange: [0, 1],
outputRange: ['scaleX(0)', 'scaleX(1)'],
}); |
I'll second the question from @Gregoirevda |
Is there an existing issue for this?
Describe the issue
It seems that after rn-web v0.19, it is recommended to use space-separated string functions on web instead of array, as we get these deprecation warnings
though they work fine on web, but we can't apply animations using them as of now, as I'm getting this error even when using the styles without animation on any
Animated
componentExpected behavior
animation on these new string functions should work fine, as it is working in case of array transform right now.
Steps to reproduce
You can clearly see the issue in the attached sandbox.
For a bigger example, I had the issue when I was recently trying to fix these warning on this sample app (Web Demo), there are few places where I'm using these styles and they are working fine, but can't use them where animations are needed.
Test case
https://codesandbox.io/s/rn-web-string-transform-bug-g1eqvy
Additional comments
Currently I'm using
...Platform.select({ web : { transform: 'rotate(45deg)' } })
approach to apply these styles, as they don't yet seems to be cross compatible with native platforms.Do let me know if there's any particular approach to apply animations here or if this is something to be fix in future version of the package.
Thanks!
The text was updated successfully, but these errors were encountered: