Thuta Learning
React Native
BasicMobile Developmentအလယ်အလတ်

Your First App — Hello World

React Nativeသင်ခန်းစာ 320 မိနစ်

ဒီခန်းပြီးရင် ဘာတတ်သွားမလဲ

  • Your First App — Hello World ရဲ့ React နဲ့ native platform behavior ကိုရှင်းပြနိုင်ရန်
  • Accessibility, failure နဲ့ lifecycle cases စမ်းနိုင်ရန်
  • Maintainable, testable နဲ့ performant React Native code ရေးနိုင်ရန်

ရိုးရိုးလေး ရှင်းပြမယ်

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 ကိုရှင်းပါ။

Mental Model
  1. JavaScript state
  2. Native component + layout
  3. Android / iOS UI

Your First App — Hello World ရဲ့ React နဲ့ native platform behavior ကိုရှင်းပြနိုင်ရန်

အဓိက Syntax / Pattern

javascript
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 ကို အဆင့်လိုက်ဖတ်မယ်

  1. JavaScript stateimport { 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 သလိုပါပဲ)။

  2. Native component + layoutconst 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 ကိုရှင်းပါ။

  3. 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 ကိုလိုအပ်သလိုအသုံးပြုပါ။

Execution Flow
  1. JavaScript state
  2. Native component + layout
  3. 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 နမူနာ

javascript
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',
  },
});
You should see
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 ကိုခန့်မှန်းပါ
javascript
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

Your First App — Hello World ရဲ့ အဓိကသဘောတရားက ဘာလဲ။

Quick Quiz 2 / 3

ဘယ်အမှားကို အရင်ဆုံးရှောင်သင့်လဲ။

Quick Quiz 3 / 3

Real project မှာ ဘယ်လိုအသုံးချသင့်လဲ။

ဒီသင်ခန်းစာမှာ မှတ်ထားရမယ့်အချက်များ

  • 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

ဒီနေရာမှာ လူအများမှားတတ်တယ်

  • <Text> component အပြင်ဘက် raw string ကို JSX ထဲ တိုက်ရိုက် ရေးထားခြင်း (React Native မှာ text ကို <Text> နဲ့ wrap မထားရင် error ဖြစ်)
  • StyleSheet.create ကို object literal အဖြစ် သုံးမယ့်အစား array/string အဖြစ် ရေးမိခြင်း
  • Simulator တစ်ခု၏ happy path မှန်ရုံဖြင့် real devices, release builds, permissions, accessibility, offline နဲ့ lifecycle paths အားလုံးမှန်ပြီဟုယူဆခြင်း။

လက်တွေ့လေ့ကျင့်ခန်း

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 ကိုလိုအပ်သလိုအသုံးပြုပါ။

အလုပ်ဖြစ်ကြောင်း ဒီလိုသိမယ်: Phone ပေါ်မှာ 'ကျွန်တော့် ပထမဆုံး React Native app!' ဆိုတဲ့ message center မှာ ပေါ်လာမည်။

နောက်ဆုံးပြင်ဆင်ရက်

Progress ကို ဤ browser (ဤစက်) တွင်သာ သိမ်းထားပါသည်။ အခြားစက်များနှင့် sync မလုပ်ပါ။

ဤသင်ခန်းစာတွင် အမှားတွေ့ပါက အကြောင်းကြားရန်သင့် email app ကို ဤသင်ခန်းစာလိပ်စာ ဖြည့်ပြီးသားဖြင့် ဖွင့်ပေးပါမည် — သင်ကိုယ်တိုင် ပို့မှသာ ပို့မည်ဖြစ်သည်။

Your First App — Hello World | Thuta Learning