import React, { useState } from "react";
import {
View,
Platform,
UIManager,
Dimensions,
Pressable,
Text,
TouchableOpacity,
} from "react-native";
import { useNavigation } from "@react-navigation/native";
import { Ionicons, AntDesign } from "@expo/vector-icons";
import tw from "tailwind-rn";
import fontSize from "../constants/fontSize";
const width = Dimensions.get("window").width;
const height = Dimensions.get("window").height;
if (
Platform.OS === "android" &&
UIManager.setLayoutAnimationEnabledExperimental
) {
UIManager.setLayoutAnimationEnabledExperimental(true);
}
const Drawer = ({ position, setBoxPosition }) => {
const [routes, setRoutes] = useState([
{
name: "صفحه اصلی",
route: "Home",
icon: ,
toast: "",
message: "",
},
{
name: "فعال سازی",
route: "Activation",
icon: ,
toast: "",
message: "",
},
{
name: "پروفایل",
route: "Profile",
icon: ,
toast: "",
message: "",
},
{
name: "واقعیت افزوده",
route: "AR",
icon: ,
toast: "",
message: "",
},
{
name: "سفارشات",
route: "Orders",
icon: ,
toast: "",
message: "",
},
{
name: "سبد خرید",
route: "ShoppingCart",
icon: ,
toast: "",
message: "",
},
{
name: "سوالات متداول",
route: "Faq",
icon: ,
toast: "",
message: "",
},
{
name: "تماس با ما",
route: "Contact",
icon: ,
toast: "",
message: "",
},
]);
const navigation = useNavigation();
const Route = ({ route }) => {
return (
navigation.navigate(route.route)}
>
{route.icon}
{route.name}
);
};
return (
setBoxPosition()}
style={[tw(`w-1/5 h-full ${position === "0%" ? "bg-black bg-opacity-40" : ""}`)]}
>
{routes.map((route, index) => (
))}
);
};
export default Drawer;