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