နားလည်ထားရမယ့် အချက်
Mobile framework တိုင်းမှာ screen တွေကြားရွှေ့ဖို့ ကိုယ်ပိုင် navigation API ရှိပေမယ့် အောက်ခြေမှာ universal pattern အနည်းငယ်တည်းပဲ ရှိနေပါတယ်။ ဒါကို သိထားရင် framework ဘယ်ခုမဆိုမှာ navigation ကို reasoning လုပ်နိုင်ပါတယ်။
- Stack — Home -> Course -> Lesson, back button က last in, first out ပုံစံ pop ချသည်
- Tabs — Home/Search/Downloads/Profile ကဲ့သို့ parallel top-level section
- Drawer — side menu နောက်ကွယ်က destination list, Android မှာ ပိုအသုံးများသည်
- Modal — ယာယီ focused overlay, confirmation/create-item အတွက်
- Deep Link — app အပြင်ဘက်က specific screen တစ်ခုကို တိုက်ရိုက်ဖွင့်ခြင်း
Modal ကို အလွန်အကျွံမသုံးပါနှင့်
Full screen တစ်ခုသင့်တော်တဲ့ content အတွက် modal ကို အသုံးပြုတာဟာ ရှောင်သင့်တဲ့ design mistake တစ်ခုဖြစ်ပါတယ်။
- Stack Navigation
- screen တွေကို push/pop လုပ်ပြီး last-in-first-out ပုံစံ ရွှေ့ကြသည့် navigation pattern — back button/gesture က stack ရဲ့ အပေါ်ဆုံး screen ကို ဖယ်ချသည်။
- Deep Link
- notification, external link, app တခြားတစ်ခု စတဲ့ app အပြင်ဘက်က source တစ်ခုက app အတွင်း specific screen တစ်ခုကို တိုက်ရိုက် ဖွင့်ပေးသော mechanism။
FOUR NAVIGATION PATTERNS
------------------------
FOUR NAVIGATION PATTERNS
-----
STACK (push/pop, LIFO) TABS (parallel sections)
Home -> Course -> Lesson [Home][Search][Downloads][Profile]
<- back pops top ^ tap switches instantly
DRAWER (side menu) MODAL (temporary overlay)
+------------------+ current screen
| = menu | +----------------+
| Home | | Confirm Delete |
| Settings | +----------------+
| Logout | dismiss -> back to screen
+------------------+လက်တွေ့ scenario နဲ့ ချိတ်ကြည့်မယ်
Real app အများစုဟာ pattern တစ်ခုတည်းကို ရွေးမယ့်အစား pattern အများကို ပေါင်းစပ်သုံးကြပါတယ် — top-level tabs အထဲမှာ tab တစ်ခုစီအတွက် stack navigator ခွဲထားလေ့ရှိသည်။
tab ပြောင်းရင်တောင် tab တစ်ခုစီရဲ့ stack ကို background မှာ သီးခြားစီ ထိန်းသိမ်းထားပြီး, Modal တွေက short-lived focused task တွေအတွက် ဒီ structure အပေါ် layer ချထားကြသည်။
Deep Link က ဒီအားလုံးကို ချိတ်ဆက်ပေးသည်
lesson အသစ်အကြောင်း push notification တစ်ခုဟာ generic home screen မှာ ချထားမယ့်အစား correct tab ရဲ့ stack အထဲက lesson screen ကို တိုက်ရိုက် ဖွင့်ပေးနိုင်သည်။
အတူတူ စမ်းရေးကြည့်မယ်
function createNavigationStack(initialScreen) {
const stack = [initialScreen];
return {
push(screen) {
stack.push(screen);
return { currentScreen: screen, depth: stack.length };
},
pop() {
if (stack.length > 1) stack.pop();
return { currentScreen: stack[stack.length - 1], depth: stack.length };
}
};
}
const courseNav = createNavigationStack("Home");
console.log("push Course:", JSON.stringify(courseNav.push("Course")));
console.log("push Lesson:", JSON.stringify(courseNav.push("Lesson")));
console.log("pop (back):", JSON.stringify(courseNav.pop()));
console.log("pop (back):", JSON.stringify(courseNav.pop()));push Course: {"currentScreen":"Course","depth":2}
push Lesson: {"currentScreen":"Lesson","depth":3}
pop (back): {"currentScreen":"Course","depth":2}
pop (back): {"currentScreen":"Home","depth":1}
Home ကနေ Course, Lesson ဆီ push နှစ်ကြိမ်လုပ်ပြီးနောက် pop နှစ်ကြိမ်က stack ကို depth 1 (Home) ဆီ last-in-first-out အတိုင်း ပြန်ချသွားသည်ကို တွေ့ရသည်။၅ မိနစ် စမ်းကြည့်
`createNavigationStack` ထဲ `reset(screen)` method တစ်ခု ထပ်ထည့်ပါ — stack ကို screen တစ်ခုတည်းအထိ ရှင်းချပေးမည့် method (logout ပြီး Home ဆီ ပြန်သွားတဲ့ flow အတွက် အသုံးဝင်) — push အနည်းငယ်ပါတဲ့ sequence တစ်ခုနဲ့ စမ်းသပ်ပါ။
သတိလေးတစ်ချက်
Modal ကို full screen သင့်တော်တဲ့ content (ရှည်လျားတဲ့ form, browsing experience) အတွက် အလွန်အကျွံ သုံးခြင်း
Deep link တစ်ခုကို correct tab ရဲ့ stack context ထဲ ထည့်စဉ်းစားမထားဘဲ generic entry point တစ်ခုအဖြစ်သာ ဆက်ဆံခြင်း
Navigation — Android Developers — How Mobile Apps Work