Skip to content

Wrapper library over the @react-navigation/bottom-tabs. The main purpose of this library is to support displaying tabbar on side.

Notifications You must be signed in to change notification settings

tarikfp/react-native-tabs-sidebar

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

React Navigation Side Bar · npm

Wrapper library over the @react-navigation/bottom-tabs. The main purpose of this library is to support displaying tabbar on side.

If you wanted to use sidebar in your tablet/mobile apps, but haven't found a way to achieve it, then this library might be the one that you are looking for.

  • Make sure to install required packages as stated in the https://reactnavigation.org/docs/getting-started/ docs.
  • Instead of using @react-navigation/bottom-tabs you can now instead install this library in order to achieve displaying tabs on the sidebar !

Usage

Provide tabBarPosition prop with the desired value to the screenOptions config. That's it! 🎉

Tabs will be displayed on the bottom in case tabBarPosition is undefined.

import {createBottomTabNavigator} from '@tarikfp/react-native-tabs-sidebar';

    const TabBar = createBottomTabNavigator();

    <TabBar.Navigator
      ...
      screenOptions={({route}) => ({
        ...otherOptions
        tabBarPosition: "left"
      })}>
      <TabBar.Screen name={RouteNames.Home} component={HomeScreen} />
    </TabBar.Navigator>

Screenshots

Android Tablet

Right sidebar

wwuM0v.md.png

Left sidebar

wwu1sa.md.png

iOS Tablet

Right sidebar

wwu6eS.md.png

Left sidebar

wwuUg4.md.png

Emulators/Simulators

Android

wwA0pS.md.png

iOS

wwupdQ.md.png

Dynamic usage

You can prefer not to use sidebar in some specific cases. To do so;

    <TabBar.Navigator
      ...
      screenOptions={({route}) => ({
        ...otherOptions
        tabBarPosition: route.name === "yourRouteName" ? "right" : undefined
      })}>
      <TabBar.Screen name={RouteNames.Home} component={HomeScreen} />
    </TabBar.Navigator>

Bottom tabbar usage

Display on bottom, default behavior.

    <TabBar.Navigator
      ...
      screenOptions={({route}) => ({
        ...otherOptions
        tabBarPosition: undefined // or do not provide tabBarPosition
      })}>
      <TabBar.Screen name={RouteNames.Home} component={HomeScreen} />
    </TabBar.Navigator>

ww746u.png

About

Wrapper library over the @react-navigation/bottom-tabs. The main purpose of this library is to support displaying tabbar on side.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published