ရိုးရိုးလေး ရှင်းပြမယ်
Your First App — Hello World ကို ရိုးရိုးလေးနားလည်မယ်
Expo project ရဲ့ entry point က App.js (သို့) App.tsx ဖြစ်ပြီး, React component function တစ်ခုကို default export လုပ်ထားပါတယ် — React web app ရဲ့ App.js နဲ့ structure အခြေခံတူပါတယ်။ Component ထဲမှာ JSX ကို return လုပ်ရပြီး, root element ကို <View> နဲ့ wrap ရပါတယ် (React web မှာ <div> wrap သလိုပါပဲ)။
Problem → Why → Solution
ပြဿနာ — ဘာကြောင့် ဒီ concept လိုတာလဲ
<Text> component အပြင်ဘက် raw string ကို JSX ထဲ တိုက်ရိုက် ရေးထားခြင်း (React Native မှာ text ကို <Text> နဲ့ wrap မထားရင် error ဖြစ်)
ဖြစ်လေ့ရှိတဲ့အမှား
StyleSheet.create ကို object literal အဖြစ် သုံးမယ့်အစား array/string အဖြစ် ရေးမိခြင်း
Core Concept — အလုပ်လုပ်ပုံကိုနားလည်မယ်
Your First App — Hello World ကို 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 ကိုရှင်းပါ။
- JavaScript state
- Native component + layout
- Android / iOS UI
Your First App — Hello World ရဲ့ React နဲ့ native platform behavior ကိုရှင်းပြနိုင်ရန်
အဓိက Syntax / Pattern
import { View, Text, StyleSheet } from 'react-native';
export default function App() {
return (
<View style={styles.container}>
<Text>ကျွန်တော့် ပထမဆုံး React Native app!</Text>
</View>
);
}
const styles = StyleSheet.create({
container: {
flex: 1,
backgroundColor: '#fff',
alignItems: 'center',
justifyContent: 'center',
},
});Your First App — Hello World ကို 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 ကို အဆင့်လိုက်ဖတ်မယ်
- JavaScript state
import { View, Text, StyleSheet } from 'react-native';Expo project ရဲ့ entry point က App.js (သို့) App.tsx ဖြစ်ပြီး, React component function တစ်ခုကို default export လုပ်ထားပါတယ် — React web app ရဲ့ App.js နဲ့ structure အခြေခံတူပါတယ်။ Component ထဲမှာ JSX ကို return လုပ်ရပြီး, root element ကို <View> နဲ့ wrap ရပါတယ် (React web မှာ <div> wrap သလိုပါပဲ)။
- Native component + layout
const styles = StyleSheet.create({Your First App — Hello World ကို 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 ကိုရှင်းပါ။
- Android / iOS UI
});Your First App — Hello World 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 ကိုလိုအပ်သလိုအသုံးပြုပါ။
- JavaScript state
- Native component + layout
- Android / iOS UI
Success
Your First App — Hello World ရဲ့ React နဲ့ native platform behavior ကိုရှင်းပြနိုင်ရန်
Failure
<Text> component အပြင်ဘက် raw string ကို JSX ထဲ တိုက်ရိုက် ရေးထားခြင်း (React Native မှာ text ကို <Text> နဲ့ wrap မထားရင် error ဖြစ်)
ခဏလေး ဒီလိုပဲ စဉ်းစားကြည့်
Expo project ရဲ့ entry point က App.js (သို့) App.tsx ဖြစ်ပြီး, React component function တစ်ခုကို default export လုပ်ထားပါတယ် — React web app ရဲ့ App.js နဲ့ structure အခြေခံတူပါတယ်။ Component ထဲမှာ JSX ကို return လုပ်ရပြီး, root element ကို <View> နဲ့ wrap ရပါတယ် (React web မှာ <div> wrap သလိုပါပဲ)။
လက်တွေ့ scenario နဲ့ ချိတ်ကြည့်မယ်
App.js ထဲက <Text>Open up App.js to start working on your app!</Text> ဆိုတဲ့ line ကို ကိုယ်ပိုင် message နဲ့ ပြောင်းရေးပြီး save လိုက်ရင် phone ပေါ်ရှိ Expo Go app က hot reload ဖြင့် ချက်ချင်း update ပြပါလိမ့်မယ် — save-and-see ဆိုတဲ့ fast iteration loop ကို ခံစားရမှာပါ။
Code နမူနာ
import { View, Text, StyleSheet } from 'react-native';
export default function App() {
return (
<View style={styles.container}>
<Text>ကျွန်တော့် ပထမဆုံး React Native app!</Text>
</View>
);
}
const styles = StyleSheet.create({
container: {
flex: 1,
backgroundColor: '#fff',
alignItems: 'center',
justifyContent: 'center',
},
});Phone ပေါ်မှာ 'ကျွန်တော့် ပထမဆုံး React Native app!' ဆိုတဲ့ message center မှာ ပေါ်လာမည်။၅ မိနစ် စမ်းကြည့်
App.js ထဲက Text message ကို ကိုယ်ပိုင်စကားလုံးနဲ့ ပြောင်းရေးပြီး save လိုက်ကာ phone ပေါ်မှာ update ဖြစ်တာ ကြည့်ပါ။
သတိလေးတစ်ချက်
React Native မှာ text (string) ကို <Text> component ထဲမှာပဲ ရေးရပါတယ် — <View> ထဲ တိုက်ရိုက် string ထည့်ရင် error ပေါ်ပါလိမ့်မယ်, HTML မှာလို free-floating text မရပါဘူး။
Real-world usage
လက်တွေ့ Project မှာ ဘယ်လိုသုံးမလဲ
Your First App — Hello World 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
ကိုယ်တိုင်တည်ဆောက်ကြည့်ပါ
Your First App — Hello World 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 { View, Text, StyleSheet } from 'react-native';
export default function App() {
return (
<View style={styles.container}>
<Text>ကျွန်တော့် ပထမဆုံး React Native app!</Text>
</View>
);
}
const styles = StyleSheet.create({
container: {
flex: 1,
backgroundColor: '#fff',
alignItems: 'center',
justifyContent: 'center',
},
});ရလဒ်: Your First App — Hello World ရဲ့ React နဲ့ native platform behavior ကိုရှင်းပြနိုင်ရန်
အရိပ်အမြွက် ကြည့်ရန်
Your First App — Hello World 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
ဒီသင်ခန်းစာမှာ မှတ်ထားရမယ့်အချက်များ
- JavaScript state → Native component + layout → Android / iOS UI
- Your First App — Hello World ကို 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 ကိုရှင်းပါ။
- <Text> component အပြင်ဘက် raw string ကို JSX ထဲ တိုက်ရိုက် ရေးထားခြင်း (React Native မှာ text ကို <Text> နဲ့ wrap မထားရင် error ဖြစ်)
- Your First App — Hello World 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