Created
December 30, 2021 11:03
-
-
Save swahaniroy/e9ada478cc40d13844a41a0e7e61d523 to your computer and use it in GitHub Desktop.
The Tabs File
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import React from 'react'; | |
| import { Image, StyleSheet } from 'react-native'; | |
| import { createBottomTabNavigator } from '@react-navigation/bottom-tabs'; | |
| import Home from '../home/Home'; | |
| import Notifications from '../notification/Notifications'; | |
| import Profile from '../profile/Profile'; | |
| const Tab = createBottomTabNavigator(); | |
| const Tabs = () => { | |
| return ( | |
| <Tab.Navigator screenOptions={({ route }) => ({ | |
| tabBarIcon: ({ focused, color, size }) => { | |
| if (route.name === 'Feed') { | |
| const homeIcon = focused ? require('../../images/home-active.png') : require('../../images/home.png'); | |
| return <Image style={styles.tabBarIconStyle} source={homeIcon} /> | |
| } else if (route.name === 'Notifications') { | |
| const notificationIcon = focused ? require('../../images/bell-active.png') : require('../../images/bell.png'); | |
| return <Image style={styles.tabBarIconStyle} source={notificationIcon} /> | |
| } else if (route.name === 'Profile') { | |
| const profileIcon = focused ? require('../../images/user-active.png') : require('../../images/user.png'); | |
| return <Image style={styles.tabBarIconStyle} source={profileIcon} /> | |
| } | |
| return null; | |
| }, | |
| tabBarLabelStyle: styles.tabBarLabelStyle, | |
| tabBarActiveTintColor: '#3B82F6', | |
| tabBarInactiveTintColor: '#000', | |
| headerShown: false, | |
| unmountOnBlur: true | |
| })}> | |
| <Tab.Screen name="Feed" component={Home} /> | |
| <Tab.Screen name="Notifications" component={Notifications} /> | |
| <Tab.Screen name="Profile" component={Profile} /> | |
| </Tab.Navigator> | |
| ); | |
| }; | |
| const styles = StyleSheet.create({ | |
| tabBarIconStyle: { | |
| width: 24, | |
| height: 24 | |
| }, | |
| tabBarLabelStyle: { | |
| fontSize: 14, | |
| fontWeight: 'bold' | |
| } | |
| }); | |
| export default Tabs; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment