This component should only be rendered inside a _layout.tsx file, where it will serve as the location that children will render for routes below the layout.
Stack is simply a React Navigation Native Stack view and accepts the same props as React Navigation.
You can customize the children of the Stack in your layout by passing a children prop to Stack has Stack.Screen elements, like so:
The name must match the full name of the file inside app, without the extension but including groups.
In this example we are setting index, [id], and sheet screens, which would correspond to index.tsx and [id].tsx and sheet.tsx pages in the same directory.
This is a convenient way to configure settings for each page up front, but you could also render Stack.Screen inside each individual page so you can access data loaded inside that page. The upside of doing it in the layout is that it will configure things before any stack animation runs on enter, with the downside being that you can’t access page-level data.
The options property passes to the React Navigation NativeStack, and so takes the same options.
For more declarative header configuration, use the compositional API with Stack.Header and its child components:
The container for header configuration. Props:
hidden - Hide the header entirelyblurEffect - iOS blur effect ('regular', 'prominent', 'systemMaterial', etc.)asChild - Render a completely custom header componentstyle - Style with backgroundColor, shadowColor (set to 'transparent' to hide)largeStyle - Style for large title modeConfigure the header title:
Props:
children - The title textlarge - Enable iOS large title modestyle - Text style (fontWeight, fontSize, color, textAlign)Configure the back button:
Props:
children - Custom back button texthidden - Hide the back buttondisplayMode - 'default', 'generic', or 'minimal'withMenu - Enable long-press menu on iOSAdd custom components to the header:
Props:
asChild - Required to render custom childrenchildren - Your custom componentAdd an iOS-style search bar:
Props:
placeholder - Placeholder textautoCapitalize - 'none', 'words', 'sentences', 'characters'placement - 'automatic' or 'stacked'hideWhenScrolling - Hide when scrollingobscureBackground - Obscure background when activeYou can set a default header for all screens by placing Stack.Header directly inside Stack:
renderOn native, presentations like formSheet, pageSheet, and modal are handled by react-native-screens and render as real native sheets. On web there is no built-in equivalent - by default an overlay route shows as a card.
The render prop on <Stack> lets you plug in any sheet or modal library to render overlay routes on web. Tamagui Sheet, Vaul, Radix Dialog, or a hand-rolled element all work.
The render component receives the overlay route’s content as children along with normalized props:
open: boolean - whether the overlay should be visible. Toggles as you navigate.dismiss(): void - call after your close animation completes. Triggers StackActions.pop.dismissible: boolean - matches options.gestureEnabled.presentation - the route’s presentation option.routeKey, routeName - the route identity.sheetAllowedDetents, sheetGrabberVisible, sheetCornerRadius, sheetInitialDetentIndex, sheetLargestUndimmedDetentIndex, sheetExpandsWhenScrolledToEdge) pass through unchanged.Pass render inside options to override for a single route:
Resolution: per-route options.render → <Stack render> → setupRendering global → default (renders inline).
If every <Stack> in your app should use the same overlay render, register it once from your setup file:
Wire the setup file in vite.config.ts:
You can split per environment if needed: setupFile: { client: './client.ts', server: './server.ts', native: './native.ts' }.
By default, dismissing an overlay route pops it from the navigation state and React unmounts the route component. To preserve state (form values, useId, useState, refs) across close → reopen, set keepMounted: true on the screen options:
When keepMounted is on:
open: false.useId returns the same value, useState retains its value, refs are preserved.The render component must keep children in the React tree when open: false - typically by toggling visibility rather than conditionally rendering. Tamagui Sheet’s modal mode does this automatically. A render that returns null when closed will unmount the children regardless of keepMounted.
Caveats:
[id]-style dynamic routes.<Stack> itself.Edit this page on GitHub.