I try to use Animated.interpolate but I get a strange error that I've never had. How can it be solved ? Thanks

The variable that is using interpolate should be inside useAnimatedStyle.
const positionX = useSharedValue(-40);
const animatedStyles = useAnimatedStyle(() => {
const opacity = interpolate(positionX.value, [-40, 0], [0, 1]); // <- It must be here to work.
return {
transform: [{ translateX: positionX.value }],
opacity,
};
});
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With