Redeem Now
Read More
Read now

Bottom Tab Navigation In React Native

Save

In this blog, we will learn about Navigation and Bottom tab navigation in react native.

Before going to our topic Bottom tab navigation just take a look how navigation works in react native.

Navigation in React native:


Navigation : 

As we know a website or a mobile application consist of many screens and pages. To move form one screen to another or to show other screen on button click is navigation.

For  example open a login screen on login button click.

At different platform the process is different to achieve the navigation

like :

In web we  use href tag.

Navigation in react native can be achieve using  navigation library and navigate prop.

Let’s take an example of navigation

In this example we have two screen Home screen and About screen.
Home screen have a button on which click you will navigate to about screen.

Install the required packages in your sample project:

 

Let’s code for Home Screen.

Home.js

 

Let’s code for About Screen.

About.js

 

Now main part of our sample code due to which we will be able to navigate is in our App.js file.

App.js

 

Now Run the sample App.

Result :

 

 

 

Home screen
Home Screen

 

 

about_screen
About screen

So far, we have learn how navigation works in react native. Now our sample app is able to navigate from one screen to another.

So, let’s move to Bottom Tab Navigation.

Bottom Tab  Navigation In React Native


Bottom tab navigation is one of most used navigation in mobile apps.

Types of Tab navigation

1. Bottom tab Navigation- In bottom tab navigation tab are aligned to bottom of the screen
2. Top tab navigation- Tabs are align to top of the screen  below header or toolbar.

Let’s take an example of bottom tab bar navigation

For bottom tab bar we are reusing the above navigation example.

 

Install the below package in our sample.

 

 

For Home screen and About screen we used same code as in navigation example. If you want to add or modify or redesign your screen you can do it accordingly.

There is little change in  app.js  class for bottom tab navigation.

App.js

Now run the sample code

Result :

home screen with bottom tab
Home screen with bottom tab
about screen with bottom tab
About screen with bottom tab

 

Troubleshooting.


You may face some issues/errors related to gesture and surface view and view area and screen.
To resolve these errors you have to add below dependency in your project.

 

If you want to learn more about bottom tab navigation in react native, you can visit  here.

 

Conclusion


In this blog we have learn about navigation in react native and how we can achieve navigation through bottom tabs in react native.

Hope ! this will help you in finding what you are looking for.

Thanks for reading.

. . .

Comment

Add Your Comment

Be the first to comment.

css.php
Hire Us!
Brief us about your requirements and we'll get back to you.
Woo! Hooy!
We have just recieved your project brief and our expert will contact you shortly.
Send Again
Close