--- title: Native Stack Navigator impact: HIGH tags: react-navigation, native-stack, navigation, header, header-items, search-bar, large-title, modal, animation, form-sheet --- # Skill: Native Stack Navigator ## Description Use `createNativeStackNavigator` for screen-to-screen flows. ## When to Use - Building the default push-based flow for an app - Using platform-native headers, large titles, or a native search bar - Presenting modal or sheet screens with native-stack presentations ## Basic Example **Static API** ```tsx import { createNativeStackNavigator } from '@react-navigation/native-stack'; const AppStack = createNativeStackNavigator({ screens: { Home: HomeScreen, Profile: ProfileScreen, }, }); ``` **Dynamic API** ```tsx import { createNativeStackNavigator } from '@react-navigation/native-stack'; const Stack = createNativeStackNavigator(); function AppStack() { return ( ); } ``` ## Common Features ### Large Title Use `headerLargeTitleEnabled: true` for an iOS large title that collapses into the regular header on scroll. **Static API** ```tsx const AppStack = createNativeStackNavigator({ screens: { Library: { screen: LibraryScreen, options: { headerLargeTitleEnabled: true, }, }, }, }); ``` **Dynamic API** ```tsx import { createNativeStackNavigator } from '@react-navigation/native-stack'; const Stack = createNativeStackNavigator(); function AppStack() { return ( ); } ``` - Only supported on iOS. - The scroll view in the screen must use `contentInsetAdjustmentBehavior="automatic"`. - Don't set a background color on the header if large title is enabled as it makes title invisible on iOS 26. - Don't set `headerTransparent: false` if large title is enabled. - If the scrollable area does not fill the screen, the large title will not collapse on scroll. ### Header Search Bar Use `headerSearchBarOptions` to render a native search bar. If the search configuration depends on screen state, update it with `navigation.setOptions(...)`. **Static API** ```tsx const AppStack = createNativeStackNavigator({ screens: { Search: { screen: SearchScreen, options: { headerSearchBarOptions: { placeholder: 'Search', }, }, }, }, }); ``` **Dynamic API** ```tsx import { createNativeStackNavigator } from '@react-navigation/native-stack'; const Stack = createNativeStackNavigator(); function AppStack() { return ( ); } ``` - The scroll view in the screen must use `contentInsetAdjustmentBehavior="automatic"`. - If the screen doesn't have a scroll view, use `headerTopInsetEnabled: true`. ### Header Buttons and Custom Content Use `unstable_headerLeftItems` and `unstable_headerRightItems` for native iOS header buttons or menus. Use `headerLeft`, `headerRight`, `headerTitle`, and `headerBackground` for custom React content, and as a fallback on other platforms. **Static API** ```tsx import { Button, Text, View } from 'react-native'; import { createNativeStackNavigator } from '@react-navigation/native-stack'; const AppStack = createNativeStackNavigator({ screens: { Profile: { screen: ProfileScreen, options: { headerTitle: ({ tintColor, children }) => ( {children} ), headerBackground: () => ( ), unstable_headerLeftItems: () => [ { type: 'button', label: 'Edit', onPress: () => { // Do something }, }, ], unstable_headerRightItems: () => [ { type: 'button', label: 'Done', icon: { type: 'sfSymbol', name: 'checkmark', }, onPress: () => { // Do something }, }, ], headerLeft: ({ tintColor }) => (