Rotate-in — rotate and fade effect.
Implementation:
1import { Animated } from "react-native";23function RotateInView({ children }) {4 const rotateAnim = useRef(new Animated.Value(0)).current;5 const fadeAnim = useRef(new Animated.Value(0)).current;67 useEffect(() => {8 Animated.parallel([9 Animated.spring(rotateAnim, {10 toValue: 1,11 friction: 8,12 useNativeDriver: true,13 }),14 Animated.timing(fadeAnim, {15 toValue: 1,16 duration: 500,17 useNativeDriver: true,18 }),19 ]).start();20 }, []);2122 const rotation = rotateAnim.interpolate({23 inputRange: [0, 1],24 outputRange: ["-180deg", "0deg"],25 });2627 return (28 <Animated.View style={{29 opacity: fadeAnim,30 transform: [{ rotate: rotation }],31 }}>32 {children}33 </Animated.View>34 );35}