Split.Navigator

Show a sidebar beside its detail on a wide window and one native stack on a narrow one.

App.tsx
<Split.Navigator>  <Split.Screen name="Notes"    component={Notes} />  <Split.Screen name="Note"    component={Note} /></Split.Navigator>
Notes
One stackNotes
Open a note, then change the width. A wide window keeps the notes beside it. A narrow one shows one screen at a time.

Call createSplitNavigator<Routes>() from nitro-ui-navigation at module scope and render its Navigator under a NavigationContainer. The first route is the sidebar. On a wide window, such as an iPad, an open iPhone Duo, an unfolded Android foldable or a tablet, the screens opened from the sidebar show beside it. On a narrow window, such as a phone or a closed foldable, every route is on one native stack.

Given a Split with Notes and Note routes, Notes becomes the sidebar.

<Split.Navigator placeholder={<SelectANote />}>
  <Split.Screen name="Notes" component={Notes} />
  <Split.Screen name="Note" component={Note} />
</Split.Navigator>

From the sidebar, navigation.showDetail('Note', { title: title }) opens a note beside it and closes the one opened before. navigation.push adds a screen above the open note, and a completed native back action pops it. A screen that prevents its removal in beforeRemove stays. On iOS the back action takes it away first, and it then shows again. Folding, rotating or resizing the window rearranges the same routes, so each screen keeps its state. Split.Screen · Navigation

When the sidebar and detail fit

On iOS, UIKit gives them a column each in a window of regular width: an iPad, an open iPhone Duo and the largest iPhones in landscape. Where that window is on the narrow side, such as an open iPhone Duo held upright, it shows the detail and slides the sidebar over it on demand. On Android they show side by side when the navigator is at least 600 dp wide in a window at least 480 dp tall, so a phone in landscape keeps one stack. Set collapsed to keep one stack everywhere.

The routes are a stack on every size. Once a screen opens from the sidebar, that screen is the focused route, and the sidebar gets blur although it stays on screen beside it. Navigating inside a navigator nested in the sidebar never closes the screens opened from it. On one stack they stay on top, so that change shows once the user is back on the sidebar.

Read the arrangement

useSplitView() returns what a screen needs to know about the navigator it is in.

FieldTypeUse
isCollapsedbooleantrue while every route is on one stack.
displayMode'sidebarBesideDetail', 'sidebarOverDetail' or 'detailOnly'How the sidebar and detail are arranged now. While isCollapsed is true, it is how they were when both last fit.
showSidebar() => voidShow the sidebar while it and the detail both fit.
hideSidebar() => voidHide the sidebar, which leaves its width to the detail.
isInspectorVisiblebooleanWhether the focused screen's inspector shows.
showInspector() => voidShow the focused screen's inspector.
hideInspector() => voidHide the inspector.

Use isCollapsed for behavior that only applies beside a sidebar, such as marking the open row.

import { useSplitView } from 'nitro-ui-navigation'

function NoteRow({ title, open }: { title: string; open: boolean }) {
  const { isCollapsed } = useSplitView()
  return <Text fontWeight={open && !isCollapsed ? 'bold' : 'regular'}>{title}</Text>
}

On iOS 26 and later the detail's view reaches under the sidebar beside it, so the insets a screen reads from useSafeAreaInsets() include the sidebar's width on that side. On Android the detail starts where the sidebar ends. Safe areas

Hide and show the sidebar

On iOS the system adds a button that hides and shows the sidebar. For a control of your own, read displayMode from useSplitView() and call showSidebar() or hideSidebar(). Both do nothing while every route is on one stack.

function SidebarToggle() {
  const { displayMode, showSidebar, hideSidebar } = useSplitView()
  const hidden = displayMode === 'detailOnly'
  const tap = useMemo(() => {
    const recognizer = new TapGestureRecognizer()
    recognizer.onTap = hidden ? showSidebar : hideSidebar
    return recognizer
  }, [hidden, showSidebar, hideSidebar])
  return <Text gestureRecognizers={[tap]}>{hidden ? 'Show notes' : 'Hide notes'}</Text>
}

The displayMode prop is the arrangement the navigator prefers while both fit. Leave it at automatic to let the system choose from the window's size. onDisplayModeChange reports every change of the arrangement: the user's, yours, and the system's, such as when the window changes size or the sidebar makes room for the inspector. Use it to observe. Storing what it reports back into displayMode replaces the system's choices with a fixed one.

Android has one way to show the sidebar, which is beside the detail. detailOnly hides it there, and every other value shows it.

Show an inspector

An inspector is a panel about the focused screen, such as a note's details or a document's outline. Give a screen an inspector option with the panel, then call showInspector() from useSplitView().

<Split.Screen
  name="Note"
  component={Note}
  options={{ inspector: <NoteDetails />, inspectorTitle: 'Details' }}
/>
function DetailsToggle() {
  const { isInspectorVisible, showInspector, hideInspector } = useSplitView()
  const tap = useMemo(() => {
    const recognizer = new TapGestureRecognizer()
    recognizer.onTap = isInspectorVisible ? hideInspector : showInspector
    return recognizer
  }, [isInspectorVisible, showInspector, hideInspector])
  return <Text gestureRecognizers={[tap]}>{isInspectorVisible ? 'Hide details' : 'Show details'}</Text>
}

The inspector takes a column at the trailing edge when there is room for it, and opens as a sheet when there is not, as on a phone or a closed foldable. Folding and unfolding moves it between the two. When the sidebar, the detail and the inspector do not all fit, the sidebar hides while the inspector shows. isInspectorVisible turns false when the user closes the sheet.

The inspector and the placeholder are not routes, so neither can contain a navigator.

  • iOS 26 and later use UIKit's own inspector column. Earlier versions always open a sheet.
  • Android shows a column while the detail keeps minimumDetailWidth beside it, which is 320 dp unless you set it. Where that column leaves the sidebar no room, showSidebar() closes the inspector to show the sidebar. iOS shows the sidebar over the detail there.

The inspector renders while its screen is focused, also while it is hidden, so it is ready when it shows. Render the costly parts only while isInspectorVisible is true. Inside it, useNavigation() and useRoute() return the screen's own. Once shown, the inspector stays shown for the screens focused after it, until it is hidden. A screen without one leaves inspector out or sets it to null or false, and there showInspector() does nothing.

Props

PropTypeUse
childrenReactNodeRequired. Declare screens and groups here. Fragments can wrap either.
initialRouteNameRoute nameOpen this route from the sidebar at the start. The sidebar is always the first declared route.
placeholderReactNodeShow this beside the sidebar while no other screen is open. Its bar shows and is tinted like the sidebar's. Inside it, useNavigation() returns the sidebar's navigation object. It cannot contain a navigator.
collapsedbooleanSet to true to keep every route on one stack even when the sidebar and detail fit.
displayModeSplitDisplayModeArrange the sidebar and detail when both fit. Choose automatic (default), sidebarBesideDetail, sidebarOverDetail, or detailOnly.
onDisplayModeChange(displayMode: Exclude<SplitDisplayMode, 'automatic'>) => voidCalled with the new arrangement whenever it changes while both fit.
splitBehaviorSplitBehaviorSelect how showing the sidebar affects the detail. Choose automatic (default), tile, overlay, or displace. iOS only.
showsSidebarTogglebooleanShow the system button that shows and hides the sidebar. Defaults to true. iOS only.
sidebarWidthnumberSet the sidebar's preferred width in points. Defaults to the system's on iOS and 320 on Android.
minimumSidebarWidthnumberSet the narrowest the sidebar can get, in points. Defaults to the system's.
maximumSidebarWidthnumberSet the widest the sidebar can get, in points. Defaults to the system's.
inspectorWidthnumberSet the inspector column's width in points. Defaults to the system's on iOS and 320 on Android. Needs iOS 26.
minimumDetailWidthnumberSet the least width the detail keeps, in points. iOS keeps it beside the sidebar and the inspector, and needs iOS 26. Android goes by it for the inspector: whether that gets a column, and whether the sidebar stays beside it. Defaults to the system's on iOS and 320 on Android.
screenOptionsSplitNavigationOptions or callbackSet defaults for all screens. A callback receives the route, navigation and theme. Split screen options
screenListenersListeners or callbackSubscribe to screen events, such as focus, blur, state, and beforeRemove.
layoutRender callbackWrap the navigator’s children with access to its state, navigation and screen descriptors.
screenLayoutRender callbackWrap the content of each screen.
UNSTABLE_routerRouter callbackReturn overrides for the underlying router.
UNSTABLE_routeNamesChangeBehavior'firstMatch' or 'lastUnhandled'Choose how to resolve navigation state when the set of available route names changes. Defaults to firstMatch.

On this page