Skip to content

Commit

Permalink
bottom tab navigation created
Browse files Browse the repository at this point in the history
  • Loading branch information
vallabh2920 committed Oct 14, 2021
1 parent 79192d9 commit 4e44662
Show file tree
Hide file tree
Showing 20 changed files with 307 additions and 24 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
},
"dependencies": {
"@react-native-community/checkbox": "^0.5.8",
"@react-navigation/bottom-tabs": "^6.0.9",
"@react-navigation/native": "^6.0.2",
"@react-navigation/native-stack": "^6.1.0",
"@react-navigation/stack": "^6.0.7",
Expand Down
Binary file added src/assets/home.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/assets/homeicon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/assets/percent.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/assets/prachit.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/assets/profile.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/assets/profileicon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions src/components/background/Background.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { StatusBar } from "expo-status-bar";
import React, { ReactElement, ReactNode } from "react";
import { SafeAreaView, StyleSheet } from "react-native";
import { ScrollView } from "react-native-gesture-handler";

type background = {
children: ReactNode;
Expand Down
47 changes: 27 additions & 20 deletions src/config/Navigator.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import React, { ReactElement } from "react";
import { NavigationContainer } from "@react-navigation/native";
import { createStackNavigator } from "@react-navigation/stack";
import {
Home,
Getstarted,
Language,
Register,
Expand All @@ -10,32 +11,38 @@ import {
PoliceDetail,
DetailFilled,
CitizenSignin,
CitizenSignup
CitizenSignup,
Profile
} from "@screens";

import { StackNavigatorParams } from "@types";

const Stack = createStackNavigator<StackNavigatorParams>();

export default function Navigator(): ReactElement {
return (
<NavigationContainer>
<Stack.Navigator
initialRouteName="DetailFilled"
screenOptions={{
headerMode: "screen",
headerShown: false
}}
>
<Stack.Screen name="Getstarted" component={Getstarted} />
<Stack.Screen name="Language" component={Language} />
<Stack.Screen name="Register" component={Register} />
<Stack.Screen name="PoliceSignin" component={PoliceSignin} />
<Stack.Screen name="PoliceSignup" component={PoliceSignup} />
<Stack.Screen name="CitizenSignin" component={CitizenSignin} />
<Stack.Screen name="CitizenSignup" component={CitizenSignup} />
<Stack.Screen name="PoliceDetail" component={PoliceDetail} />
<Stack.Screen name="DetailFilled" component={DetailFilled} />
</Stack.Navigator>
</NavigationContainer>
<>
<NavigationContainer>
<Stack.Navigator
initialRouteName="Home"
screenOptions={{
headerMode: "screen",
headerShown: false
}}
>
<Stack.Screen name="Home" component={Home} />
<Stack.Screen name="Profile" component={Profile} />
<Stack.Screen name="Getstarted" component={Getstarted} />
<Stack.Screen name="Language" component={Language} />
<Stack.Screen name="Register" component={Register} />
<Stack.Screen name="PoliceSignin" component={PoliceSignin} />
<Stack.Screen name="PoliceSignup" component={PoliceSignup} />
<Stack.Screen name="CitizenSignin" component={CitizenSignin} />
<Stack.Screen name="CitizenSignup" component={CitizenSignup} />
<Stack.Screen name="PoliceDetail" component={PoliceDetail} />
<Stack.Screen name="DetailFilled" component={DetailFilled} />
</Stack.Navigator>
</NavigationContainer>
</>
);
}
1 change: 1 addition & 0 deletions src/config/index.ts
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
export { default as Navigator } from "./navigator";
export { default as Tab } from "./tabnavigator/Tab";
88 changes: 88 additions & 0 deletions src/config/tabnavigator/Tab.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
import { createBottomTabNavigator } from "@react-navigation/bottom-tabs";
import React from "react";
import { Home, Profile } from "@screens";
import { View, Image, TouchableOpacity } from "react-native";
import { Text } from "@components";

const Tab = createBottomTabNavigator();

const Tabs = () => {
return (
<Tab.Navigator
screenOptions={{
headerShown: false,
tabBarShowLabel: false,
tabBarStyle: {
position: "absolute",
bottom: 25,
left: 20,
right: 20,
elevation: 0,
borderRadius: 10,
height: 80,
backgroundColor: "#389FFE"
}
}}
>
<Tab.Screen
name="Home"
component={Home}
options={{
tabBarIcon: ({ focused }) => (
<View style={{ alignItems: "center", justifyContent: "center" }}>
<Image
source={require("@assets/homeicon.png")}
resizeMode="contain"
style={{
height: 25,
width: 25,
marginBottom: 5,
tintColor: focused ? "#1C32F3" : "#FFF"
}}
/>
<Text
weight="200"
style={{
color: focused ? "#1C32F3" : "#FFF",
fontFamily: "Chillax-Medium"
}}
>
HOME
</Text>
</View>
)
}}
/>
<Tab.Screen
name="Profile"
component={Profile}
options={{
tabBarIcon: ({ focused }) => (
<View style={{ alignItems: "center", justifyContent: "center" }}>
<Image
source={require("@assets/profileicon.png")}
resizeMode="contain"
style={{
height: 25,
width: 25,
marginBottom: 5,
tintColor: focused ? "#1C32F3" : "#FFF"
}}
/>
<Text
weight="200"
style={{
color: focused ? "#1C32F3" : "#FFF",
fontFamily: "Chillax-Medium"
}}
>
PROFILE
</Text>
</View>
)
}}
/>
</Tab.Navigator>
);
};
export default Tabs;
12 changes: 12 additions & 0 deletions src/index.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,22 @@
import React, { ReactElement } from "react";
import { AppBootstrap } from "@components";
import Navigator from "@config/Navigator";
import Tabs from "@config/tabnavigator/Tab";
import { NavigationContainer } from "@react-navigation/native";
import { useState } from "react";

export default function App(): ReactElement {
const [login, setLogin] = useState(true);

return (
<AppBootstrap>
{/* {login ? (
<NavigationContainer>
<Tabs />
</NavigationContainer>
) : (
<Navigator />
)} */}
<Navigator />
</AppBootstrap>
);
Expand Down
32 changes: 32 additions & 0 deletions src/screens/homescreen/Home.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import React from "react";
import { View, Image } from "react-native";
import { Background, Text } from "@components";
import { StyleSheet } from "react-native";
import { LanguageNavigationProps } from "@types";

export function Home({ navigation }: LanguageNavigationProps<"Home">) {
return (
<Background>
<View style={styles.view}>
<Text style={styles.text} onPress={() => navigation.navigate("Profile")}>
{" "}
Complaints
</Text>
<Image source={require("@assets/home.png")} />
</View>
</Background>
);
}

const styles = StyleSheet.create({
view: {
alignItems: "center",
justifyContent: "center",
height: "100%"
},
text: {
color: "#fff",

marginBottom: 60
}
});
4 changes: 3 additions & 1 deletion src/screens/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export { Getstarted } from "./home/Getstarted";
export { Getstarted } from "./splashscreen/Getstarted";
export { Language } from "./language/Language";
export { default as Register } from "./register/Register";
export { PoliceSignin } from "./register/police/signin/PoliceSignin";
Expand All @@ -7,3 +7,5 @@ export { CitizenSignin } from "./register/citizen/signin/CitizenSignin";
export { CitizenSignup } from "./register/citizen/signup/CitizenSignup";
export { PoliceDetail } from "./register/police/detail/PoliceDetail";
export { DetailFilled } from "./register/police/detailfilled/DetailFilled";
export { Home } from "./homescreen/Home";
export { Profile } from "./profile/Profile";
121 changes: 121 additions & 0 deletions src/screens/profile/Profile.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,121 @@
import React from "react";
import { Background, Text } from "@components";
import { Image, View } from "react-native";
import { StyleSheet } from "react-native";

export function Profile() {
return (
<Background>
<View style={styles.view}>
<Image style={styles.img} source={require("@assets/prachit.png")} />
<View>
<Text
weight="400"
style={{
color: "#FFF",
textAlign: "center",
backgroundColor: "#1D0ECC",
height: 50,
width: 320,
borderTopLeftRadius: 10,
borderTopRightRadius: 10,
paddingVertical: 9
}}
>
prachit bipin gharat
</Text>
<View
style={{
display: "flex",
flexDirection: "row",
borderTopColor: "#FFF",
borderTopWidth: 1
}}
>
<Text
weight="400"
style={{
color: "#FFF",
textAlign: "center",
backgroundColor: "#1D0ECC",
height: 50,
width: 160,
borderBottomLeftRadius: 10,
paddingVertical: 9
}}
>
citizen
</Text>
<Text
weight="400"
style={{
color: "#FFF",
textAlign: "center",
backgroundColor: "#1D0ECC",
height: 50,
width: 160,
borderBottomRightRadius: 10,
paddingVertical: 9
}}
>
<Image source={require("@assets/percent.png")} />
90%
</Text>
</View>
</View>
<View>
<Text weight="400" style={styles.text}>
Edit Profile
</Text>
<Text weight="400" style={styles.text}>
Complaints
</Text>
<Text weight="400" style={styles.text}>
Setting
</Text>
<Text weight="400" style={styles.text}>
Help
</Text>
<Text weight="400" style={styles.text}>
Logout
</Text>
</View>
</View>
</Background>
);
}
const styles = StyleSheet.create({
view: {
display: "flex",
justifyContent: "center",
alignItems: "center",
height: "100%"
},
img: {
height: 170,
width: 170,
borderRadius: 95,
marginBottom: 30
},
// protext: {
// color: "#FFF",
// textAlign: "center",
// backgroundColor: "#1D0ECC",
// height: 50,
// width: 320,
// borderTopLeftRadius: 10,
// borderTopRightRadius: 10,

// paddingVertical: 9
// },
text: {
color: "#FFF",
textAlign: "center",
backgroundColor: "#1D0ECC",
height: 50,
width: 320,
borderRadius: 10,
marginVertical: 10,
paddingVertical: 9
}
});
8 changes: 5 additions & 3 deletions src/screens/register/police/signin/signin.styles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ const styles = StyleSheet.create({
display: "flex",
justifyContent: "center",
alignItems: "center",
height: "50%"
paddingTop: 45,
paddingBottom: 20
},
text: {
backgroundColor: "#FFF",
Expand All @@ -30,9 +31,10 @@ const styles = StyleSheet.create({
justifyContent: "center",
alignItems: "center",
backgroundColor: "#1D0ECC",
height: "55%",
paddingBottom: 250,
paddingTop: 30,
width: "100%",

marginVertical: 15,
borderTopLeftRadius: 60,
borderTopRightRadius: 60
},
Expand Down
File renamed without changes.
File renamed without changes.
Loading

0 comments on commit 4e44662

Please sign in to comment.