ရိုးရိုးလေး ရှင်းပြမယ်
Animations, Gestures & Reduced Motion ကို ရိုးရိုးလေးနားလည်မယ်
Animations, Gestures & Reduced Motion ကို screen တစ်ခုအတွက် style syntax အဖြစ်သာမမြင်ဘဲ Yoga constraints, pixel density, font scaling, safe areas, keyboard, touch target, accessibility tree နဲ့ iOS/Android behavior ကွာခြားမှုတို့ပါသော native UI contract အဖြစ်နားလည်ပါ။
Problem → Why → Solution
ပြဿနာ — ဘာကြောင့် ဒီ concept လိုတာလဲ
Simulator တစ်ခု၏ happy path မှန်ရုံဖြင့် real devices, release builds, permissions, accessibility, offline နဲ့ lifecycle paths အားလုံးမှန်ပြီဟုယူဆခြင်း။
ဖြစ်လေ့ရှိတဲ့အမှား
Web CSS/DOM assumptions ကို React Native တွင်တိုက်ရိုက်သုံးခြင်း၊ subscription မပိတ်ခြင်း သို့ platform differences ကို condition အများကြီးဖြင့် component ထဲရောထည့်ခြင်း။
Core Concept — အလုပ်လုပ်ပုံကိုနားလည်မယ်
Animations, Gestures & Reduced Motion ကို screen တစ်ခုအတွက် style syntax အဖြစ်သာမမြင်ဘဲ Yoga constraints, pixel density, font scaling, safe areas, keyboard, touch target, accessibility tree နဲ့ iOS/Android behavior ကွာခြားမှုတို့ပါသော native UI contract အဖြစ်နားလည်ပါ။
- Device behavior
- Measure + verify
- Smooth accessible UI
Animations, Gestures & Reduced Motion ရဲ့ React နဲ့ native platform behavior ကိုရှင်းပြနိုင်ရန်
အဓိက Syntax / 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>;
}Animations, Gestures & Reduced Motion ကို screen တစ်ခုအတွက် style syntax အဖြစ်သာမမြင်ဘဲ Yoga constraints, pixel density, font scaling, safe areas, keyboard, touch target, accessibility tree နဲ့ iOS/Android behavior ကွာခြားမှုတို့ပါသော native UI contract အဖြစ်နားလည်ပါ။
Code ကို အဆင့်လိုက်ဖတ်မယ်
- Device behavior
import { useRef } from 'react';Animations, Gestures & Reduced Motion ကို screen တစ်ခုအတွက် style syntax အဖြစ်သာမမြင်ဘဲ Yoga constraints, pixel density, font scaling, safe areas, keyboard, touch target, accessibility tree နဲ့ iOS/Android behavior ကွာခြားမှုတို့ပါသော native UI contract အဖြစ်နားလည်ပါ။
- Measure + verify
}).start();Animations, Gestures & Reduced Motion ကို screen တစ်ခုအတွက် style syntax အဖြစ်သာမမြင်ဘဲ Yoga constraints, pixel density, font scaling, safe areas, keyboard, touch target, accessibility tree နဲ့ iOS/Android behavior ကွာခြားမှုတို့ပါသော native UI contract အဖြစ်နားလည်ပါ။
- Smooth accessible UI
}Animations, Gestures & Reduced Motion example ကို Android/iOS, small/large screens, font scaling, dark mode, keyboard, screen reader, slow/offline network, denied permissions နဲ့ app background/foreground cases ဖြင့်စမ်းပါ။ DevTools, tests နဲ့ release build ကိုလိုအပ်သလိုအသုံးပြုပါ။
- Device behavior
- Measure + verify
- Smooth accessible UI
Success
Animations, Gestures & Reduced Motion ရဲ့ React နဲ့ native platform behavior ကိုရှင်းပြနိုင်ရန်
Failure
Simulator တစ်ခု၏ happy path မှန်ရုံဖြင့် real devices, release builds, permissions, accessibility, offline နဲ့ lifecycle paths အားလုံးမှန်ပြီဟုယူဆခြင်း။
Animations, Gestures & Reduced Motion ကို screen တစ်ခုအတွက် style syntax အဖြစ်သာမမြင်ဘဲ Yoga constraints, pixel density, font scaling, safe areas, keyboard, touch target, accessibility tree နဲ့ iOS/Android behavior ကွာခြားမှုတို့ပါသော native UI contract အဖြစ်နားလည်ပါ။
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>;
}Layout မပြောင်းဘဲ smooth press feedback ရရှိမည်။Real-world usage
လက်တွေ့ Project မှာ ဘယ်လိုသုံးမလဲ
Animations, Gestures & Reduced Motion example ကို Android/iOS, small/large screens, font scaling, dark mode, keyboard, screen reader, slow/offline network, denied permissions နဲ့ app background/foreground cases ဖြင့်စမ်းပါ။ DevTools, tests နဲ့ release build ကိုလိုအပ်သလိုအသုံးပြုပါ။
Mini challenge
ကိုယ်တိုင်တည်ဆောက်ကြည့်ပါ
Animations, Gestures & Reduced Motion example ကို Android/iOS, small/large screens, font scaling, dark mode, keyboard, screen reader, slow/offline network, denied permissions နဲ့ app background/foreground cases ဖြင့်စမ်းပါ။ DevTools, tests နဲ့ release build ကိုလိုအပ်သလိုအသုံးပြုပါ။
- Example ကို copy မလုပ်ဘဲ ပြန်ရေးပါ
- Normal input နဲ့ edge case စမ်းပါ
- Run မလုပ်မီ compiler/output result ကိုခန့်မှန်းပါ
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>;
}ရလဒ်: Animations, Gestures & Reduced Motion ရဲ့ React နဲ့ native platform behavior ကိုရှင်းပြနိုင်ရန်
အရိပ်အမြွက် ကြည့်ရန်
Animations, Gestures & Reduced Motion example ကို Android/iOS, small/large screens, font scaling, dark mode, keyboard, screen reader, slow/offline network, denied permissions နဲ့ app background/foreground cases ဖြင့်စမ်းပါ။ DevTools, tests နဲ့ release build ကိုလိုအပ်သလိုအသုံးပြုပါ။
Quick Quiz 1 / 3
Quick Quiz 2 / 3
Quick Quiz 3 / 3
ဒီသင်ခန်းစာမှာ မှတ်ထားရမယ့်အချက်များ
- Device behavior → Measure + verify → Smooth accessible UI
- Animations, Gestures & Reduced Motion ကို screen တစ်ခုအတွက် style syntax အဖြစ်သာမမြင်ဘဲ Yoga constraints, pixel density, font scaling, safe areas, keyboard, touch target, accessibility tree နဲ့ iOS/Android behavior ကွာခြားမှုတို့ပါသော native UI contract အဖြစ်နားလည်ပါ။
- Simulator တစ်ခု၏ happy path မှန်ရုံဖြင့် real devices, release builds, permissions, accessibility, offline နဲ့ lifecycle paths အားလုံးမှန်ပြီဟုယူဆခြင်း။
- Animations, Gestures & Reduced Motion example ကို Android/iOS, small/large screens, font scaling, dark mode, keyboard, screen reader, slow/offline network, denied permissions နဲ့ app background/foreground cases ဖြင့်စမ်းပါ။ DevTools, tests နဲ့ release build ကိုလိုအပ်သလိုအသုံးပြုပါ။
Animations — React Native