I want to add a listener to an interpolated Animated value, but the callback isn't being called at all...
My code is below, am I doing something wrong?
import React, { useEffect } from 'react';
import {View, Animated } from 'react-native';
export default App = () => {
const y = new Animated.Value(0);
const yInt = y.interpolate({
inputRange: [-100, 100],
outputRange: [0, 10],
});
yInt.addListener(({value}) => console.log('yInt', value))
useEffect(() => {
Animated.timing(y, {
toValue: 1,
duration: 2000,
useNativeDriver: true,
}).start();
}, []);
return <View />;
};