Replies: 2 comments 9 replies
-
I'm facing the same issue. In older version of reanimated (in production I'm using 2.8) it was working. I suggest we should maybe open an issue |
Beta Was this translation helpful? Give feedback.
9 replies
-
Hey 👋 const style = useAnimatedStyle(() => {
return {
width: withTiming(200)
};
});
return (
<Animated.View style={[{ width: 100 }, style]}>
<Text>hello Reanimated</Text>
</Animated.View>
); Unfortunately, this code couldn't work because the animation doesn't know the initial value. Reanimated doesn't know from which value should start the animation. But you can achieve your effect using the shared value, like this: const width = useSharedValue(100)
const style = useAnimatedStyle(() => {
return {
width: withTiming(width.value)
};
});
useEffect(() => {
width.value = 200
})
return (
<Animated.View style={[{ width: 100 }, style]}>
<Text>hello Reanimated</Text>
</Animated.View>
); |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Expect
withTiming
animations to be executed at render time, but frozen in the result of execution.For example, in the example below, we expected to see an animation with a width of 100 to 200 and a duration of 1000ms at render time.
But it is fixed at 200 at render time.
Is it right way to use something like this for this?
ex1)
ex1)
Also, 200 is passed as the value of the second argument of
onStart
of the internal logic of withTiming. I wonder what the meaning of the second argument of onStart is. https://github.com/software-mansion/react-native-reanimated/blob/main/src/reanimated2/animation/timing.ts#L69Beta Was this translation helpful? Give feedback.
All reactions