ရိုးရိုးလေး ရှင်းပြမယ်
Strict TypeScript API & Safe Component Contracts ကို ရိုးရိုးလေးနားလည်မယ်
Strict TypeScript API & Safe Component Contracts ကို React Native 0.87, React 19.2, Hermes V1, Fabric renderer, TurboModules နဲ့ Strict TypeScript API တို့ဆက်နွယ်နေသော cross-platform system အဖြစ်နားလည်ပါ။ Shared JavaScript/TypeScript code နဲ့ platform-specific native behavior တို့၏ boundary ကိုရှင်းပါ။
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 — အလုပ်လုပ်ပုံကိုနားလည်မယ်
Strict TypeScript API & Safe Component Contracts ကို React Native 0.87, React 19.2, Hermes V1, Fabric renderer, TurboModules နဲ့ Strict TypeScript API တို့ဆက်နွယ်နေသော cross-platform system အဖြစ်နားလည်ပါ။ Shared JavaScript/TypeScript code နဲ့ platform-specific native behavior တို့၏ boundary ကိုရှင်းပါ။
- Request / permission
- Native module boundary
- Result / error / cleanup
Strict TypeScript API & Safe Component Contracts ရဲ့ React နဲ့ native platform behavior ကိုရှင်းပြနိုင်ရန်
အဓိက Syntax / Pattern
import { useRef } from 'react';
import { TextInput, type TextInputInstance } from 'react-native';
type SearchProps = {
value: string;
onChange: (value: string) => void;
};
export function Search({ value, onChange }: SearchProps) {
const ref = useRef<TextInputInstance>(null);
return <TextInput
ref={ref}
value={value}
onChangeText={onChange}
accessibilityLabel="Search tasks"
/>;
}Strict TypeScript API & Safe Component Contracts ကို React Native 0.87, React 19.2, Hermes V1, Fabric renderer, TurboModules နဲ့ Strict TypeScript API တို့ဆက်နွယ်နေသော cross-platform system အဖြစ်နားလည်ပါ။ Shared JavaScript/TypeScript code နဲ့ platform-specific native behavior တို့၏ boundary ကိုရှင်းပါ။
Code ကို အဆင့်လိုက်ဖတ်မယ်
- Request / permission
import { useRef } from 'react';Strict TypeScript API & Safe Component Contracts ကို React Native 0.87, React 19.2, Hermes V1, Fabric renderer, TurboModules နဲ့ Strict TypeScript API တို့ဆက်နွယ်နေသော cross-platform system အဖြစ်နားလည်ပါ။ Shared JavaScript/TypeScript code နဲ့ platform-specific native behavior တို့၏ boundary ကိုရှင်းပါ။
- Native module boundary
const ref = useRef<TextInputInstance>(null);Strict TypeScript API & Safe Component Contracts ကို React Native 0.87, React 19.2, Hermes V1, Fabric renderer, TurboModules နဲ့ Strict TypeScript API တို့ဆက်နွယ်နေသော cross-platform system အဖြစ်နားလည်ပါ။ Shared JavaScript/TypeScript code နဲ့ platform-specific native behavior တို့၏ boundary ကိုရှင်းပါ။
- Result / error / cleanup
}Strict TypeScript API & Safe Component Contracts 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 ကိုလိုအပ်သလိုအသုံးပြုပါ။
- Request / permission
- Native module boundary
- Result / error / cleanup
Success
Strict TypeScript API & Safe Component Contracts ရဲ့ React နဲ့ native platform behavior ကိုရှင်းပြနိုင်ရန်
Failure
Simulator တစ်ခု၏ happy path မှန်ရုံဖြင့် real devices, release builds, permissions, accessibility, offline နဲ့ lifecycle paths အားလုံးမှန်ပြီဟုယူဆခြင်း။
Strict TypeScript API & Safe Component Contracts ကို React Native 0.87, React 19.2, Hermes V1, Fabric renderer, TurboModules နဲ့ Strict TypeScript API တို့ဆက်နွယ်နေသော cross-platform system အဖြစ်နားလည်ပါ။ Shared JavaScript/TypeScript code နဲ့ platform-specific native behavior တို့၏ boundary ကိုရှင်းပါ။
import { useRef } from 'react';
import { TextInput, type TextInputInstance } from 'react-native';
type SearchProps = {
value: string;
onChange: (value: string) => void;
};
export function Search({ value, onChange }: SearchProps) {
const ref = useRef<TextInputInstance>(null);
return <TextInput
ref={ref}
value={value}
onChangeText={onChange}
accessibilityLabel="Search tasks"
/>;
}Root imports နဲ့ generated React Native types က component contract ကိုစစ်ပေးမည်။Real-world usage
လက်တွေ့ Project မှာ ဘယ်လိုသုံးမလဲ
Strict TypeScript API & Safe Component Contracts 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
ကိုယ်တိုင်တည်ဆောက်ကြည့်ပါ
Strict TypeScript API & Safe Component Contracts 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 { TextInput, type TextInputInstance } from 'react-native';
type SearchProps = {
value: string;
onChange: (value: string) => void;
};
export function Search({ value, onChange }: SearchProps) {
const ref = useRef<TextInputInstance>(null);
return <TextInput
ref={ref}
value={value}
onChangeText={onChange}
accessibilityLabel="Search tasks"
/>;
}ရလဒ်: Strict TypeScript API & Safe Component Contracts ရဲ့ React နဲ့ native platform behavior ကိုရှင်းပြနိုင်ရန်
အရိပ်အမြွက် ကြည့်ရန်
Strict TypeScript API & Safe Component Contracts 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
ဒီသင်ခန်းစာမှာ မှတ်ထားရမယ့်အချက်များ
- Request / permission → Native module boundary → Result / error / cleanup
- Strict TypeScript API & Safe Component Contracts ကို React Native 0.87, React 19.2, Hermes V1, Fabric renderer, TurboModules နဲ့ Strict TypeScript API တို့ဆက်နွယ်နေသော cross-platform system အဖြစ်နားလည်ပါ။ Shared JavaScript/TypeScript code နဲ့ platform-specific native behavior တို့၏ boundary ကိုရှင်းပါ။
- Simulator တစ်ခု၏ happy path မှန်ရုံဖြင့် real devices, release builds, permissions, accessibility, offline နဲ့ lifecycle paths အားလုံးမှန်ပြီဟုယူဆခြင်း။
- Strict TypeScript API & Safe Component Contracts 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 ကိုလိုအပ်သလိုအသုံးပြုပါ။
React Native 0.87 Release — React Native