The current screens, oldest first.
A copy of the stack, so a consumer cannot mutate it by accident.
Whether going back would stay inside the application.
True when there is more than one screen.
Empty the stack. Used on teardown.
Put a resolved route on the stack.
Navigating to the path that is already on top replaces it rather than stacking a duplicate: re-resolving the current route (a reload, fresh data) must not give the user two identical screens to walk back through.
The screen to add, without its key.
How it should enter. Defaults to push.
The screen as it was added, key included.
Go back one screen.
The last screen is never popped: an application always displays something, and a back gesture on the first screen is the platform's business (leaving the app), not ours.
The screen now on top, or undefined when the stack was empty.
Set the title of the screen on top.
A page's head has nowhere to go on a phone: there is no document to apply it to. Its title is the one part that means something, and it means the screen's title.
Optionaltitle: string
The title to set.
How deep the stack is.
The number of screens.
Subscribe to stack changes.
Called with the new stack on every change.
A function removing the listener.
The screen currently on top, the one a user sees.
The top screen, or undefined when nothing has been resolved yet.
Staticcreate
The navigation stack, as plain state.
This is the seam of the whole native renderer. A browser has one document and replaces its contents; a phone has a stack of screens, each keeping its own state, with a back gesture that pops the top one. So the renderer does not render: it puts what it resolved onto this stack, and whatever displays screens reacts.
Keeping it as plain state, with no React and no navigation library in sight, is what lets you choose the display: StoneNativeApp renders the top screen with no extra dependency, and a native navigator (
@react-navigation/native-stack, for the real gestures and transitions) drives itself from the same object. It also means the navigation semantics are testable without a device.