react-native-navigation
React Navigation 6+ standards for stack, tab, and deep linking. Use when implementing React Navigation stacks, tabs, or deep linking in React Native.
安装与使用
请根据来源仓库和你的 AI 工具说明安装此技能。先阅读技能文件和依赖要求,再添加到工作流。
查看来源 ↗使用指南技能说明
React Native Navigation
Priority: P0 (CRITICAL)
Use React Navigation (official solution).
Implementation Guidelines
- Typed Navigation: Use TypeScript to define param lists.
-
Centralized: Define all navigators in
src/navigation/. - Nesting: Nest navigators (e.g., Tab inside Stack).
-
Options: Set
screenOptionsat navigator level, override per screen. -
Header: Customize with
headerTitle,headerRight,headerLeft. -
Deep Linking: Configure
linkingconfig for universal links.
Code
type RootStackParamList = {
Home: undefined;
Profile: { userId: string };
};
// Typed Navigation
const Stack = createNativeStackNavigator<RootStackParamList>();
function RootNavigator() {
return (
<Stack.Navigator>
<Stack.Screen name='Home' component={HomeScreen} />
<Stack.Screen name='Profile' component={ProfileScreen} />
</Stack.Navigator>
);
}
// Usage in Screen
function HomeScreen({
navigation,
}: NativeStackScreenProps<RootStackParamList, 'Home'>) {
navigation.navigate('Profile', { userId: '123' });
}
Anti-Patterns
- No String Literals: Use typed params.
- No Navigation in Business Logic: Pass callbacks from screens.
- No Deep Nesting: Max 2-3 levels of navigators.
Reference & Examples
See references/deep-linking.md for Universal Links, Nested Navigators, and State Persistence.
Related Topics
architecture | typescript/language
使用示例
查看来源仓库中的使用示例与配置说明。
查看来源 ↗来源历史
- 收录时间
- 2026-03-11
- 索引更新时间
- 2026-03-11
- Branch
- main
收录与同步日期属于本站记录。源码修改历史请查看来源仓库。
GitHub ↗chat Comments (0)
Sign in to join the discussion and leave a comment.
No comments yet. Be the first to share your thoughts!