Explain it simply
Animations, Gestures & Reduced Motion, in plain language
Treat Animations, Gestures & Reduced Motion as a native UI contract covering Yoga constraints, pixel density, font scaling, safe areas, the keyboard, touch targets, the accessibility tree, and iOS/Android differences—not merely screen styling syntax.
Problem → Why → Solution
The problem — why this concept matters
Assuming one simulator's happy path proves every real-device, release-build, permission, accessibility, offline, and lifecycle path.
A common mistake
Applying web CSS or DOM assumptions directly, leaking subscriptions, or mixing every platform difference into one component.
Core concept — understand how it works
Treat Animations, Gestures & Reduced Motion as a native UI contract covering Yoga constraints, pixel density, font scaling, safe areas, the keyboard, touch targets, the accessibility tree, and iOS/Android differences—not merely screen styling syntax.
- device behavior
- measure and verify
- smooth accessible UI
Explain the React and native-platform behavior of Animations, Gestures & Reduced Motion
Core syntax or pattern
import { useRef } from 'react';
import { Animated, Pressable, Text } from 'react-native';
export function SaveButton() {
const scale = useRef(new Animated.Value(1)).current;
const animate = (toValue: number) => Animated.spring(scale, {
toValue, useNativeDriver: true,
}).start();
return <Animated.View style={{ transform: [{ scale }] }}>
<Pressable onPressIn={() => animate(0.96)} onPressOut={() => animate(1)} accessibilityRole="button">
<Text>Save</Text>
</Pressable>
</Animated.View>;
}Treat Animations, Gestures & Reduced Motion as a native UI contract covering Yoga constraints, pixel density, font scaling, safe areas, the keyboard, touch targets, the accessibility tree, and iOS/Android differences—not merely screen styling syntax.
Read the code step by step
- device behavior
import { useRef } from 'react';Treat Animations, Gestures & Reduced Motion as a native UI contract covering Yoga constraints, pixel density, font scaling, safe areas, the keyboard, touch targets, the accessibility tree, and iOS/Android differences—not merely screen styling syntax.
- measure and verify
}).start();Treat Animations, Gestures & Reduced Motion as a native UI contract covering Yoga constraints, pixel density, font scaling, safe areas, the keyboard, touch targets, the accessibility tree, and iOS/Android differences—not merely screen styling syntax.
- smooth accessible UI
}Test an original Animations, Gestures & Reduced Motion example on Android and iOS with small and large screens, font scaling, dark mode, keyboard and screen reader use, slow/offline networking, denied permissions, and background/foreground transitions. Use DevTools, tests, and a release build where relevant.
- device behavior
- measure and verify
- smooth accessible UI
Success
Explain the React and native-platform behavior of Animations, Gestures & Reduced Motion
Failure
Assuming one simulator's happy path proves every real-device, release-build, permission, accessibility, offline, and lifecycle path.
Treat Animations, Gestures & Reduced Motion as a native UI contract covering Yoga constraints, pixel density, font scaling, safe areas, the keyboard, touch targets, the accessibility tree, and iOS/Android differences—not merely screen styling syntax.
import { useRef } from 'react';
import { Animated, Pressable, Text } from 'react-native';
export function SaveButton() {
const scale = useRef(new Animated.Value(1)).current;
const animate = (toValue: number) => Animated.spring(scale, {
toValue, useNativeDriver: true,
}).start();
return <Animated.View style={{ transform: [{ scale }] }}>
<Pressable onPressIn={() => animate(0.96)} onPressOut={() => animate(1)} accessibilityRole="button">
<Text>Save</Text>
</Pressable>
</Animated.View>;
}Press feedback runs smoothly without changing layout.Real-world usage
How to apply it in a real project
Test an original Animations, Gestures & Reduced Motion example on Android and iOS with small and large screens, font scaling, dark mode, keyboard and screen reader use, slow/offline networking, denied permissions, and background/foreground transitions. Use DevTools, tests, and a release build where relevant.
Mini challenge
Build it yourself
Test an original Animations, Gestures & Reduced Motion example on Android and iOS with small and large screens, font scaling, dark mode, keyboard and screen reader use, slow/offline networking, denied permissions, and background/foreground transitions. Use DevTools, tests, and a release build where relevant.
- Rebuild the example without copying it
- Test a normal input and an edge case
- Predict the compiler or output result before running it
import { useRef } from 'react';
import { Animated, Pressable, Text } from 'react-native';
export function SaveButton() {
const scale = useRef(new Animated.Value(1)).current;
const animate = (toValue: number) => Animated.spring(scale, {
toValue, useNativeDriver: true,
}).start();
return <Animated.View style={{ transform: [{ scale }] }}>
<Pressable onPressIn={() => animate(0.96)} onPressOut={() => animate(1)} accessibilityRole="button">
<Text>Save</Text>
</Pressable>
</Animated.View>;
}Expected: Explain the React and native-platform behavior of Animations, Gestures & Reduced Motion
Show hint
Test an original Animations, Gestures & Reduced Motion example on Android and iOS with small and large screens, font scaling, dark mode, keyboard and screen reader use, slow/offline networking, denied permissions, and background/foreground transitions. Use DevTools, tests, and a release build where relevant.
Quick quiz 1 / 3
Quick quiz 2 / 3
Quick quiz 3 / 3
What to remember
- device behavior → measure and verify → smooth accessible UI
- Treat Animations, Gestures & Reduced Motion as a native UI contract covering Yoga constraints, pixel density, font scaling, safe areas, the keyboard, touch targets, the accessibility tree, and iOS/Android differences—not merely screen styling syntax.
- Assuming one simulator's happy path proves every real-device, release-build, permission, accessibility, offline, and lifecycle path.
- Test an original Animations, Gestures & Reduced Motion example on Android and iOS with small and large screens, font scaling, dark mode, keyboard and screen reader use, slow/offline networking, denied permissions, and background/foreground transitions. Use DevTools, tests, and a release build where relevant.
Animations — React Native