An app on a phone has no address bar. On the web, moving between pages is a matter of URLs and the browser's back button. In an app, screens are stacked like cards, tabs sit at the bottom, and going back works differently on Android and iOS. All of that is navigation: how people move between screens. Look at Mrs. Rini's counter. On top of the order list you put receipt #13 to read it (push). When you're done, you take that top receipt off again (pop), and the list is still underneath, exactly where it was. The same counter has two drawers, Orders and Account. Switching drawers stacks nothing. The pile of receipts is a stack, the drawers are tabs.
Stack and tabs
- A stack piles screens up: opening a new screen pushes it on top, going back pops it off the top. The screen on top has a header with a back button.
- Tabs show a bar with a few main screens, usually at the bottom. Switching tabs stacks nothing, and each tab keeps its own state.
- A drawer is a menu pulled in from the side. Mrs. Rini's app doesn't use one.
Mrs. Rini's app uses both: a stack on the outside, holding the tabs (Orders and Account) and the order detail screen. The navigation state is kept as a plain object. After order #13 is opened:
{ index: 1, routes: [
{ name: 'Tabs', state: { index: 0, routes: [{ name: 'Orders' }, { name: 'Account' }] } },
{ name: 'OrderDetail', params: { id: '13' } },
] }
routesis the stack, from bottom to top.index: 1means the top screen, OrderDetail, is the one showing.params: { id: '13' }is the data carried to that screen: only the order's number.
React Navigation 7
React Navigation is React Native's most established navigation library: up to Expo Router 55, even Expo Router was built on top of it. On npm, 2 to 8 October 2026, @react-navigation/native was downloaded 5.98 million times and expo-router 7.29 million times (downloads, not a count of apps). Its stable version is 7 (@react-navigation/native 7.5.0 as of October 2026), and version 8 is still in alpha. In an Expo project without Expo Router (npx create-expo-app@latest --template blank):
npm install @react-navigation/native @react-navigation/native-stack @react-navigation/bottom-tabs
npx expo install react-native-screens react-native-safe-area-context
Its docs recommend the static API: navigators written as objects.
// App.js
import { createStaticNavigation, useNavigation } from '@react-navigation/native';
import { createNativeStackNavigator } from '@react-navigation/native-stack';
import { createBottomTabNavigator } from '@react-navigation/bottom-tabs';
import { Pressable, Text, View } from 'react-native';
import { ORDERS } from './src/data/orders';
function OrdersScreen() {
const navigation = useNavigation();
return (
<View>
{ORDERS.map((order) => (
<Pressable key={order.id} onPress={() => navigation.navigate('OrderDetail', { id: order.id })}>
<Text>#{order.id} {order.name}</Text>
</Pressable>
))}
</View>
);
}
function OrderDetailScreen({ route }) {
const order = ORDERS.find((o) => o.id === route.params.id);
return <Text>{order.name}: {order.status}</Text>;
}
const AccountScreen = () => <Text>Account</Text>;
const Tabs = createBottomTabNavigator({
screens: {
Orders: { screen: OrdersScreen, options: { title: 'My orders', tabBarLabel: 'Orders' } },
Account: AccountScreen,
},
});
const RootStack = createNativeStackNavigator({
screens: {
Tabs: { screen: Tabs, options: { headerShown: false } },
OrderDetail: {
screen: OrderDetailScreen,
options: ({ route }) => ({ title: `Order #${route.params.id}` }),
},
},
});
const Navigation = createStaticNavigation(RootStack);
export default function App() {
return <Navigation />;
}
navigation.navigate('OrderDetail', { id: order.id })pushes the OrderDetail screen with anidparam. For order #13,route.paramsholds{ id: '13' }.- The param is just the ID. The full data is looked up in
ORDERS, so there's no copy that can go stale. - The dynamic API writes the same thing as components:
<NavigationContainer>,<Stack.Navigator>,<Stack.Screen name="OrderDetail" component={OrderDetailScreen} />. More code, but the list of screens can change while the app runs.
Expo Router: screens from file names
The project from the setup lesson uses Expo Router, which builds routes from the files in src/app. Its version is 57, following the SDK's number. Since version 56 (May 2026), Expo Router no longer depends on React Navigation: it forked the parts it used, and imports from @react-navigation/* in app code are no longer supported. Import from expo-router.
src/app/
├── _layout.tsx # Stack
├── (tabs)/
│ ├── _layout.tsx # Tabs: Orders and Account
│ ├── index.tsx # / the order list
│ └── account.tsx # /account
└── order/
└── [id].tsx # /order/13 the order detail
// src/app/order/[id].tsx
import { Stack, useLocalSearchParams } from 'expo-router';
import { Text, View } from 'react-native';
import { ORDERS } from '@/data/orders';
export default function OrderDetail() {
const { id } = useLocalSearchParams<{ id: string }>();
const order = ORDERS.find((o) => o.id === id);
return (
<View>
<Stack.Screen options={{ title: `Order #${id}` }} />
<Text>{order ? `${order.name}: ${order.status}` : 'Order not found'}</Text>
</View>
);
}
(tabs)is a group: the parentheses don't show up in the address.[id]is the part of the address that varies.- From the list,
router.push('/order/13')or<Link href="/order/13">opens this screen, anduseLocalSearchParams()returns{ id: '13' }. Params from the address are always strings.
Back on Android and iOS
Guess first: Wulan opens the app on an Android phone, taps order #13, then presses Android's back twice. What happens on the second press?
- iOS has no system back button. You go back with the button at the top left of the header, or by swiping from the left edge of the screen. On the first screen there's nowhere to go, and the app stays open.
- Android has a system back button or gesture. React Navigation calls
goBack()as long as there's a screen to pop. On the first screen, the back press goes to Android, and the app leaves to the home screen. - In tabs, Android's back from the Account tab first returns to the Orders tab, because the tabs' default
backBehaviorisfirstRoute.
| Action | Stack | What shows |
|---|---|---|
| Open the app | Tabs | My orders |
| Tap #13 | Tabs, OrderDetail { id: '13' } |
Order #13 |
| Android back | Tabs | My orders |
| Android back | nothing left to pop | leaves to the home screen |
So the second press sends the app to the home screen.
⚠️ Params, push and imports that often go wrong
- Sending the whole order object as a param. If #13's status changes, the detail screen still holds the old copy. Send
{ id: '13' }, then look the data up. - Comparing a param with a number.
useLocalSearchParams()gives'13', soid === 13is alwaysfalse. Compare with a string. - navigate to the same screen with another param. From Order #13,
navigation.navigate('OrderDetail', { id: '12' })only replaces the params of the screen that's showing; it stacks nothing. Usenavigation.push(...)when you want a new screen on top. - Importing
@react-navigation/*in an Expo Router 56+ project. Not supported. TakeStack,Linkandrouterfromexpo-router, andTabsfromexpo-router/js-tabs: in Expo Router 57,Tabsfromexpo-routeris deprecated.
TL;DR: A stack piles screens up (push to open, pop to go back), tabs switch between main screens without stacking. React Navigation 7 is React Native's most established navigation library, and its docs recommend the static API (createNativeStackNavigator({ screens }), createStaticNavigation). Keep params minimal: navigation.navigate('OrderDetail', { id: '13' }), read from route.params.id. Expo Router 57 builds routes from files: src/app/order/[id].tsx is /order/13, read with useLocalSearchParams(), and since version 56 it no longer depends on React Navigation. iOS goes back through the header or a swipe from the left edge. Android has a system back, and on the first screen back sends the app to the home screen.
⚡ A pile and drawers
Meaning: A stack piles screens up: opening a new screen pushes it on top, going back pops it off the top. Tabs switch between main screens, such as Orders and Account, without stacking anything, and each tab keeps its own state. Mrs. Rini's app uses both: a stack on the outside, holding the tabs and the order detail screen.
⚡ Send only the id
Write:
navigation.navigate('OrderDetail', { id: order.id });
// in OrderDetailScreen
const order = ORDERS.find((o) => o.id === route.params.id);
Meaning: For order #13, route.params holds { id: '13' }. The full data is looked up in ORDERS, so there's no copy that can go stale when its status changes.
⚡ Back on Android
Guess first: Wulan opens order #13 on an Android phone, then presses back twice. What happens on the second press?
The app leaves to the home screen. The first press pops OrderDetail, and on the first screen there's nothing left to pop, so the back press goes to Android.
Meaning: iOS has no system back button: you go back with the button at the top left of the header, or by swiping from the left edge of the screen. On the first screen, the app stays open.