Skip to content

Commit

Permalink
UPDATE: botton tab added
Browse files Browse the repository at this point in the history
  • Loading branch information
rishal-ERPGULF committed Sep 15, 2023
1 parent b09c1ac commit 12b013f
Show file tree
Hide file tree
Showing 8 changed files with 127 additions and 12 deletions.
2 changes: 0 additions & 2 deletions components/Home/WelcomeCard.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import { useDispatch, useSelector } from "react-redux";
import { setSignOut } from "../../redux/Slices/AuthSlice";
const WelcomeCard = () => {
const fullname = useSelector((state) => state.user.fullname);
const dispatch = useDispatch();
return (
<View
style={{ backgroundColor: COLORS.primary, width: "100%" }}
Expand All @@ -23,7 +22,6 @@ const WelcomeCard = () => {
<Text className="text-xl font-bold text-white">Home</Text>
<TouchableOpacity
onPress={() => {
dispatch(setSignOut());
}}
className="bg-orange-400 w-12 h-12 items-center justify-center rounded-full"
>
Expand Down
2 changes: 1 addition & 1 deletion components/Home/YourLavas.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ const LavaMenu = () => {
</View>
</View>
{/* second row */}
<View className="mb-2">
<View >
<View
className="flex-row justify-between items-center py-2.5 px-3 rounded-t-xl"
style={{ width: "100%", backgroundColor: COLORS.primary }}
Expand Down
6 changes: 3 additions & 3 deletions navigation/app-navigator.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,19 @@ import {
AttendanceAction,
AttendanceCamera,
AttendanceHistory,
Home,
SelectQuickAccess,
TripDetails,
} from "../screens";
import HomeTabGroup from "./home.tabbar";
const Stack = createNativeStackNavigator();

const AppNavigator = () => {
return (
<Stack.Navigator
initialRouteName="home"
initialRouteName="homeTab"
screenOptions={{ headerShown: false }}
>
<Stack.Screen name="home" component={Home} />
<Stack.Screen name="homeTab" component={HomeTabGroup} />
<Stack.Screen name="Attendance action" component={AttendanceAction} />
<Stack.Screen name="Attendance history" component={AttendanceHistory} />
<Stack.Screen name="Quick access" component={SelectQuickAccess} />
Expand Down
48 changes: 48 additions & 0 deletions navigation/home.tabbar.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
import React from "react";
import { createBottomTabNavigator } from "@react-navigation/bottom-tabs";
import { Home } from "../screens";
import Ionicons from "react-native-vector-icons/Ionicons";
import { COLORS } from "../constants";

const TabStack = createBottomTabNavigator();

const HomeTabGroup = () => {
return (
<TabStack.Navigator
screenOptions={({ route }) => ({
tabBarActiveTintColor: COLORS.primary,
tabBarIcon: ({ focused, color }) => {
let iconName;
if (route.name === "home") {
iconName = focused ? "home" : "home-outline";
return <Ionicons name={iconName} size={32} color={color} />;
}
if (route.name === "profile") {
iconName = focused ? "person" : "person-outline";
return <Ionicons name={iconName} size={32} color={color} />;
}
if (route.name === "chat") {
iconName = focused
? "chatbubble-ellipses"
: "chatbubble-ellipses-outline";
return <Ionicons name={iconName} size={32} color={color} />;
}
},
headerShown: false,
tabBarShowLabel: false,
tabBarStyle: {
position: "absolute",
height: 80,
borderWidth: 0,
paddingBottom: 25,
},
})}
>
<TabStack.Screen name="home" component={Home} />
<TabStack.Screen name="chat" component={Home} />
<TabStack.Screen name="profile" component={Home} />
</TabStack.Navigator>
);
};

export default HomeTabGroup;
2 changes: 1 addition & 1 deletion navigation/navigator.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import AuthNavigator from "./auth-navigator";
const Navigator = () => {
const isLoggedIn = useSelector(selectIsLoggedIn);
return (
<NavigationContainer>
<NavigationContainer >
{isLoggedIn ? <AppNavigator /> : <AuthNavigator />}
</NavigationContainer>
);
Expand Down
68 changes: 68 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
},
"dependencies": {
"@react-native-async-storage/async-storage": "1.18.2",
"@react-navigation/bottom-tabs": "^6.5.8",
"@react-navigation/native": "^6.1.7",
"@react-navigation/native-stack": "^6.9.13",
"@reduxjs/toolkit": "^1.9.5",
Expand Down
10 changes: 5 additions & 5 deletions screens/Home.jsx
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
import { ScrollView } from "react-native";
import { ScrollView, View } from "react-native";
import React from "react";
import { LavaMenu, QuickAccess, WelcomeCard } from "../components/Home";
import { SafeAreaView } from "react-native-safe-area-context";
import { useNavigation } from "@react-navigation/native";

import Constants from 'expo-constants'
const Home = ( ) => {
const navigation = useNavigation();
return (
<SafeAreaView
<View
style={{
flex: 1,
alignItems: "center",
paddingTop:Constants.statusBarHeight
}}
className="bg-gray-200"
>
Expand All @@ -26,7 +26,7 @@ const Home = ( ) => {
<QuickAccess navigation={navigation} />
<LavaMenu navigation={navigation} />
</ScrollView>
</SafeAreaView>
</View>
);
};

Expand Down

0 comments on commit 12b013f

Please sign in to comment.