Obanana_test/app/components/main/BottomNav.js

109 lines
3.1 KiB
JavaScript

import React, { useState } from "react";
import { Image, StyleSheet, TouchableOpacity, View } from "react-native";
import { faCartShopping, faStore } from "@fortawesome/free-solid-svg-icons";
import {
faBell,
faComment,
faComments,
faUserCircle,
} from "@fortawesome/free-regular-svg-icons";
import { FontAwesomeIcon } from "@fortawesome/react-native-fontawesome";
const BottomNav = ({ settabActive, activeTab }) => {
const tabSwitch = (e) => {
settabActive(e);
};
return (
<View style={styles.container}>
<View style={styles.wrapper}>
<TouchableOpacity
style={styles.button}
onPress={() => tabSwitch("home")}
>
{activeTab === "home" ? (
<FontAwesomeIcon icon={faStore} color={"#FFAA00"} size={25} />
) : (
<FontAwesomeIcon icon={faStore} color={"#888888"} size={25} />
)}
</TouchableOpacity>
{/* <TouchableOpacity
style={styles.button}
onPress={() => tabSwitch("notif")}
>
{activeTab === "notif" ? (
<FontAwesomeIcon icon={faBell} color={"#FFAA00"} size={25} />
) : (
<FontAwesomeIcon icon={faBell} color={"#888888"} size={25} />
)}
</TouchableOpacity> */}
<TouchableOpacity
style={styles.button}
onPress={() => tabSwitch("message")}
>
{activeTab === "message" ? (
<FontAwesomeIcon icon={faComments} color={"#FFAA00"} size={25} />
) : (
<FontAwesomeIcon icon={faComments} color={"#888888"} size={25} />
)}
</TouchableOpacity>
<TouchableOpacity
style={styles.button}
onPress={() => tabSwitch("cart")}
>
{activeTab === "cart" ? (
<FontAwesomeIcon
icon={faCartShopping}
color={"#FFAA00"}
size={25}
/>
) : (
<FontAwesomeIcon
icon={faCartShopping}
color={"#888888"}
size={25}
/>
)}
</TouchableOpacity>
<TouchableOpacity
style={styles.button}
onPress={() => tabSwitch("profile")}
>
{activeTab === "profile" ? (
<FontAwesomeIcon icon={faUserCircle} color={"#FFAA00"} size={25} />
) : (
<FontAwesomeIcon icon={faUserCircle} color={"#888888"} size={25} />
)}
</TouchableOpacity>
</View>
</View>
);
};
const styles = StyleSheet.create({
container: {
// flex: 1,
backgroundColor: "#fff",
alignItems: "center",
justifyContent: "center",
width: "100%",
bottom: 0,
// position: "fixed",
// paddingVertical: 15,
paddingBottom:5,
boxShadow: "0px 0px 3px 0px rgba(0, 0, 0, 0.25)",
},
wrapper: {
flexDirection: "row",
width: "100%",
alignItems: "center",
justifyContent: "space-around",
margin: "auto",
borderTopColor: "#ddd",
borderTopWidth: 1,
},
button: {
padding: 15,
// paddingBottom: 25,
},
});
export default BottomNav;