Scale animation — grow or shrink element.
Basic scale:
1import { Animated } from "react-native";23const scaleAnim = useRef(new Animated.Value(1)).current;45function scaleUp() {6 Animated.spring(scaleAnim, {7 toValue: 1.2,8 friction: 3,9 useNativeDriver: true,10 }).start();11}1213function scaleDown() {14 Animated.spring(scaleAnim, {15 toValue: 1,16 friction: 3,17 useNativeDriver: true,18 }).start();19}2021<Animated.View style={{ transform: [{ scale: scaleAnim }] }}>22 <Text>Scalable content</Text>23</Animated.View>
Scale with spring:
1Animated.sequence([2 Animated.spring(scaleAnim, {3 toValue: 1.3,4 friction: 2,5 useNativeDriver: true,6 }),7 Animated.spring(scaleAnim, {8 toValue: 1,9 friction: 2,10 useNativeDriver: true,11 }),12]).start();