TS2345: Argument of type '{ toValue: number; duration: number; }' is not assignable to parameter of type 'TimingAnimationConfig'. Property 'useNativeDriver' is missing in type '{ toValue: number; duration: number; }' but required in type 'TimingAnimationConfig'.
react native에서 css 애니메이션을 구현할 때 사용
import { Animated } from 'react-native'
const value = React.useRef(new Animated.Value(0)).current
useEffect(() => {
Animated.timing(value, {
toValue: 1,
duration: 10000
})
}, [value])
공식문서에서 이렇게 나와있는데 위와 같은 에러 발생
useNativeDriver: true
추가하면 해결된다
React.useEffect(() => {
Animated.timing(value, {
toValue: 1,
duration: 10000,
useNativeDriver: true,
}).start();
}, [value]);