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

Mini Project Part 1: Todo App — Setup & UI

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

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

  • Mini Project Part 1: Todo App — Setup & UI ရဲ့ React နဲ့ native platform behavior ကိုရှင်းပြနိုင်ရန်
  • Accessibility, failure နဲ့ lifecycle cases စမ်းနိုင်ရန်
  • Maintainable, testable နဲ့ performant React Native code ရေးနိုင်ရန်

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

Mini Project Part 1: Todo App — Setup & UI ကို ရိုးရိုးလေးနားလည်မယ်

Todo App ရဲ့ UI structure က: header (title), input row (TextInput + Add button), todo list (FlatList), todo item (checkbox + text + delete button) ဆိုပြီး component ၄ ပိုင်း ခွဲထားပါတယ် — component တစ်ခုစီရဲ့ responsibility ကို ရှင်းလင်းစွာ ခွဲထားရင် Part 2 (state logic) ကို ထည့်တဲ့အခါ ပိုလွယ်ကူပါတယ်။

Problem → Why → Solution

ပြဿနာ — ဘာကြောင့် ဒီ concept လိုတာလဲ

Component တစ်ခုတည်းထဲ everything ကို ရေးပြီး Part 2 မှာ state ချိတ်တဲ့အခါ ရှုပ်ထွေးခြင်း — logical section ခွဲထားခြင်းက အရေးကြီး

ဖြစ်လေ့ရှိတဲ့အမှား

flexDirection: 'row' ကို input row ကနေ ချန်ထားခဲ့ပြီး TextInput/button ဘေးချင်းကပ်မနေခြင်း

Core Concept — အလုပ်လုပ်ပုံကိုနားလည်မယ်

Mini Project Part 1: Todo App — Setup & UI ကို Debug build တစ်ခုတည်းဖြင့်မဆုံးဖြတ်ဘဲ release device ပေါ်တွင် startup, JS/UI frame rate, memory, network, crash recovery, permissions, signing နဲ့ store requirements ဖြင့်စစ်ပါ။ New Architecture compatibility နဲ့ dependency support ကို upgrade တိုင်းအတည်ပြုပါ။

Mental Model
  1. Project requirements
  2. Components + state + services
  3. စမ်းသပ်ပြီး UI

Mini Project Part 1: Todo App — Setup & UI ရဲ့ React နဲ့ native platform behavior ကိုရှင်းပြနိုင်ရန်

အဓိက Syntax / Pattern

javascript
import { View, Text, TextInput, TouchableOpacity, FlatList, StyleSheet } from 'react-native';

const placeholderTodos = [
  { id: '1', text: 'React Native လေ့လာမယ်', done: false },
  { id: '2', text: 'Todo app ဆောက်မယ်', done: true },
];

export default function TodoApp() {
  return (
    <View style={styles.container}>
      <Text style={styles.header}>My Todo App</Text>
      <View style={styles.inputRow}>
        <TextInput style={styles.input} placeholder="Add a todo..." />
        <TouchableOpacity style={styles.addButton}>
          <Text style={styles.addButtonText}>Add</Text>
        </TouchableOpacity>
      </View>
      <FlatList
        data={placeholderTodos}
        keyExtractor={(item) => item.id}
        renderItem={({ item }) => (
          <View style={styles.todoItem}>
            <Text>{item.done ? '☑️' : '☐'} {item.text}</Text>
          </View>
        )}
      />
    </View>
  );
}

const styles = StyleSheet.create({
  container: { flex: 1, padding: 16 },
  header: { fontSize: 24, fontWeight: 'bold', marginBottom: 16 },
  inputRow: { flexDirection: 'row', marginBottom: 16 },
  input: { flex: 1, borderWidth: 1, borderColor: '#ccc', borderRadius: 8, padding: 10, marginRight: 8 },
  addButton: { backgroundColor: '#3b82f6', padding: 10, borderRadius: 8, justifyContent: 'center' },
  addButtonText: { color: 'white', fontWeight: '600' },
  todoItem: { padding: 12, borderBottomWidth: 1, borderColor: '#eee' },
});

Mini Project Part 1: Todo App — Setup & UI ကို Debug build တစ်ခုတည်းဖြင့်မဆုံးဖြတ်ဘဲ release device ပေါ်တွင် startup, JS/UI frame rate, memory, network, crash recovery, permissions, signing နဲ့ store requirements ဖြင့်စစ်ပါ။ New Architecture compatibility နဲ့ dependency support ကို upgrade တိုင်းအတည်ပြုပါ။

Code ကို အဆင့်လိုက်ဖတ်မယ်

  1. Project requirementsimport { View, Text, TextInput, TouchableOpacity, Fla...

    Todo App ရဲ့ UI structure က: header (title), input row (TextInput + Add button), todo list (FlatList), todo item (checkbox + text + delete button) ဆိုပြီး component ၄ ပိုင်း ခွဲထားပါတယ် — component တစ်ခုစီရဲ့ responsibility ကို ရှင်းလင်းစွာ ခွဲထားရင် Part 2 (state logic) ကို ထည့်တဲ့အခါ ပိုလွယ်ကူပါတယ်။

  2. Components + state + servicesrenderItem={({ item }) => (

    Mini Project Part 1: Todo App — Setup & UI ကို Debug build တစ်ခုတည်းဖြင့်မဆုံးဖြတ်ဘဲ release device ပေါ်တွင် startup, JS/UI frame rate, memory, network, crash recovery, permissions, signing နဲ့ store requirements ဖြင့်စစ်ပါ။ New Architecture compatibility နဲ့ dependency support ကို upgrade တိုင်းအတည်ပြုပါ။

  3. စမ်းသပ်ပြီး UI});

    Mini Project Part 1: Todo App — Setup & UI 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. Project requirements
  2. Components + state + services
  3. စမ်းသပ်ပြီး UI

Success

Mini Project Part 1: Todo App — Setup & UI ရဲ့ React နဲ့ native platform behavior ကိုရှင်းပြနိုင်ရန်

Failure

Component တစ်ခုတည်းထဲ everything ကို ရေးပြီး Part 2 မှာ state ချိတ်တဲ့အခါ ရှုပ်ထွေးခြင်း — logical section ခွဲထားခြင်းက အရေးကြီး

ခဏလေး ဒီလိုပဲ စဉ်းစားကြည့်

Todo App ရဲ့ UI structure က: header (title), input row (TextInput + Add button), todo list (FlatList), todo item (checkbox + text + delete button) ဆိုပြီး component ၄ ပိုင်း ခွဲထားပါတယ် — component တစ်ခုစီရဲ့ responsibility ကို ရှင်းလင်းစွာ ခွဲထားရင် Part 2 (state logic) ကို ထည့်တဲ့အခါ ပိုလွယ်ကူပါတယ်။

လက်တွေ့ scenario နဲ့ ချိတ်ကြည့်မယ်

Header, input row, todo list section ၃ ခုကို View ဖြင့် ခွဲထားပြီး flexbox (flexDirection: row for input row) ကို သုံးပါ — ဒီအဆင့်မှာ state ကို static array (placeholder data) နဲ့ hardcode ထားရုံပါ, Part 2 မှာ useState ချိတ်ဆက်ပါမယ်။ TouchableOpacity ကို 'Add' button, checkbox icon (☐/☑️), delete icon (🗑️) အတွက် သုံးပါ။

Code နမူနာ

javascript
import { View, Text, TextInput, TouchableOpacity, FlatList, StyleSheet } from 'react-native';

const placeholderTodos = [
  { id: '1', text: 'React Native လေ့လာမယ်', done: false },
  { id: '2', text: 'Todo app ဆောက်မယ်', done: true },
];

export default function TodoApp() {
  return (
    <View style={styles.container}>
      <Text style={styles.header}>My Todo App</Text>
      <View style={styles.inputRow}>
        <TextInput style={styles.input} placeholder="Add a todo..." />
        <TouchableOpacity style={styles.addButton}>
          <Text style={styles.addButtonText}>Add</Text>
        </TouchableOpacity>
      </View>
      <FlatList
        data={placeholderTodos}
        keyExtractor={(item) => item.id}
        renderItem={({ item }) => (
          <View style={styles.todoItem}>
            <Text>{item.done ? '☑️' : '☐'} {item.text}</Text>
          </View>
        )}
      />
    </View>
  );
}

const styles = StyleSheet.create({
  container: { flex: 1, padding: 16 },
  header: { fontSize: 24, fontWeight: 'bold', marginBottom: 16 },
  inputRow: { flexDirection: 'row', marginBottom: 16 },
  input: { flex: 1, borderWidth: 1, borderColor: '#ccc', borderRadius: 8, padding: 10, marginRight: 8 },
  addButton: { backgroundColor: '#3b82f6', padding: 10, borderRadius: 8, justifyContent: 'center' },
  addButtonText: { color: 'white', fontWeight: '600' },
  todoItem: { padding: 12, borderBottomWidth: 1, borderColor: '#eee' },
});
You should see
Header, input row, placeholder todo list ၂ ခု ပါတဲ့ static UI screen တစ်ခု ပြီးစီးမည်။

၅ မိနစ် စမ်းကြည့်

ဒီ UI structure ကို ကိုယ်တိုင် ရိုက်ထည့်ပြီး Expo Go ပေါ်မှာ run ကြည့်ပါ — placeholder data ၂ ခုကို ကိုယ်ပိုင် todo item စာသားနဲ့ ပြောင်းကြည့်ပါ။

သတိလေးတစ်ချက်

ဒီအဆင့်မှာ Add button/checkbox ကို press ကြည့်လည်း ဘာမှ မဖြစ်သေးပါဘူး (event handler မထည့်ရသေး) — Part 2 မှာ state logic ထည့်မှ interactive ဖြစ်လာမှာပါ။

Real-world usage

လက်တွေ့ Project မှာ ဘယ်လိုသုံးမလဲ

Mini Project Part 1: Todo App — Setup & UI 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

ကိုယ်တိုင်တည်ဆောက်ကြည့်ပါ

Mini Project Part 1: Todo App — Setup & UI 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, TextInput, TouchableOpacity, FlatList, StyleSheet } from 'react-native';

const placeholderTodos = [
  { id: '1', text: 'React Native လေ့လာမယ်', done: false },
  { id: '2', text: 'Todo app ဆောက်မယ်', done: true },
];

export default function TodoApp() {
  return (
    <View style={styles.container}>
      <Text style={styles.header}>My Todo App</Text>
      <View style={styles.inputRow}>
        <TextInput style={styles.input} placeholder="Add a todo..." />
        <TouchableOpacity style={styles.addButton}>
          <Text style={styles.addButtonText}>Add</Text>
        </TouchableOpacity>
      </View>
      <FlatList
        data={placeholderTodos}
        keyExtractor={(item) => item.id}
        renderItem={({ item }) => (
          <View style={styles.todoItem}>
            <Text>{item.done ? '☑️' : '☐'} {item.text}</Text>
          </View>
        )}
      />
    </View>
  );
}

const styles = StyleSheet.create({
  container: { flex: 1, padding: 16 },
  header: { fontSize: 24, fontWeight: 'bold', marginBottom: 16 },
  inputRow: { flexDirection: 'row', marginBottom: 16 },
  input: { flex: 1, borderWidth: 1, borderColor: '#ccc', borderRadius: 8, padding: 10, marginRight: 8 },
  addButton: { backgroundColor: '#3b82f6', padding: 10, borderRadius: 8, justifyContent: 'center' },
  addButtonText: { color: 'white', fontWeight: '600' },
  todoItem: { padding: 12, borderBottomWidth: 1, borderColor: '#eee' },
});

ရလဒ်: Mini Project Part 1: Todo App — Setup & UI ရဲ့ React နဲ့ native platform behavior ကိုရှင်းပြနိုင်ရန်

အရိပ်အမြွက် ကြည့်ရန်

Mini Project Part 1: Todo App — Setup & UI 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

Mini Project Part 1: Todo App — Setup & UI ရဲ့ အဓိကသဘောတရားက ဘာလဲ။

Quick Quiz 2 / 3

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

Quick Quiz 3 / 3

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

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

  • Project requirements → Components + state + services → စမ်းသပ်ပြီး UI
  • Mini Project Part 1: Todo App — Setup & UI ကို Debug build တစ်ခုတည်းဖြင့်မဆုံးဖြတ်ဘဲ release device ပေါ်တွင် startup, JS/UI frame rate, memory, network, crash recovery, permissions, signing နဲ့ store requirements ဖြင့်စစ်ပါ။ New Architecture compatibility နဲ့ dependency support ကို upgrade တိုင်းအတည်ပြုပါ။
  • Component တစ်ခုတည်းထဲ everything ကို ရေးပြီး Part 2 မှာ state ချိတ်တဲ့အခါ ရှုပ်ထွေးခြင်း — logical section ခွဲထားခြင်းက အရေးကြီး
  • Mini Project Part 1: Todo App — Setup & UI 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 Documentation — React Native

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

  • Component တစ်ခုတည်းထဲ everything ကို ရေးပြီး Part 2 မှာ state ချိတ်တဲ့အခါ ရှုပ်ထွေးခြင်း — logical section ခွဲထားခြင်းက အရေးကြီး
  • flexDirection: 'row' ကို input row ကနေ ချန်ထားခဲ့ပြီး TextInput/button ဘေးချင်းကပ်မနေခြင်း
  • Simulator တစ်ခု၏ happy path မှန်ရုံဖြင့် real devices, release builds, permissions, accessibility, offline နဲ့ lifecycle paths အားလုံးမှန်ပြီဟုယူဆခြင်း။

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

Mini Project Part 1: Todo App — Setup & UI 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 ကိုလိုအပ်သလိုအသုံးပြုပါ။

အလုပ်ဖြစ်ကြောင်း ဒီလိုသိမယ်: Header, input row, placeholder todo list ၂ ခု ပါတဲ့ static UI screen တစ်ခု ပြီးစီးမည်။

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

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

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

Mini Project Part 1: Todo App — Setup & UI | Thuta Learning