Bottom Tab Navigation In React Native

Updated 22 November 2024

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 at how navigation works in react native.

bottom tab nav

Navigation in React native:

Navigation : 

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

For example, open a login screen on the login button click.

At different platforms, the process is different to achieve the navigation

like :

On the web, we use a href tag.

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

Let’s take an example of navigation

In this example, we have two screens Home screen and About screen.
The home screen has a button on which click you will navigate to the “About screen”.

Install the required packages in your sample project:

Let’s code for the 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
about screen

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

So, let’s move to the Bottom Tab Navigation.

Bottom Tab  Navigation In React Native

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

Types of Tab Navigation

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

Let’s take an example of the bottom tab bar navigation

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

Install the below package in our sample.

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

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

App.js

Now run the sample code

Result :

this is home screen
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 the below dependency to your project.

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

Conclusion

In this blog, we learned about Bottom Tab Navigation in React Native and explored how to set up a navigation flow between multiple screens using the @react-navigation/bottom-tabs library.

By implementing bottom tab navigation, we can create a more intuitive and accessible UI for users to switch between different sections of an app seamlessly.

We also covered how to enhance the navigation experience by using custom icons and configuring the tab bar’s appearance.

You can also check other blogs from here.

Thank you for reading! ❤️

author
. . .

Leave a Comment

Your email address will not be published. Required fields are marked*


Be the first to comment.

Start a Project


    Message Sent!

    If you have more details or questions, you can reply to the received confirmation email.

    Back to Home