You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
175 lines
5.2 KiB
175 lines
5.2 KiB
import React from "react"; |
|
import { NavigationContainer } from "@react-navigation/native"; |
|
import { createNativeStackNavigator } from "@react-navigation/native-stack"; |
|
import { createBottomTabNavigator } from "@react-navigation/bottom-tabs"; |
|
import { Entypo, FontAwesome, Ionicons } from "@expo/vector-icons"; |
|
import OrderDetails from "../src/screens/OrderDetails"; |
|
import OrdersFollowUp from "../src/screens/OrdersFollowUp"; |
|
import { Dimensions } from "react-native"; |
|
import Splash from "../src/screens/Splash"; |
|
import Home from "../src/screens/Home"; |
|
import Products from "../src/screens/Products"; |
|
import Login from "../src/screens/Login"; |
|
import Otp from "../src/screens/Otp"; |
|
import Product from "../src/screens/Product"; |
|
import QR from "../src/screens/QR/index"; |
|
import { connect } from "react-redux"; |
|
import i18n from "../src/services/i18n"; |
|
import { useTranslation } from "react-i18next"; |
|
import Profile from "../src/screens/Profile"; |
|
import Videos from "../src/screens/Videos"; |
|
import Exams from "../src/screens/Exams"; |
|
import ShoppingCart from "../src/screens/ShoppingCart"; |
|
|
|
const width = Dimensions.get("window").width; |
|
|
|
const Tab = createBottomTabNavigator(); |
|
const BottomTabNavigator = () => { |
|
return ( |
|
<Tab.Navigator |
|
initialRouteName="Home" |
|
screenOptions={{ |
|
headerShown: false, |
|
tabBarActiveTintColor: "#06BACE", |
|
tabBarInactiveTintColor: "grey", |
|
tabBarStyle: { |
|
backgroundColor: "#CCE6FF", |
|
}, |
|
tabBarLabelStyle: { |
|
fontSize: width / 39, |
|
fontFamily: "light", |
|
}, |
|
tabBarShowLabel: false, |
|
// tabBarLabel : 'reza' |
|
}} |
|
> |
|
<Tab.Screen |
|
name="Splash" |
|
component={AuthStackScreen} |
|
options={{ |
|
tabBarIcon: ({ focused, color }) => ( |
|
<FontAwesome name="user" size={focused ? 27 : 23} color={color} /> |
|
), |
|
}} |
|
/> |
|
<Tab.Screen |
|
name="ShoppingCart" |
|
component={ShoppingCart} |
|
options={{ |
|
tabBarIcon: ({ focused, color }) => ( |
|
<FontAwesome |
|
name="shopping-cart" |
|
size={focused ? 27 : 23} |
|
color={color} |
|
/> |
|
), |
|
}} |
|
/> |
|
<Tab.Screen |
|
name="Products" |
|
component={ProductsStackScreen} |
|
options={{ |
|
tabBarIcon: ({ focused, color }) => ( |
|
<Entypo name="shop" size={focused ? 27 : 23} color={color} /> |
|
), |
|
}} |
|
/> |
|
<Tab.Screen |
|
name="Home" |
|
component={HomeStackScreen} |
|
options={{ |
|
tabBarIcon: ({ focused, color }) => ( |
|
<Ionicons |
|
name="home-outline" |
|
size={focused ? 27 : 23} |
|
color={color} |
|
/> |
|
), |
|
}} |
|
/> |
|
</Tab.Navigator> |
|
); |
|
}; |
|
|
|
const HomeStack = createNativeStackNavigator(); |
|
const HomeStackScreen = () => { |
|
return ( |
|
<HomeStack.Navigator |
|
screenOptions={{ headerShown: false }} |
|
initialRouteName="Home" |
|
> |
|
<HomeStack.Screen name="Home" component={Home} /> |
|
<HomeStack.Screen name="QR" component={QR} /> |
|
<HomeStack.Screen name="Product" component={Product} /> |
|
<Stack.Screen name="Orders" component={OrderStackScreen} /> |
|
</HomeStack.Navigator> |
|
); |
|
}; |
|
|
|
const ProductsStack = createNativeStackNavigator(); |
|
const ProductsStackScreen = () => { |
|
return ( |
|
<ProductsStack.Navigator |
|
screenOptions={{ headerShown: false }} |
|
initialRouteName="Products" |
|
> |
|
<ProductsStack.Screen name="Products" component={Products} /> |
|
<ProductsStack.Screen name="QR" component={QR} /> |
|
<ProductsStack.Screen name="Product" component={Product} /> |
|
<Stack.Screen name="Orders" component={OrderStackScreen} /> |
|
</ProductsStack.Navigator> |
|
); |
|
}; |
|
|
|
const AuthStack = createNativeStackNavigator(); |
|
const AuthStackScreen = () => { |
|
return ( |
|
<AuthStack.Navigator |
|
screenOptions={{ headerShown: false }} |
|
initialRouteName="Splash" |
|
> |
|
<AuthStack.Screen name="Splash" component={Splash} /> |
|
<AuthStack.Screen name="Login" component={Login} /> |
|
<AuthStack.Screen name="Otp" component={Otp} /> |
|
</AuthStack.Navigator> |
|
); |
|
}; |
|
|
|
const OrderStack = createNativeStackNavigator(); |
|
const OrderStackScreen = () => { |
|
return( |
|
<OrderStack.Navigator |
|
screenOptions={{ headerShown: false }} |
|
initialRouteName="Orders" |
|
> |
|
<OrderStack.Screen name="Orders" component={OrdersFollowUp} /> |
|
<OrderStack.Screen name="Order" component={OrderDetails} /> |
|
</OrderStack.Navigator> |
|
); |
|
} |
|
|
|
const Stack = createNativeStackNavigator(); |
|
const Navigation = ({ profile }) => { |
|
return ( |
|
<NavigationContainer> |
|
<Stack.Navigator |
|
// initialRouteName="Root" |
|
screenOptions={{ headerShown: false }} |
|
> |
|
<Stack.Screen name="Splash" component={Splash} /> |
|
<Stack.Screen name="Login" component={Login} /> |
|
<Stack.Screen name="Otp" component={Otp} /> |
|
<Stack.Screen name="Root" component={BottomTabNavigator} /> |
|
</Stack.Navigator> |
|
</NavigationContainer> |
|
); |
|
}; |
|
|
|
const mapStateToProps = (state) => { |
|
return { |
|
profile: state.profile, |
|
config: state.config, |
|
}; |
|
}; |
|
|
|
export default connect(mapStateToProps)(Navigation);
|
|
|