Categories
React Native

React Native: Top Tabs Navigator

Top Tabs Navigator is material-design themed tab bar on the top of the screen that lets you switch between different routes by tapping the tabs or swiping horizontally. Transitions are animated by default. Routes tab screen components for each route are mounted immediately.

Top Tabs Navigator

Installation Top Tabs Navigator

To use this tab navigator, you want to ensure that you have @react-navigation/native and its dependencies.

Installing dependencies into a bare React Native project

React Native Top Tabs Navigation Example:
Now create new “screens” directory in application root directory.


Then you need to create some screen files like HomeScreen.js, LoginScreen.js, RegisterScreen.js, AboutScreen.js and ProfileScreen.js etc. in your screens directory. Or If you have already some screens than skip new screen creation.

Example HomeScreen:

Now, open App.tsx file form React Native application directory and add following code in your App file.

Done, now run your app using following command:

Your app is ready with top tabs navigation. More details Material Top Tab Navigator click here.

Thank you for carefully read my article If you have any query please Leave your query on following comment section or contact with us. Hope it will help you.

Categories
React Native

React Native: How to configure reactnavigation?

React Navigation is one of the most well-known navigation libraries available for React Native. In this article, I will discuse how to get started using React Navigation in a React Native application.

React Native Navigation

Installation ReactNavigation

Install the required packages vai (npm or yarn) in your React Native project:

Install Stack Navigator

Installing dependencies into a bare React Native project

React Native navigation example:
Now create new “screens” directory in application root directory.
Then you need to create some screen files like HomeScreen.js and LoginScreen.js in screens directory. Or If you have already some screens than skip new screen creation

HomeScreen.js.

LoginScreen.js

Now, open App.tsx file form React Native application directory and you need to wrap the whole app in NavigationContainer.

Done, now run your app using following command:

Your app is ready with two screens and move between screen by click button (Go to Login and Go to Home). More details Stack Navigator click here.

Thank you for carefully read my article If you have any query please Leave your query on following comment section or contact with us. Hope it will help you.