Set up React Navigation with typed routes
✓Works with OpenClaudeYou are a React Native developer. The user wants to set up React Navigation with fully typed routes using TypeScript.
What to check first
- Run
npm list react-navigation react-native-screens react-native-safe-area-contextto verify peer dependencies are installed - Confirm TypeScript is configured in
tsconfig.jsonwith"strict": true
Steps
- Install React Navigation and required dependencies:
npm install @react-navigation/native @react-navigation/bottom-tabs @react-navigation/stack react-native-screens react-native-safe-area-context - Create a
types/navigation.tsfile to define your route parameter lists and navigation prop types - Define a
RootParamListinterface that maps route names to their parameter objects (useundefinedfor routes with no params) - Create a
NavigationContainerwrapper and pass the linking configuration if using deep linking - Use
useNavigation<StackNavigationProp<RootParamList, 'RouteName'>>()hook to get typed navigation in screens - Use
useRoute<RouteProp<RootParamList, 'RouteName'>>()hook to access typed route params in screens - Define
NavigatorScreenProps<RootParamList>utility type for screen component props that includes navigation and route - Create separate navigator files (StackNavigator.tsx, BottomTabNavigator.tsx) that reference your RootParamList
Code
// types/navigation.ts
import { BottomTabScreenProps } from '@react-navigation/bottom-tabs';
import { StackScreenProps } from '@react-navigation/stack';
export type RootParamList = {
Home: undefined;
Details: { userId: string; userName: string };
Profile: { profileId: string };
Settings: undefined;
};
export type BottomTabParamList = {
HomeTab: undefined;
ExploreTab: undefined;
ProfileTab: undefined;
};
export type HomeScreenProps = StackScreenProps<RootParamList, 'Home'>;
export type DetailsScreenProps = StackScreenProps<RootParamList, 'Details'>;
export type ProfileScreenProps = StackScreenProps<RootParamList, 'Profile'>;
// Composite type for screens inside bottom tab navigator
export type HomeTabScreenProps = BottomTabScreenProps<BottomTabParamList, 'HomeTab'>;
// ------ RootNavigator.tsx
import React from 'react';
import { NavigationContainer } from '@react-navigation/native';
import { createStackNavigator } from '@react-navigation/stack';
import { createBottomTabNavigator } from '@react-navigation/bottom-tabs';
import { RootParamList, BottomTabParamList } from './types/navigation';
const Stack = createStackNavigator<RootParamList>();
const Tab = createBottomTabNavig
Note: this example was truncated in the source. See the GitHub repo for the latest full version.
Common Pitfalls
- Treating this skill as a one-shot solution — most workflows need iteration and verification
- Skipping the verification steps — you don't know it worked until you measure
- Applying this skill without understanding the underlying problem — read the related docs first
When NOT to Use This Skill
- When a simpler manual approach would take less than 10 minutes
- On critical production systems without testing in staging first
- When you don't have permission or authorization to make these changes
How to Verify It Worked
- Run the verification steps documented above
- Compare the output against your expected baseline
- Check logs for any warnings or errors — silent failures are the worst kind
Production Considerations
- Test in staging before deploying to production
- Have a rollback plan — every change should be reversible
- Monitor the affected systems for at least 24 hours after the change
Related Mobile Skills
Other Claude Code skills in the same category — free to download.
React Native Screen
Create React Native screens with navigation
React Native Component
Build React Native UI components
Expo Setup
Set up Expo project with common configurations
Push Notification
Implement push notifications (Expo/Firebase)
Offline Storage
Set up offline storage (AsyncStorage, MMKV)
Mobile Auth Flow
Create mobile authentication flow
App Store Prep
Prepare app for App Store/Play Store submission
Deep Linking
Implement deep linking and universal links
Want a Mobile skill personalized to YOUR project?
This is a generic skill that works for everyone. Our AI can generate one tailored to your exact tech stack, naming conventions, folder structure, and coding patterns — with 3x more detail.