Skip to content

Commit

Permalink
tab button add
Browse files Browse the repository at this point in the history
  • Loading branch information
“T3sultan” committed Apr 17, 2022
1 parent d45dc00 commit b7079e9
Show file tree
Hide file tree
Showing 19 changed files with 169 additions and 4 deletions.
7 changes: 6 additions & 1 deletion App.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { AppLoading } from "expo";
import { NavigationContainer } from "@react-navigation/native";
import { createNativeStackNavigator } from "@react-navigation/native-stack";
import { Home } from "./src/screens/app";
import AppNavigation from "./src/navigation/AppNavigation";

const Stack = createNativeStackNavigator();

Expand All @@ -21,7 +22,11 @@ export default function App() {
return (
<NavigationContainer>
<Stack.Navigator>
<Stack.Screen name="Home" component={Home} />
<Stack.Screen
options={{ headerShown: false }}
name="AppNavigation"
component={AppNavigation}
/>
</Stack.Navigator>
</NavigationContainer>
);
Expand Down
Binary file added assets/box.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 assets/camera.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 assets/delivery-box.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 assets/favorite.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 assets/heart.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 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 assets/house.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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 assets/photo.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 assets/search-interface-symbol.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
72 changes: 72 additions & 0 deletions src/navigation/AppNavigation.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
import { StyleSheet, Text, View, Image } from "react-native";
import React from "react";
import { createBottomTabNavigator } from "@react-navigation/bottom-tabs";
// import Home from "../screens/app";
import Camera from "../screens/app/Camera";
import Search from "../screens/app/Search";
import Favourite from "../screens/app/Favourite";
import { Images } from "../theme";
import Box from "../screens/app/Box";
import Home from "../screens/app/Home";

const Tab = createBottomTabNavigator();

const AppNavigation = () => {
return (
<Tab.Navigator
screenOptions={({ route }) => ({
tabBarIcon: ({ focused }) => {
let iconName;
if (route.name === "Home") {
iconName = focused ? Images.homeActive : Images.homeInActive;
} else if (route.name === "Box") {
iconName = focused ? Images.BoxInActive : Images.BoxActive;
} else if (route.name === "Camera") {
iconName = focused ? Images.CameraActive : Images.CameraInActive;
} else if (route.name === "Favourite") {
iconName = focused
? Images.favouriteActive
: Images.favouriteInActive;
} else if (route.name === "Search") {
iconName = Images.search;
}

return (
<Image
style={{ width: 24, height: 24 }}
resizeMode="contain"
source={iconName}
/>
);
},
tabBarLabel: () => null,
})}
>
<Tab.Screen
name="Home"
component={Home}
options={{ headerShown: false }}
/>
<Tab.Screen name="Box" component={Box} options={{ headerShown: false }} />
<Tab.Screen
name="Camera"
component={Camera}
options={{ headerShown: false }}
/>
<Tab.Screen
name="Search"
component={Search}
options={{ headerShown: false }}
/>
<Tab.Screen
name="Favourite"
component={Favourite}
options={{ headerShown: false }}
/>
</Tab.Navigator>
);
};

export default AppNavigation;

const styles = StyleSheet.create({});
21 changes: 21 additions & 0 deletions src/navigation/MainNavigation.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import { StyleSheet, Text, View } from "react-native";
import React from "react";

import { NavigationContainer } from "@react-navigation/native";
import { createNativeStackNavigator } from "@react-navigation/native-stack";

const Stack = createNativeStackNavigator();

const MainNavigation = () => {
return (
<NavigationContainer>
<Stack.Navigator>
<Stack.Screen name="Home" component={AppNavigation} />
</Stack.Navigator>
</NavigationContainer>
);
};

export default MainNavigation;

const styles = StyleSheet.create({});
14 changes: 14 additions & 0 deletions src/screens/app/Box.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import { StyleSheet, Text, View } from "react-native";
import React from "react";

const Box = () => {
return (
<View>
<Text>Box</Text>
</View>
);
};

export default Box;

const styles = StyleSheet.create({});
14 changes: 14 additions & 0 deletions src/screens/app/Camera.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import { StyleSheet, Text, View } from "react-native";
import React from "react";

const Camera = () => {
return (
<View>
<Text>Camera</Text>
</View>
);
};

export default Camera;

const styles = StyleSheet.create({});
14 changes: 14 additions & 0 deletions src/screens/app/Favourite.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import { StyleSheet, Text, View } from "react-native";
import React from "react";

const Favourite = () => {
return (
<View>
<Text>Favourite</Text>
</View>
);
};

export default Favourite;

const styles = StyleSheet.create({});
14 changes: 14 additions & 0 deletions src/screens/app/Search.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import { StyleSheet, Text, View } from "react-native";
import React from "react";

const Search = () => {
return (
<View>
<Text>Search</Text>
</View>
);
};

export default Search;

const styles = StyleSheet.create({});
6 changes: 3 additions & 3 deletions src/screens/app/index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import Home from "./Home";
import PlantDetails from "./PlantDetails";
// import Home from "./Home";
// import PlantDetails from "./PlantDetails";

export { Home, PlantDetails };
// export { Home, PlantDetails };
11 changes: 11 additions & 0 deletions src/theme/images.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,16 @@ const images = {
profile4: require("../../assets/images/plant_4.jpg"),
profile5: require("../../assets/images/plant_5.jpg"),
bannerBg: require("../../assets/images/banner_bg.jpg"),

//tabs icon
homeActive: require("../../assets/house.png"),
homeInActive: require("../../assets/home.png"),
BoxActive: require("../../assets/delivery-box.png"),
BoxInActive: require("../../assets/box.png"),
CameraActive: require("../../assets/photo.png"),
CameraInActive: require("../../assets/camera.png"),
search: require("../../assets/search-interface-symbol.png"),
favouriteActive: require("../../assets/favorite.png"),
favouriteInActive: require("../../assets/heart.png"),
};
export default images;

0 comments on commit b7079e9

Please sign in to comment.