Thuta Learning
React Native
IntermediateMobile DevelopmentIntermediate

Animations, Gestures & Reduced Motion

React NativeLesson 1720 min

What you'll walk away with

  • Explain the React and native-platform behavior of Animations, Gestures & Reduced Motion
  • Test accessibility, failure, and lifecycle cases
  • Write maintainable, testable, and performant React Native

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.

Mental model
  1. device behavior
  2. measure and verify
  3. smooth accessible UI

Explain the React and native-platform behavior of Animations, Gestures & Reduced Motion

Core syntax or pattern

tsx
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

  1. device behaviorimport { 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.

  2. 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.

  3. 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.

Execution flow
  1. device behavior
  2. measure and verify
  3. 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.

tsx
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>;
}
You should see
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
tsx
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

What best describes the core idea of Animations, Gestures & Reduced Motion?

Quick quiz 2 / 3

Which mistake should you avoid first?

Quick quiz 3 / 3

How should this be applied in a real project?

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

Easy traps

  • Assuming one simulator's happy path proves every real-device, release-build, permission, accessibility, offline, and lifecycle path.
  • Applying web CSS or DOM assumptions directly, leaking subscriptions, or mixing every platform difference into one component.

Hands-on Exercise

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.

You'll know it worked when: Press feedback runs smoothly without changing layout.

Updated on

Progress is saved only in this browser on this device. It isn't synced to other devices.

Report a problem with this lessonOpens your email app with this lesson's address filled in — nothing is sent until you send it.

Animations, Gestures & Reduced Motion | Thuta Learning