|
|
|
@ -21,9 +21,6 @@ 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 |
|
|
|
@ -31,7 +28,10 @@ if ( |
|
|
|
|
UIManager.setLayoutAnimationEnabledExperimental(true); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
const Drawer = ({ position, setBoxPosition, user = JSON.parse(user) }) => { |
|
|
|
|
const Drawer = ({ position, setBoxPosition, user, mobile }) => { |
|
|
|
|
const [height, setHeight] = useState(Dimensions.get("window").height); |
|
|
|
|
const [width, setWidth] = useState(Dimensions.get("window").width); |
|
|
|
|
|
|
|
|
|
const colorScheme = Appearance.getColorScheme(); |
|
|
|
|
const [routes, setRoutes] = useState([ |
|
|
|
|
{ |
|
|
|
@ -83,7 +83,11 @@ const Drawer = ({ position, setBoxPosition, user = JSON.parse(user) }) => { |
|
|
|
|
return ( |
|
|
|
|
<TouchableOpacity |
|
|
|
|
style={[ |
|
|
|
|
tw("w-full flex flex-row-reverse justify-start items-end mt-6"), |
|
|
|
|
tw( |
|
|
|
|
`w-full flex flex-row-reverse justify-start items-end ${ |
|
|
|
|
mobile ? "mt-6" : "mt-10" |
|
|
|
|
}` |
|
|
|
|
), |
|
|
|
|
{}, |
|
|
|
|
]} |
|
|
|
|
onPress={() => navigation.navigate(route.route)} |
|
|
|
@ -92,7 +96,10 @@ const Drawer = ({ position, setBoxPosition, user = JSON.parse(user) }) => { |
|
|
|
|
<Text |
|
|
|
|
style={[ |
|
|
|
|
tw("mr-2"), |
|
|
|
|
{ fontFamily: "regular", fontSize: fontSize.base }, |
|
|
|
|
{ |
|
|
|
|
fontFamily: "regular", |
|
|
|
|
fontSize: mobile ? fontSize.base : fontSize.lg, |
|
|
|
|
}, |
|
|
|
|
]} |
|
|
|
|
> |
|
|
|
|
{route.name} |
|
|
|
@ -101,6 +108,11 @@ const Drawer = ({ position, setBoxPosition, user = JSON.parse(user) }) => { |
|
|
|
|
); |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
const onLayout = () => { |
|
|
|
|
setHeight(Dimensions.get("window").height); |
|
|
|
|
setWidth(Dimensions.get("window").width); |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
return ( |
|
|
|
|
<View |
|
|
|
|
style={[ |
|
|
|
@ -112,6 +124,7 @@ const Drawer = ({ position, setBoxPosition, user = JSON.parse(user) }) => { |
|
|
|
|
zIndex: 10000, |
|
|
|
|
}, |
|
|
|
|
]} |
|
|
|
|
onLayout={() => onLayout()} |
|
|
|
|
> |
|
|
|
|
<Pressable |
|
|
|
|
onPress={() => setBoxPosition()} |
|
|
|
@ -124,43 +137,51 @@ const Drawer = ({ position, setBoxPosition, user = JSON.parse(user) }) => { |
|
|
|
|
<View style={[tw("w-4/5 bg-white h-full flex flex-col")]}> |
|
|
|
|
<View |
|
|
|
|
style={[ |
|
|
|
|
tw("flex flex-col items-end pt-3 pb-1 px-4"), |
|
|
|
|
tw("flex flex-col items-end pt-12 pb-1 px-4"), |
|
|
|
|
{ backgroundColor: Colors.theme1[colorScheme].greenCF }, |
|
|
|
|
]} |
|
|
|
|
> |
|
|
|
|
{user?.picFileId ? ( |
|
|
|
|
{user?.picFileIds ? ( |
|
|
|
|
<Image |
|
|
|
|
source={{ uri: "https://dnvn.ir/api/v1/" + user.picFileId }} |
|
|
|
|
style={[tw("rounded-full"), { width: 60, height: 60 }]} |
|
|
|
|
source={{ uri: "https://dnvn.ir/api/v1/" + user.picFileIds }} |
|
|
|
|
style={[ |
|
|
|
|
tw("rounded-full"), |
|
|
|
|
{ width: mobile ? 60 : 100, height: mobile ? 60 : 100 }, |
|
|
|
|
]} |
|
|
|
|
/> |
|
|
|
|
) : ( |
|
|
|
|
<View |
|
|
|
|
style={[ |
|
|
|
|
tw("rounded-full bg-gray-200"), |
|
|
|
|
{ minWidth: 60, minHeight: 60, zIndex : 1 }, |
|
|
|
|
{ |
|
|
|
|
width: mobile ? 60 : 100, |
|
|
|
|
height: mobile ? 60 : 100, |
|
|
|
|
zIndex: 1, |
|
|
|
|
}, |
|
|
|
|
]} |
|
|
|
|
></View> |
|
|
|
|
)} |
|
|
|
|
<View |
|
|
|
|
style={tw( |
|
|
|
|
"flex flex-row-reverse w-full justify-between px-2 pb-3 mt-1" |
|
|
|
|
"flex flex-row-reverse w-full justify-between px-2 pb-3 mt-2" |
|
|
|
|
)} |
|
|
|
|
> |
|
|
|
|
<View style={tw("flex flex-col")}> |
|
|
|
|
<Text |
|
|
|
|
style={{ |
|
|
|
|
fontSize: fontSize.lg, |
|
|
|
|
fontSize: mobile ? fontSize.lg : fontSize.xl, |
|
|
|
|
color: "white", |
|
|
|
|
fontFamily: "bold", |
|
|
|
|
fontFamily: "demi", |
|
|
|
|
}} |
|
|
|
|
> |
|
|
|
|
{user?.firstName + " " + user?.lastName} |
|
|
|
|
</Text> |
|
|
|
|
<Text |
|
|
|
|
style={{ |
|
|
|
|
fontSize: fontSize.tiny, |
|
|
|
|
color: "white",
|
|
|
|
|
fontSize: mobile ? fontSize.tiny : fontSize.lg, |
|
|
|
|
color: "white", |
|
|
|
|
fontFamily: "bold", |
|
|
|
|
marginTop: 5, |
|
|
|
|
}} |
|
|
|
|
> |
|
|
|
|
{user?.cellphone} |
|
|
|
@ -197,6 +218,7 @@ const Drawer = ({ position, setBoxPosition, user = JSON.parse(user) }) => { |
|
|
|
|
|
|
|
|
|
const mapStateToProps = (state) => ({ |
|
|
|
|
user: state.user.status, |
|
|
|
|
mobile: state.publicApi.mobile, |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
const mapDispatchToProps = { |
|
|
|
|