Thuta Learning
ရှာဖွေရန်
ExercisesMobile Developmentintermediate

Practice: Component & Styling Challenges

စိတ်လျှော့ပါ။ ဒီခန်းကို စာအုပ်လိုမဟုတ်ဘဲ စကားပြောသလိုပဲ၊ နားလည်လွယ်အောင် ရှင်းပါမယ်။

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

  • Practice: Component & Styling Challenges ကို ကြောက်စရာမလိုအောင် နားလည်မယ်
  • ကိုယ်တိုင် code ရေးပြီး Expo Go ပေါ်မှာ run ကြည့်တတ်မယ်
  • Real app project ထဲမှာ ဒီ concept ကို ချက်ချင်း အသုံးချတတ်မယ်

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

ဒီ 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 ကို ပိုလွယ်ကူသွားပါလိမ့်မယ်။

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

  • Task 2 (grid) မှာ flexWrap: 'wrap' ကို parent View ထဲ ထည့်ရမှန်း မသိပြီး layout မထွက်ခြင်း
  • Task 3 မှာ props default value (color = '#3b82f6') ကို destructuring ထဲ မထည့်ဘဲ every usage မှာ color ပေးဖို့ မေ့ခြင်း

အခု ကိုယ်တိုင် စမ်းကြည့်

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

You'll know it worked when: Task ၄ ခုစလုံးအတွက် component/screen ကို run-နိုင်တဲ့ code အနေနဲ့ ပြီးမြောက်မည်။

Practice: Component & Styling Challenges | Thuta Learning