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

Practice: Component & Styling Challenges

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

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

  • Practice: Component & Styling Challenges ရဲ့ React နဲ့ native platform behavior ကိုရှင်းပြနိုင်ရန်
  • Accessibility, failure နဲ့ lifecycle cases စမ်းနိုင်ရန်
  • Maintainable, testable နဲ့ performant React Native code ရေးနိုင်ရန်

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

Practice: Component & Styling Challenges ကို ရိုးရိုးလေးနားလည်မယ်

ဒီ practice set က new concept မဟုတ်ဘဲ Basic chapter ရဲ့ core component/styling/flexbox knowledge ကို hands-on task ၄ ခုနဲ့ ပြန်ကျင့်သားရအောင် ဒီဇိုင်းလုပ်ထားပါတယ်။

Problem → Why → Solution

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

Task 2 (grid) မှာ flexWrap: 'wrap' ကို parent View ထဲ ထည့်ရမှန်း မသိပြီး layout မထွက်ခြင်း

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

Task 3 မှာ props default value (color = '#3b82f6') ကို destructuring ထဲ မထည့်ဘဲ every usage မှာ color ပေးဖို့ မေ့ခြင်း

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

Practice: Component & Styling Challenges ကို 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. လိုအပ်ချက်
  2. စဉ်းစားပြီး implement
  3. စမ်းသပ်ပြီးရှင်းပြ

Practice: Component & Styling Challenges ရဲ့ React နဲ့ native platform behavior ကိုရှင်းပြနိုင်ရန်

အဓိက Syntax / Pattern

javascript
// Task 3 starter — make this Button reusable via props
function CustomButton({ label, onPress, color = '#3b82f6' }) {
  return (
    <TouchableOpacity style={[styles.button, { backgroundColor: color }]} onPress={onPress}>
      <Text style={styles.buttonText}>{label}</Text>
    </TouchableOpacity>
  );
}
// Try: <CustomButton label="Save" color="#10b981" onPress={...} />

Practice: Component & Styling Challenges ကို 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. လိုအပ်ချက်// Task 3 starter — make this Button reusable via props

    ဒီ practice set က new concept မဟုတ်ဘဲ Basic chapter ရဲ့ core component/styling/flexbox knowledge ကို hands-on task ၄ ခုနဲ့ ပြန်ကျင့်သားရအောင် ဒီဇိုင်းလုပ်ထားပါတယ်။

  2. စဉ်းစားပြီး implement<Text style={styles.buttonText}>{label}</Text>

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

  3. စမ်းသပ်ပြီးရှင်းပြ// Try: <CustomButton label="Save" color="#10b981" on...

    Practice: Component & Styling Challenges 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. လိုအပ်ချက်
  2. စဉ်းစားပြီး implement
  3. စမ်းသပ်ပြီးရှင်းပြ

Success

Practice: Component & Styling Challenges ရဲ့ React နဲ့ native platform behavior ကိုရှင်းပြနိုင်ရန်

Failure

Task 2 (grid) မှာ flexWrap: 'wrap' ကို parent View ထဲ ထည့်ရမှန်း မသိပြီး layout မထွက်ခြင်း

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

ဒီ practice set က new concept မဟုတ်ဘဲ Basic chapter ရဲ့ core component/styling/flexbox knowledge ကို hands-on task ၄ ခုနဲ့ ပြန်ကျင့်သားရအောင် ဒီဇိုင်းလုပ်ထားပါတယ်။

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

Task ၄ ခု — (1) Profile card component ဆောက်ပါ (avatar image, name, bio, flexDirection: row ဖြင့် icon row), (2) ၃-column grid layout ဆောက်ပါ (flexWrap: 'wrap' သုံး), (3) Custom button component ဆောက်ပါ (props: label, onPress, color — reusable ဖြစ်အောင်), (4) Card list (FlatList) ဆောက်ပြီး alternate row color (index % 2 အသုံးပြု) ထည့်ပါ။

Code နမူနာ

javascript
// Task 3 starter — make this Button reusable via props
function CustomButton({ label, onPress, color = '#3b82f6' }) {
  return (
    <TouchableOpacity style={[styles.button, { backgroundColor: color }]} onPress={onPress}>
      <Text style={styles.buttonText}>{label}</Text>
    </TouchableOpacity>
  );
}
// Try: <CustomButton label="Save" color="#10b981" onPress={...} />
You should see
Task ၄ ခုစလုံးအတွက် component/screen ကို run-နိုင်တဲ့ code အနေနဲ့ ပြီးမြောက်မည်။

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

Task ၄ ခုကို အစဉ်လိုက် ကိုယ်တိုင် implement လုပ်ကြည့်ပါ — code sample ကို ကြည့်ခင် ကိုယ်တိုင် စဉ်းစားကြိုးစားပါ။

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

Task တစ်ခုစီကို ပြီးအောင်မလုပ်ခင် နောက် task ကို မကူးပါနှင့် — layout/component concept တစ်ခုချင်းစီကို solid အောင် လေ့ကျင့်မှ Project chapter ကို ပိုလွယ်ကူသွားပါလိမ့်မယ်။

Real-world usage

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

Practice: Component & Styling Challenges 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

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

Practice: Component & Styling Challenges 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
// Task 3 starter — make this Button reusable via props
function CustomButton({ label, onPress, color = '#3b82f6' }) {
  return (
    <TouchableOpacity style={[styles.button, { backgroundColor: color }]} onPress={onPress}>
      <Text style={styles.buttonText}>{label}</Text>
    </TouchableOpacity>
  );
}
// Try: <CustomButton label="Save" color="#10b981" onPress={...} />

ရလဒ်: Practice: Component & Styling Challenges ရဲ့ React နဲ့ native platform behavior ကိုရှင်းပြနိုင်ရန်

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

Practice: Component & Styling Challenges 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

Practice: Component & Styling Challenges ရဲ့ အဓိကသဘောတရားက ဘာလဲ။

Quick Quiz 2 / 3

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

Quick Quiz 3 / 3

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

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

  • လိုအပ်ချက် → စဉ်းစားပြီး implement → စမ်းသပ်ပြီးရှင်းပြ
  • Practice: Component & Styling Challenges ကို Debug build တစ်ခုတည်းဖြင့်မဆုံးဖြတ်ဘဲ release device ပေါ်တွင် startup, JS/UI frame rate, memory, network, crash recovery, permissions, signing နဲ့ store requirements ဖြင့်စစ်ပါ။ New Architecture compatibility နဲ့ dependency support ကို upgrade တိုင်းအတည်ပြုပါ။
  • Task 2 (grid) မှာ flexWrap: 'wrap' ကို parent View ထဲ ထည့်ရမှန်း မသိပြီး layout မထွက်ခြင်း
  • Practice: Component & Styling Challenges 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

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

  • Task 2 (grid) မှာ flexWrap: 'wrap' ကို parent View ထဲ ထည့်ရမှန်း မသိပြီး layout မထွက်ခြင်း
  • Task 3 မှာ props default value (color = '#3b82f6') ကို destructuring ထဲ မထည့်ဘဲ every usage မှာ color ပေးဖို့ မေ့ခြင်း
  • Simulator တစ်ခု၏ happy path မှန်ရုံဖြင့် real devices, release builds, permissions, accessibility, offline နဲ့ lifecycle paths အားလုံးမှန်ပြီဟုယူဆခြင်း။

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

Practice: Component & Styling Challenges 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 ကိုလိုအပ်သလိုအသုံးပြုပါ။

အလုပ်ဖြစ်ကြောင်း ဒီလိုသိမယ်: Task ၄ ခုစလုံးအတွက် component/screen ကို run-နိုင်တဲ့ code အနေနဲ့ ပြီးမြောက်မည်။

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

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

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

Practice: Component & Styling Challenges | Thuta Learning