Skip to content

React Navigation 6.0 moves navigator props into screen options

updated

React Navigation 6.0 has been released, with documentation now live at reactnavigation.org. The core API stays largely the same as React Navigation 5, and the release is framed as further polishing of what React Navigation 5 introduced.

Many customization options that were previously passed as navigator props now live in screen options, so they can vary depending on the active screen. The biggest changes affect tabBarOptions and drawerContentOptions. For example, a tab bar style that used to be configured through tabBarOptions is now set with screenOptions using keys such as tabBarActiveTintColor, tabBarInactiveTintColor and tabBarStyle.

New Group component

The Group component organizes screens inside a navigator and shares screenOptions across them. Individual Screen components can still override group options, groups can be nested, and since they render nothing (similar to fragments) they do not affect performance. For example, groups can separate regular screens from those using presentation: 'modal'.

Simplified APIs

  • A single presentation option for modal and transparent modal styles
  • Custom headers no longer require headerMode="screen"
  • useHeaderHeight ignores hidden headers and returns the closest visible parent header height
  • A custom background (such as BlurView) can be set for the tab bar without a custom tab bar
  • createNavigationContainerRef and useNavigationContainerRef for managing the container ref

Bottom tabs and drawer screens now show headers by default, removing the need to nest a single-screen stack just to get a header.

Elements library

Shared components and helpers have been extracted into a new @react-navigation/elements package, which also exports a Header component. Only a small set is available for now, with more planned.

Native navigation by default

The documentation now uses @react-navigation/native-stack as the default for stack navigation. It is built on react-native-screens and uses UINavigationController on iOS and Fragments on Android. Its API has been aligned more closely with @react-navigation/stack, which remains maintained and supported; existing users do not need to migrate. @react-navigation/material-top-tabs now uses react-native-pager-view by default.

Type safety

useNavigation no longer needs manual annotation for autocompletion and type checking. Screens can be typed globally via declaration merging on a ReactNavigation namespace with a RootParamList interface.

Flipper plugin

A new Flipper plugin lists navigation actions, lets developers move between earlier and later navigation states, and includes a tab for testing linking configuration. Unlike the Redux Devtools Extension integration, it does not require the Chrome Debugger. In Expo managed apps, it requires a Custom Development Client and does not work in Expo Go at the time of writing.

Upgrading

There are breaking changes, though smaller than the v4 to v5 jump. Packages from v5 and v6 can be mixed, with some caveats, allowing gradual upgrades. The project's upgrade guide lists all changes.

Source: reactnavigation.org