Top Related Projects
Routing and navigation for your React Native apps
Native navigation primitives for your React Native app.
The first declarative React Native router
🔥 A well-tested feature-rich modular Firebase implementation for React Native. Supports both iOS & Android platforms for all Firebase services.
A cross-platform Tab View component for React Native
An enhanced, animated, customizable Modal for React Native.
Quick Overview
React Native Navigation is a popular navigation library for React Native applications. It provides a native navigation solution with smooth animations and a consistent look and feel across iOS and Android platforms. The library offers a declarative API for managing navigation and screen transitions in React Native apps.
Pros
- Native performance and animations for a smooth user experience
- Extensive customization options for navigation components
- Strong community support and regular updates
- Supports both bottom tabs and side menu navigation patterns
Cons
- Steeper learning curve compared to some other navigation libraries
- Occasional breaking changes between major versions
- Some users report compatibility issues with certain React Native versions
- Limited support for web applications
Code Examples
- Basic navigation setup:
import { Navigation } from 'react-native-navigation';
Navigation.registerComponent('Home', () => HomeScreen);
Navigation.registerComponent('Profile', () => ProfileScreen);
Navigation.setRoot({
root: {
stack: {
children: [
{
component: {
name: 'Home'
}
}
]
}
}
});
- Pushing a new screen:
Navigation.push(this.props.componentId, {
component: {
name: 'Profile',
passProps: {
userId: 123
},
options: {
topBar: {
title: {
text: 'User Profile'
}
}
}
}
});
- Setting up bottom tabs:
Navigation.setRoot({
root: {
bottomTabs: {
children: [
{
stack: {
children: [{ component: { name: 'Home' } }],
options: { bottomTab: { text: 'Home', icon: homeIcon } }
}
},
{
stack: {
children: [{ component: { name: 'Profile' } }],
options: { bottomTab: { text: 'Profile', icon: profileIcon } }
}
}
]
}
}
});
Getting Started
-
Install the library:
npm install react-native-navigation
-
For iOS, run:
cd ios && pod install
-
Initialize the library in your
index.js
:import { Navigation } from 'react-native-navigation'; Navigation.events().registerAppLaunchedListener(() => { Navigation.setRoot({ root: { stack: { children: [ { component: { name: 'Home' } } ] } } }); });
-
Register your screens and start using the navigation API in your components.
Competitor Comparisons
Routing and navigation for your React Native apps
Pros of react-navigation
- Easier to set up and use, with a gentler learning curve
- More flexible and customizable, allowing for complex navigation patterns
- Better documentation and community support
Cons of react-navigation
- JavaScript-based, which can lead to performance issues in complex apps
- Less native feel, as it doesn't use native navigation components
Code Comparison
react-navigation:
import { createStackNavigator } from '@react-navigation/stack';
const Stack = createStackNavigator();
function App() {
return (
<NavigationContainer>
<Stack.Navigator>
<Stack.Screen name="Home" component={HomeScreen} />
<Stack.Screen name="Details" component={DetailsScreen} />
</Stack.Navigator>
</NavigationContainer>
);
}
react-native-navigation:
import { Navigation } from 'react-native-navigation';
Navigation.registerComponent('Home', () => HomeScreen);
Navigation.registerComponent('Details', () => DetailsScreen);
Navigation.setRoot({
root: {
stack: {
children: [
{ component: { name: 'Home' } },
],
},
},
});
react-navigation uses a more declarative approach, while react-native-navigation employs an imperative style. react-navigation's setup is more React-like and may be more familiar to React developers. react-native-navigation requires separate component registration and root setup, which can be more verbose but offers finer control over the navigation structure.
Native navigation primitives for your React Native app.
Pros of react-native-screens
- Lightweight and focused on optimizing screen management
- Better performance and memory usage for complex navigation structures
- Seamless integration with React Navigation
Cons of react-native-screens
- Less comprehensive navigation solution, requires additional libraries for full functionality
- Limited built-in UI components compared to react-native-navigation
Code Comparison
react-native-screens:
import { Screen, ScreenContainer } from 'react-native-screens';
function MyScreen() {
return (
<ScreenContainer>
<Screen>
<View>
<Text>Screen Content</Text>
</View>
</Screen>
</ScreenContainer>
);
}
react-native-navigation:
import { Navigation } from 'react-native-navigation';
Navigation.registerComponent('MyScreen', () => MyScreen);
Navigation.setRoot({
root: {
stack: {
children: [
{
component: {
name: 'MyScreen'
}
}
]
}
}
});
react-native-screens focuses on optimizing screen rendering and management, while react-native-navigation provides a more comprehensive navigation solution with additional features and UI components. The choice between the two depends on project requirements and integration preferences.
The first declarative React Native router
Pros of react-native-router-flux
- Simpler API and easier to set up for basic navigation scenarios
- Better integration with Redux and other state management libraries
- More lightweight and potentially faster performance for simpler apps
Cons of react-native-router-flux
- Less customizable and fewer advanced features compared to react-native-navigation
- May have compatibility issues with some third-party libraries
- Less active development and community support
Code Comparison
react-native-router-flux:
<Router>
<Scene key="root">
<Scene key="home" component={Home} title="Home" initial={true} />
<Scene key="profile" component={Profile} title="Profile" />
</Scene>
</Router>
react-native-navigation:
Navigation.setRoot({
root: {
stack: {
children: [
{
component: {
name: 'Home',
options: { topBar: { title: { text: 'Home' } } }
}
}
]
}
}
});
react-native-router-flux offers a more declarative and straightforward approach to defining navigation structure, while react-native-navigation provides a more programmatic and flexible API. The choice between the two depends on the specific needs of your project, with react-native-router-flux being simpler for basic navigation and react-native-navigation offering more advanced features and customization options.
🔥 A well-tested feature-rich modular Firebase implementation for React Native. Supports both iOS & Android platforms for all Firebase services.
Pros of react-native-firebase
- Comprehensive Firebase integration: Offers a wide range of Firebase services and features
- Well-maintained and actively developed: Regular updates and community support
- Extensive documentation: Detailed guides and examples for easy implementation
Cons of react-native-firebase
- Larger bundle size: Includes multiple Firebase services, potentially increasing app size
- Steeper learning curve: Requires understanding of Firebase ecosystem and concepts
- Platform-specific setup: May require additional configuration for iOS and Android
Code Comparison
react-native-firebase:
import firebase from '@react-native-firebase/app';
import '@react-native-firebase/auth';
firebase.initializeApp(config);
firebase.auth().signInWithEmailAndPassword(email, password);
react-native-navigation:
import { Navigation } from 'react-native-navigation';
Navigation.registerComponent('Home', () => HomeScreen);
Navigation.setRoot({
root: { component: { name: 'Home' } }
});
While these libraries serve different purposes, the code comparison highlights their distinct functionalities. react-native-firebase focuses on Firebase integration, providing methods for authentication and other Firebase services. react-native-navigation, on the other hand, deals with app navigation and screen management.
react-native-firebase is ideal for projects requiring extensive Firebase functionality, while react-native-navigation is better suited for apps needing advanced navigation capabilities. The choice between them depends on the specific requirements of your React Native project.
A cross-platform Tab View component for React Native
Pros of react-native-tab-view
- Lightweight and focused solely on tab navigation
- Highly customizable with smooth animations
- Easy to integrate with existing React Native projects
Cons of react-native-tab-view
- Limited to tab-based navigation, lacking full-featured navigation capabilities
- Requires additional setup for complex navigation scenarios
- Less comprehensive documentation compared to react-native-navigation
Code Comparison
react-native-tab-view:
import { TabView, SceneMap } from 'react-native-tab-view';
const renderScene = SceneMap({
first: FirstRoute,
second: SecondRoute,
});
<TabView
navigationState={{ index, routes }}
renderScene={renderScene}
onIndexChange={setIndex}
/>
react-native-navigation:
import { Navigation } from 'react-native-navigation';
Navigation.setRoot({
root: {
bottomTabs: {
children: [
{ component: { name: 'FirstTab' } },
{ component: { name: 'SecondTab' } }
]
}
}
});
react-native-tab-view is ideal for projects that require simple, customizable tab navigation with smooth animations. It's lightweight and easy to integrate but lacks the comprehensive navigation features offered by react-native-navigation. The latter provides a more robust solution for complex navigation scenarios but comes with a steeper learning curve and more setup overhead.
An enhanced, animated, customizable Modal for React Native.
Pros of react-native-modal
- Lightweight and focused solely on modal functionality
- Easy to implement and customize with a simple API
- Supports various animation types out of the box
Cons of react-native-modal
- Limited to modal-specific features, not a full navigation solution
- May require additional libraries for complex navigation scenarios
- Less community support and fewer integrations compared to react-native-navigation
Code Comparison
react-native-modal:
import Modal from 'react-native-modal';
<Modal isVisible={isModalVisible} onBackdropPress={toggleModal}>
<View style={styles.modalContent}>
<Text>Modal Content</Text>
</View>
</Modal>
react-native-navigation:
import { Navigation } from 'react-native-navigation';
Navigation.showModal({
component: {
name: 'ModalScreen',
options: {
topBar: {
title: {
text: 'Modal'
}
}
}
}
});
react-native-modal is more suitable for simple modal implementations, while react-native-navigation offers a comprehensive navigation solution with modal support. The choice depends on the project's specific requirements and complexity.
Convert designs to code with AI
Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.
Try Visual CopilotREADME
React Native Navigation
React Native Navigation provides 100% native platform navigation on both iOS and Android for React Native apps. The JavaScript API is simple and cross-platform - just install it in your app and give your users the native feel they deserve. Ready to get started? Check out the docs.
Quick Links
Requirements
Apps using React Native Navigation may target iOS 11 and Android 5.0 (API 21). You may use Windows, macOS or Linux as your development operating system.
Installation
As react-native-navigation
is a native navigation library - integrating it into your app will require editing native files. Follow the installation guides in the documentation.
Top Related Projects
Routing and navigation for your React Native apps
Native navigation primitives for your React Native app.
The first declarative React Native router
🔥 A well-tested feature-rich modular Firebase implementation for React Native. Supports both iOS & Android platforms for all Firebase services.
A cross-platform Tab View component for React Native
An enhanced, animated, customizable Modal for React Native.
Convert designs to code with AI
Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.
Try Visual Copilot