$ git show press-scale

Press scale

Basic/anim press-scale

Shrink a button slightly while pressed, spring back on release.

Main · New Architecture only · worklets live in react-native-worklets
transitionPropertytransitionDurationCSS transitions
press-scale.tsx · reanimated 4
// Reanimated 4: a CSS transition reacts to the pressed state
const [pressed, setPressed] = useState(false);
return (
  <Pressable onPressIn={() => setPressed(true)} onPressOut={() => setPressed(false)}>
    <Animated.View
      style={[styles.button, {
        transform: [{ scale: pressed ? 0.92 : 1 }],
        transitionProperty: 'transform',
        transitionDuration: '120ms',
        transitionTimingFunction: 'ease-out',
      }]}
    />
  </Pressable>
);
// Need a spring feel or no re-render per press? Use the worklet version from the v3 tab; it runs on v4 too.