I'm trying to implement some fade-in and out transition for icons with react native reanimated. The version of it is 2.1.0. I'm using the bare workflow of expo. And the code looks like this
...
const IconWrapper: React.FC<IconWrapperProps> = ({
wrapperStyle,
children
}) => {
const [opacity, setOpacity] = useState<number>(0);
const animatedOpacity = useSharedValue(opacity);
const hookUpdater = () => {
return {
opacity: withTiming(animatedOpacity.value , {
duration: 100,
easing: Easing.linear
})
};
};
const animationStyle = useAnimatedStyle(hookUpdater, [opacity]);
const hookEffect = () => {
setOpacity(1);
const cleaner = () => setOpacity(0);
return cleaner;
};
useEffect(hookEffect, []);
return (
<Animated.View
style={[wrapperStyle, animationStyle]}
>
{children}
</Animated.View>
);
};
export default IconWrapper;
For me, it seems that there is no problem, since I actually did the same thing which is in the documentation. But it keeps spitting me the error like
TypeError: Object.values requires that input parameter not be null or undefined
I've tried resetting cache with expo start -c
, but it didn't work. What should I do to fix this?