This documentation is available as Markdown for AI agents and LLMs. See the full Markdown index or append .md to any documentation URL.
NavigationStack
A SwiftUI NavigationStack, with the links and destinations that push views onto it.
Expo UI NavigationStack matches the official SwiftUI NavigationStack API and shows a root view that can push other views on top of it.
Tapping a NavigationLink pushes the NavigationDestination with the same value.
Installation
If you are installing this in an existing React Native app, make sure to install expo in your project.
Usage
Basic navigation
Put the root view and the destinations inside the stack. Give a link and its destination the same value. Set the title of each screen with the navigationTitle modifier.
Inside a List, a link renders as a row with a chevron. A destination has to be a direct child of the stack, however deeply the link that pushes it is nested.
Keep the links inside the
NavigationStackitself. Content presented from the stack, such as aBottomSheetor aPopover, needs its ownNavigationStackand its own destinations.
Any view as a link
A link can wrap any view.
Read and set the path
The stack keeps its own path by default. Pass path and onPathChange to drive it from state. The path holds the value of each pushed view, in push order. Set it to an empty array to return to the root view.
Add buttons to the navigation bar
Wrap the content in a Toolbar and put the buttons in Toolbar.Content.
API
import { NavigationDestination, NavigationLink, NavigationStack, } from '@expo/ui/swift-ui';
Component
Type: React.Element<NavigationStackProps>
A view that displays a root view and enables you to present additional views over the root view.
Example
const [path, setPath] = useState<string[]>([]); <NavigationStack path={path} onPathChange={setPath}> <List> <NavigationLink value="settings"> <Text>Settings</Text> </NavigationLink> </List> <NavigationDestination value="settings"> <SettingsScreen /> </NavigationDestination> </NavigationStack>
ReactNodeThe root view of the stack, and the NavigationDestination views the stack can push. It is
displayed inside a navigation bar.
(path: string[]) => voidCallback function that is called when the stack pushes or pops a view, for example when a
NavigationLink is tapped or the user swipes back. Gets called with the new path.
When path is set, the stack is controlled: a push takes effect once the new path comes back
through this prop.
string[]The values of the views pushed on top of the root view, in the order they were pushed. Leave it undefined to let the stack manage its own path.
Component
Type: React.Element<NavigationLinkProps>
A view that controls a navigation presentation. In a List it renders as a row with a
disclosure chevron, and tapping it pushes the matching NavigationDestination.
The link has to be inside the NavigationStack itself. Content presented from the stack, such
as a BottomSheet or a Popover, is its own presentation context and does not reach the
stack's destinations, so give that content its own NavigationStack.
Example
<NavigationLink value="settings"> <Text>Settings</Text> </NavigationLink>
Component
Type: React.Element<NavigationDestinationProps>
Associates a destination view with a NavigationLink value, matching SwiftUI's
navigationDestination(for:destination:). It must be a direct child of the NavigationStack,
however deeply the link that pushes it is nested inside that stack.
Keep it mounted so the pushed screen already carries its navigationTitle when the slide
starts, or render one for each value on the stack's path to build screens on demand.
Example
<NavigationDestination value="settings"> <SettingsScreen /> </NavigationDestination>