|
|
|
@ -8,8 +8,7 @@ import { createNativeStackNavigator } from "@react-navigation/native-stack"; |
|
|
|
|
import { createBottomTabNavigator } from "@react-navigation/bottom-tabs"; |
|
|
|
|
import { connect } from "react-redux"; |
|
|
|
|
import { user, publicApi } from "../src/redux/actions"; |
|
|
|
|
import { useSafeAreaInsets } from 'react-native-safe-area-context'; |
|
|
|
|
|
|
|
|
|
import { useSafeAreaInsets } from "react-native-safe-area-context"; |
|
|
|
|
|
|
|
|
|
//components
|
|
|
|
|
import OrderDetails from "../src/screens/OrderDetails"; |
|
|
|
@ -50,7 +49,7 @@ import Colors from "../src/constants/Colors"; |
|
|
|
|
import fontSize from "../src/constants/fontSize"; |
|
|
|
|
|
|
|
|
|
const Tab = createBottomTabNavigator(); |
|
|
|
|
const BottomTabNavigator = ({}) => { |
|
|
|
|
const BottomTabNavigator = ({ theme }) => { |
|
|
|
|
const insets = useSafeAreaInsets(); |
|
|
|
|
const [headerShown, setHeaderShown] = React.useState(true); |
|
|
|
|
React.useEffect(() => { |
|
|
|
@ -58,6 +57,7 @@ const BottomTabNavigator = ({}) => { |
|
|
|
|
setHeaderShown(false); |
|
|
|
|
}, 600); |
|
|
|
|
}, []); |
|
|
|
|
|
|
|
|
|
return ( |
|
|
|
|
<Tab.Navigator |
|
|
|
|
initialRouteName="HomeTab" |
|
|
|
@ -71,10 +71,11 @@ const BottomTabNavigator = ({}) => { |
|
|
|
|
transform: [{ scaleX: -1 }], |
|
|
|
|
}, |
|
|
|
|
tabBarLabelPosition: "below-icon", |
|
|
|
|
tabBarActiveTintColor: Colors.theme1["light"].green79, |
|
|
|
|
tabBarActiveTintColor: Colors.theme1.green79, |
|
|
|
|
tabBarInactiveTintColor: "grey", |
|
|
|
|
tabBarStyle: { |
|
|
|
|
backgroundColor: Colors.theme1["light"].white, |
|
|
|
|
backgroundColor: |
|
|
|
|
theme === "light" ? Colors.theme1.white : Colors.theme1.dark, |
|
|
|
|
transform: [{ scaleX: -1 }], |
|
|
|
|
height: 65 + insets.bottom, |
|
|
|
|
}, |
|
|
|
@ -89,8 +90,7 @@ const BottomTabNavigator = ({}) => { |
|
|
|
|
> |
|
|
|
|
<Tab.Screen |
|
|
|
|
name="HomeTab" |
|
|
|
|
component={HomeStackScreen} |
|
|
|
|
|
|
|
|
|
children={() => <HomeStackScreen theme={theme} />} |
|
|
|
|
options={{ |
|
|
|
|
title: "خانه", |
|
|
|
|
tabBarIcon: ({ focused, color }) => |
|
|
|
@ -102,7 +102,7 @@ const BottomTabNavigator = ({}) => { |
|
|
|
|
> |
|
|
|
|
<Path |
|
|
|
|
d="M12.62 3.974 5.079 9.85a6.658 6.658 0 0 0-2.281 4.645v10.368a5.912 5.912 0 0 0 5.89 5.9h16.2a5.909 5.909 0 0 0 5.89-5.89V14.691a6.609 6.609 0 0 0-2.518-4.827l-8.644-6.058a6.278 6.278 0 0 0-6.996.168Z" |
|
|
|
|
fill={Colors.theme1["light"].green79} |
|
|
|
|
fill={Colors.theme1.green79} |
|
|
|
|
/> |
|
|
|
|
<Path |
|
|
|
|
data-name="Vector" |
|
|
|
@ -123,7 +123,7 @@ const BottomTabNavigator = ({}) => { |
|
|
|
|
<Path |
|
|
|
|
d="M12.62 3.974 5.079 9.85a6.658 6.658 0 0 0-2.281 4.645v10.368a5.912 5.912 0 0 0 5.89 5.9h16.2a5.909 5.909 0 0 0 5.89-5.89V14.691a6.609 6.609 0 0 0-2.518-4.827l-8.644-6.058a6.278 6.278 0 0 0-6.996.168Z" |
|
|
|
|
fill="none" |
|
|
|
|
stroke={Colors.theme1["light"].green79} |
|
|
|
|
stroke={Colors.theme1.green79} |
|
|
|
|
strokeLinecap="round" |
|
|
|
|
strokeLinejoin="round" |
|
|
|
|
strokeWidth={1.5} |
|
|
|
@ -132,7 +132,7 @@ const BottomTabNavigator = ({}) => { |
|
|
|
|
data-name="Vector" |
|
|
|
|
d="M16.79 25.471v-6.693" |
|
|
|
|
fill="none" |
|
|
|
|
stroke={Colors.theme1["light"].green79} |
|
|
|
|
stroke={Colors.theme1.green79} |
|
|
|
|
strokeLinecap="round" |
|
|
|
|
strokeLinejoin="round" |
|
|
|
|
strokeWidth={1.5} |
|
|
|
@ -143,7 +143,7 @@ const BottomTabNavigator = ({}) => { |
|
|
|
|
/> |
|
|
|
|
<Tab.Screen |
|
|
|
|
name="ProductsTab" |
|
|
|
|
component={ProductsStackScreen} |
|
|
|
|
children={() => <ProductsStackScreen theme={theme} />} |
|
|
|
|
options={{ |
|
|
|
|
title: "کتابها", |
|
|
|
|
tabBarIcon: ({ focused, color }) => |
|
|
|
@ -155,7 +155,7 @@ const BottomTabNavigator = ({}) => { |
|
|
|
|
> |
|
|
|
|
<Path |
|
|
|
|
d="M32.207 24.227V6.798a2.869 2.869 0 0 0-3.179-2.875h-.088a27.857 27.857 0 0 0-10.35 3.422l-.249.159a1.641 1.641 0 0 1-1.552 0l-.361-.216A27.72 27.72 0 0 0 6.09 3.909a2.864 2.864 0 0 0-3.162 2.874v17.444a2.981 2.981 0 0 0 2.547 2.859l.425.058a37.976 37.976 0 0 1 10.892 3.524l.059.029a1.6 1.6 0 0 0 1.405 0 37.631 37.631 0 0 1 10.921-3.552l.483-.058a2.981 2.981 0 0 0 2.547-2.86Z" |
|
|
|
|
fill={Colors.theme1["light"].green79} |
|
|
|
|
fill={Colors.theme1.green79} |
|
|
|
|
/> |
|
|
|
|
<Path |
|
|
|
|
data-name="Vector" |
|
|
|
@ -175,7 +175,7 @@ const BottomTabNavigator = ({}) => { |
|
|
|
|
> |
|
|
|
|
<G |
|
|
|
|
fill="none" |
|
|
|
|
stroke={Colors.theme1["light"].green79} |
|
|
|
|
stroke={Colors.theme1.green79} |
|
|
|
|
strokeLinecap="round" |
|
|
|
|
strokeLinejoin="round" |
|
|
|
|
strokeWidth={1.5} |
|
|
|
@ -193,7 +193,7 @@ const BottomTabNavigator = ({}) => { |
|
|
|
|
|
|
|
|
|
<Tab.Screen |
|
|
|
|
name="VODTab" |
|
|
|
|
component={VODStackScreen} |
|
|
|
|
children={() => <VODStackScreen theme={theme} />} |
|
|
|
|
options={{ |
|
|
|
|
unmountOnExit: true, |
|
|
|
|
unmountOnBlur: true, |
|
|
|
@ -204,8 +204,8 @@ const BottomTabNavigator = ({}) => { |
|
|
|
|
<G data-name="Group 2000"> |
|
|
|
|
<Path |
|
|
|
|
d="M25.421 29.241H8.974C4.04 29.241.75 26.392.75 19.744V10.25c0-6.651 3.29-9.5 8.224-9.5h16.447c4.935 0 8.229 2.849 8.229 9.5v9.5c0 6.642-3.294 9.491-8.229 9.491Z" |
|
|
|
|
fill={Colors.theme1["light"].green79} |
|
|
|
|
stroke={Colors.theme1["light"].green79} |
|
|
|
|
fill={Colors.theme1.green79} |
|
|
|
|
stroke={Colors.theme1.green79} |
|
|
|
|
strokeLinecap="round" |
|
|
|
|
strokeLinejoin="round" |
|
|
|
|
strokeWidth={1.5} |
|
|
|
@ -228,7 +228,7 @@ const BottomTabNavigator = ({}) => { |
|
|
|
|
<Path |
|
|
|
|
d="M25.421 29.241H8.974C4.04 29.241.75 26.392.75 19.744V10.25c0-6.651 3.29-9.5 8.224-9.5h16.447c4.935 0 8.229 2.849 8.229 9.5v9.5c0 6.642-3.294 9.491-8.229 9.491Z" |
|
|
|
|
fill="none" |
|
|
|
|
stroke={Colors.theme1["light"].green79} |
|
|
|
|
stroke={Colors.theme1.green79} |
|
|
|
|
strokeLinecap="round" |
|
|
|
|
strokeLinejoin="round" |
|
|
|
|
strokeWidth={1.5} |
|
|
|
@ -238,7 +238,7 @@ const BottomTabNavigator = ({}) => { |
|
|
|
|
data-name="Vector" |
|
|
|
|
d="M12.427 14.995v-2.083c0-2.673 1.892-3.766 4.2-2.43l1.805 1.042 1.806 1.041c2.308 1.336 2.308 3.523 0 4.86l-1.806 1.041-1.805 1.046c-2.308 1.332-4.2.239-4.2-2.434v-2.083Z" |
|
|
|
|
fill="none" |
|
|
|
|
stroke={Colors.theme1["light"].green79} |
|
|
|
|
stroke={Colors.theme1.green79} |
|
|
|
|
strokeLinecap="round" |
|
|
|
|
strokeLinejoin="round" |
|
|
|
|
strokeWidth={1.5} |
|
|
|
@ -250,12 +250,12 @@ const BottomTabNavigator = ({}) => { |
|
|
|
|
/> |
|
|
|
|
<Tab.Screen |
|
|
|
|
name="ShoppingCartTab" |
|
|
|
|
component={CARTStackScreen} |
|
|
|
|
children={() => <CARTStackScreen theme={theme} />} |
|
|
|
|
options={{ |
|
|
|
|
// tabBarBadge: count,
|
|
|
|
|
// tabBarBadgeStyle: {
|
|
|
|
|
// color: "white",
|
|
|
|
|
// backgroundColor: Colors.theme1['light'].green79,
|
|
|
|
|
// backgroundColor: Colors.theme1.['light'].green79,
|
|
|
|
|
// fontSize: fontSize.sm,
|
|
|
|
|
// },
|
|
|
|
|
title: "سبد خرید", |
|
|
|
@ -267,7 +267,7 @@ const BottomTabNavigator = ({}) => { |
|
|
|
|
height={31.017} |
|
|
|
|
> |
|
|
|
|
<G |
|
|
|
|
fill={Colors.theme1["light"].green79} |
|
|
|
|
fill={Colors.theme1.green79} |
|
|
|
|
stroke={"white"} |
|
|
|
|
strokeLinecap="round" |
|
|
|
|
strokeLinejoin="round" |
|
|
|
@ -289,7 +289,7 @@ const BottomTabNavigator = ({}) => { |
|
|
|
|
> |
|
|
|
|
<G |
|
|
|
|
fill="none" |
|
|
|
|
stroke={Colors.theme1["light"].green79} |
|
|
|
|
stroke={Colors.theme1.green79} |
|
|
|
|
strokeLinecap="round" |
|
|
|
|
strokeLinejoin="round" |
|
|
|
|
strokeWidth={1.5} |
|
|
|
@ -308,7 +308,7 @@ const BottomTabNavigator = ({}) => { |
|
|
|
|
|
|
|
|
|
<Tab.Screen |
|
|
|
|
name="ProfileTab" |
|
|
|
|
component={PROFILEStackScreen} |
|
|
|
|
children={() => <PROFILEStackScreen theme={theme} />} |
|
|
|
|
options={{ |
|
|
|
|
title: "پروفایل", |
|
|
|
|
tabBarIcon: ({ focused, color }) => |
|
|
|
@ -318,7 +318,7 @@ const BottomTabNavigator = ({}) => { |
|
|
|
|
width={31.192} |
|
|
|
|
height={31.192} |
|
|
|
|
> |
|
|
|
|
<G fill={Colors.theme1["light"].green79}> |
|
|
|
|
<G fill={Colors.theme1.green79}> |
|
|
|
|
<Path d="M15.803 14.127a2.363 2.363 0 0 0-.429 0 5.777 5.777 0 1 1 .429 0Z" /> |
|
|
|
|
<Path |
|
|
|
|
data-name="Vector" |
|
|
|
@ -334,7 +334,7 @@ const BottomTabNavigator = ({}) => { |
|
|
|
|
> |
|
|
|
|
<G |
|
|
|
|
fill="none" |
|
|
|
|
stroke={Colors.theme1["light"].green79} |
|
|
|
|
stroke={Colors.theme1.green79} |
|
|
|
|
strokeLinecap="round" |
|
|
|
|
strokeLinejoin="round" |
|
|
|
|
strokeWidth={1.5} |
|
|
|
@ -357,12 +357,15 @@ const BottomTabNavigator = ({}) => { |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
const HomeStack = createNativeStackNavigator(); |
|
|
|
|
const HomeStackScreen = () => { |
|
|
|
|
const HomeStackScreen = ({ theme }) => { |
|
|
|
|
return ( |
|
|
|
|
<HomeStack.Navigator |
|
|
|
|
screenOptions={{ |
|
|
|
|
headerShown: false, |
|
|
|
|
contentStyle: { backgroundColor: Colors.theme1["light"].white }, |
|
|
|
|
contentStyle: { |
|
|
|
|
backgroundColor: |
|
|
|
|
theme === "light" ? Colors.theme1.white : Colors.theme1.dark, |
|
|
|
|
}, |
|
|
|
|
}} |
|
|
|
|
initialRouteName="Home" |
|
|
|
|
> |
|
|
|
@ -382,12 +385,15 @@ const HomeStackScreen = () => { |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
const ProductsStack = createNativeStackNavigator(); |
|
|
|
|
const ProductsStackScreen = () => { |
|
|
|
|
const ProductsStackScreen = ({ theme }) => { |
|
|
|
|
return ( |
|
|
|
|
<ProductsStack.Navigator |
|
|
|
|
screenOptions={{ |
|
|
|
|
headerShown: false, |
|
|
|
|
contentStyle: { backgroundColor: Colors.theme1["light"].white }, |
|
|
|
|
contentStyle: { |
|
|
|
|
backgroundColor: |
|
|
|
|
theme === "light" ? Colors.theme1.white : Colors.theme1.dark, |
|
|
|
|
}, |
|
|
|
|
}} |
|
|
|
|
initialRouteName="Products" |
|
|
|
|
> |
|
|
|
@ -401,12 +407,15 @@ const ProductsStackScreen = () => { |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
const VODStack = createNativeStackNavigator(); |
|
|
|
|
const VODStackScreen = () => { |
|
|
|
|
const VODStackScreen = ({ theme }) => { |
|
|
|
|
return ( |
|
|
|
|
<VODStack.Navigator |
|
|
|
|
screenOptions={{ |
|
|
|
|
headerShown: false, |
|
|
|
|
contentStyle: { backgroundColor: Colors.theme1["light"].white }, |
|
|
|
|
contentStyle: { |
|
|
|
|
backgroundColor: |
|
|
|
|
theme === "light" ? Colors.theme1.white : Colors.theme1.dark, |
|
|
|
|
}, |
|
|
|
|
}} |
|
|
|
|
> |
|
|
|
|
<VODStack.Screen name="VOD" component={Videos} /> |
|
|
|
@ -418,12 +427,15 @@ const VODStackScreen = () => { |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
const CARTStack = createNativeStackNavigator(); |
|
|
|
|
const CARTStackScreen = () => { |
|
|
|
|
const CARTStackScreen = ({ theme }) => { |
|
|
|
|
return ( |
|
|
|
|
<CARTStack.Navigator |
|
|
|
|
screenOptions={{ |
|
|
|
|
headerShown: false, |
|
|
|
|
contentStyle: { backgroundColor: Colors.theme1["light"].white }, |
|
|
|
|
contentStyle: { |
|
|
|
|
backgroundColor: |
|
|
|
|
theme === "light" ? Colors.theme1.white : Colors.theme1.dark, |
|
|
|
|
}, |
|
|
|
|
}} |
|
|
|
|
> |
|
|
|
|
<CARTStack.Screen name="ShoppingCart" component={ShoppingCart} /> |
|
|
|
@ -434,12 +446,15 @@ const CARTStackScreen = () => { |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
const PROFILEStack = createNativeStackNavigator(); |
|
|
|
|
const PROFILEStackScreen = () => { |
|
|
|
|
const PROFILEStackScreen = ({ theme }) => { |
|
|
|
|
return ( |
|
|
|
|
<PROFILEStack.Navigator |
|
|
|
|
screenOptions={{ |
|
|
|
|
headerShown: false, |
|
|
|
|
contentStyle: { backgroundColor: Colors.theme1["light"].white }, |
|
|
|
|
contentStyle: { |
|
|
|
|
backgroundColor: |
|
|
|
|
theme === "light" ? Colors.theme1.white : Colors.theme1.dark, |
|
|
|
|
}, |
|
|
|
|
}} |
|
|
|
|
> |
|
|
|
|
<PROFILEStack.Screen name="Profile" component={Profile} /> |
|
|
|
@ -456,7 +471,14 @@ const PROFILEStackScreen = () => { |
|
|
|
|
const prefix = Linking.createURL("/"); |
|
|
|
|
|
|
|
|
|
const Stack = createNativeStackNavigator(); |
|
|
|
|
const Navigation = ({ getStatus, isLogin, userProducts, ltr, setLTR }) => { |
|
|
|
|
const Navigation = ({ |
|
|
|
|
getStatus, |
|
|
|
|
isLogin, |
|
|
|
|
userProducts, |
|
|
|
|
ltr, |
|
|
|
|
setLTR, |
|
|
|
|
theme, |
|
|
|
|
}) => { |
|
|
|
|
const linking = { |
|
|
|
|
prefixes: [prefix], |
|
|
|
|
}; |
|
|
|
@ -480,14 +502,20 @@ const Navigation = ({ getStatus, isLogin, userProducts, ltr, setLTR }) => { |
|
|
|
|
// initialRouteName="Root"
|
|
|
|
|
screenOptions={{ |
|
|
|
|
headerShown: false, |
|
|
|
|
contentStyle: { backgroundColor: Colors.theme1["light"].white }, |
|
|
|
|
contentStyle: { |
|
|
|
|
backgroundColor: |
|
|
|
|
theme === "light" ? Colors.theme1.white : Colors.theme1.dark, |
|
|
|
|
}, |
|
|
|
|
}} |
|
|
|
|
> |
|
|
|
|
<Stack.Screen name="Splash" component={Splash} /> |
|
|
|
|
<Stack.Screen name="Login" component={Login} /> |
|
|
|
|
<Stack.Screen name="Rules" component={Rules} /> |
|
|
|
|
<Stack.Screen name="Otp" component={Otp} /> |
|
|
|
|
<Stack.Screen name="Root" component={BottomTabNavigator} /> |
|
|
|
|
<Stack.Screen |
|
|
|
|
name="Root" |
|
|
|
|
children={() => <BottomTabNavigator theme={theme} />} |
|
|
|
|
/> |
|
|
|
|
<Stack.Screen name="QR" component={QR} /> |
|
|
|
|
<Stack.Screen name="Orders" component={OrdersFollowUp} /> |
|
|
|
|
<Stack.Screen name="Order" component={OrderDetails} /> |
|
|
|
@ -516,4 +544,5 @@ const mapDispatchToProps = { |
|
|
|
|
getStatus: user.getStatus, |
|
|
|
|
setLTR: publicApi.setLTR, |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
export default connect(mapStateToProps, mapDispatchToProps)(Navigation); |
|
|
|
|