Stack Navigation
Screens that slide in and out as iOS and Android apps do, with a swipe back: a settings app three screens deep, in a <lynx-stack-outlet>. Tap a row to open it, and drag a screen to the right to go back.
What it shows
<lynx-stack-outlet>—src/app/app.tsputs it where<router-outlet>would go. A screen you open slides in over the last one, and Back (Location.back()), Android's back button or a drag to the right slides it away. See Slide screens in and out.- A stack that follows the URL —
/settings,/settings/generaland/settings/general/aboutare each under the last, so each pushes. Back to Settings is arouterLinkto a screen in the stack, so it pops back to it, sliding the top screen away over the one between. - The navigation's
info— Next is at the same depth as the screen it's on, which would swap screens at once, as a tab bar does.[info]="{ stack: 'push' }"on itsrouterLinkmakes it push instead. - Screens that stay alive — the count on the first screen, and a section's switch, keep their state while other screens cover them.
LynxStackPage— a section's clock readsactive()and stops while another screen covers it.- The motion — the first screen switches the outlet's
animationbetween the platform's own, iOS's, Material's and none, so you can compare them on any device.
With a tab bar or a dock
Put a stack in each tab, and a screen pushed over a tab's first screen takes the app's Tab Bar or Dock away, as iOS and Material do: on iOS the screen underneath carries it, and the pushed screen slides over both, and on Android it slides down off the screen. It comes back with Back, Android's back button or a swipe, following the finger. The examples on those pages each have a tab with a stack. See The tab bar or dock goes away on a pushed screen.
Related
- Routing and navigation
- Routing API
- Furniture shop: the Lynx tutorial app, with its product page in a stack
- Dock and Tab Bar: bars that go away on a pushed screen
