import React, { useState } from "react";
import {
View,
Platform,
UIManager,
Dimensions,
Pressable,
Text,
TouchableOpacity,
Image,
Appearance,
} from "react-native";
import { useNavigation } from "@react-navigation/native";
import { Ionicons, AntDesign } from "@expo/vector-icons";
import { connect } from "react-redux";
import { user } from "../redux/actions";
import Svg, { Path } from "react-native-svg";
//style
import tw from "tailwind-rn";
import fontSize from "../constants/fontSize";
import Colors from "../constants/Colors";
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, user = JSON.parse(user) }) => {
const colorScheme = Appearance.getColorScheme();
const [routes, setRoutes] = useState([
{
name: "صفحه اصلی",
route: "Home",
icon: ,
toast: "",
message: "",
},
{
name: "فعال سازی",
route: "Activation",
icon: ,
toast: "",
message: "",
},
{
name: "واقعیت افزوده",
route: "AR",
icon: ,
toast: "",
message: "",
},
{
name: "سفارشات",
route: "Orders",
icon: ,
toast: "",
message: "",
},
{
name: "سوالات متداول",
route: "Faq",
icon: ,
toast: "",
message: "",
},
{
name: "تماس با ما",
route: "Contact",
icon: ,
toast: "",
message: "",
},
]);
const [addUserDropdown, setAddUserDropdown] = useState(false);
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" : ""}`
),
]}
>
{user?.picFileId ? (
) : (
)}
{user?.firstName + " " + user?.lastName}
{user?.cellphone}
{routes.map((route, index) => (
))}
);
};
const mapStateToProps = (state) => ({
user: state.user.status,
});
const mapDispatchToProps = {
logout: user.logout,
};
export default connect(mapStateToProps, mapDispatchToProps)(Drawer);