Reanimated 2 can't use withSequence with direct value

Viewed 365

I want to use withSequence with a direct value as the first value, using the code bellow caused the app to crash.

animatedValue.value = withSequence(startValue, withTiming(endValue));

The bellow code seems to work perfectly but in my case, it doesn't help using the startValue inside withTiming.

animatedValue.value = withSequence(withTiming(startValue, {duration: 0}), withTiming(endValue));
1 Answers

You can just simply set startValue directly to animatedValue.value before triggering the animation:

animatedValue.value = startValue;
animatedValue.value = withTiming(endValue, { duration: 500 })
Related