|
|
|
import React, { useEffect } from "react";
|
|
|
|
import { Image } from "react-native";
|
|
|
|
import { NavigationContainer } from "@react-navigation/native";
|
|
|
|
import { createNativeStackNavigator } from "@react-navigation/native-stack";
|
|
|
|
import { createBottomTabNavigator } from "@react-navigation/bottom-tabs";
|
|
|
|
import {
|
|
|
|
Entypo,
|
|
|
|
FontAwesome,
|
|
|
|
Ionicons,
|
|
|
|
MaterialIcons,
|
|
|
|
} 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";
|
|
|
|
import QRContent from "../src/screens/QRContent";
|
|
|
|
import Faq from "../src/screens/Faq";
|
|
|
|
import Activation from "../src/screens/Activation";
|
|
|
|
import { connect } from "react-redux";
|
|
|
|
import Profile from "../src/screens/Profile";
|
|
|
|
import Videos from "../src/screens/Videos";
|
|
|
|
import Exams from "../src/screens/Exams";
|
|
|
|
import ShoppingCart from "../src/screens/ShoppingCart";
|
|
|
|
import Video from "../src/screens/Video";
|
|
|
|
import VideoDisplay from "../src/screens/VideoDisplay";
|
|
|
|
import Contact from "../src/screens/Contact";
|
|
|
|
import { user } from "../src/redux/actions";
|
|
|
|
|
|
|
|
//assets
|
|
|
|
import homeDeactiveIcon from "./assets/home-deactive.png";
|
|
|
|
import homeActiveIcon from "./assets/home-active.png";
|
|
|
|
import videoActiveIcon from "./assets/video-active.png";
|
|
|
|
import videoDeactiveIcon from "./assets/video-deactive.png";
|
|
|
|
|
|
|
|
const width = Dimensions.get("window").width;
|
|
|
|
|
|
|
|
const Tab = createBottomTabNavigator();
|
|
|
|
const BottomTabNavigator = () => {
|
|
|
|
return (
|
|
|
|
<Tab.Navigator
|
|
|
|
initialRouteName="HomeTab"
|
|
|
|
screenOptions={{
|
|
|
|
headerShown: false,
|
|
|
|
tabBarActiveTintColor: "#06BACE",
|
|
|
|
tabBarInactiveTintColor: "grey",
|
|
|
|
tabBarStyle: {
|
|
|
|
backgroundColor: "#CCE6FF",
|
|
|
|
zIndex: 10,
|
|
|
|
paddingVertical: 10,
|
|
|
|
height: 60,
|
|
|
|
},
|
|
|
|
tabBarLabelStyle: {
|
|
|
|
fontSize: width / 36,
|
|
|
|
fontFamily: "regular",
|
|
|
|
marginTop: 5,
|
|
|
|
},
|
|
|
|
tabBarShowLabel: true,
|
|
|
|
// tabBarLabel : 'reza'
|
|
|
|
}}
|
|
|
|
>
|
|
|
|
<Tab.Screen
|
|
|
|
name="ShoppingCartTab"
|
|
|
|
component={ShoppingCart}
|
|
|
|
options={{
|
|
|
|
tabBarIcon: ({ focused, color }) => (
|
|
|
|
<FontAwesome
|
|
|
|
name="shopping-cart"
|
|
|
|
size={focused ? 27 : 23}
|
|
|
|
color={color}
|
|
|
|
/>
|
|
|
|
),
|
|
|
|
}}
|
|
|
|
/>
|
|
|
|
<Tab.Screen
|
|
|
|
name="VODTab"
|
|
|
|
component={VODStackScreen}
|
|
|
|
options={{
|
|
|
|
tabBarIcon: ({ focused, color }) =>
|
|
|
|
focused ? (
|
|
|
|
<Image
|
|
|
|
source={videoActiveIcon}
|
|
|
|
style={{ width: 32, height: 28 }}
|
|
|
|
/>
|
|
|
|
) : (
|
|
|
|
<Image
|
|
|
|
source={videoDeactiveIcon}
|
|
|
|
style={{ width: 32, height: 28 }}
|
|
|
|
/>
|
|
|
|
),
|
|
|
|
}}
|
|
|
|
/>
|
|
|
|
<Tab.Screen
|
|
|
|
name="ProductsTab"
|
|
|
|
component={ProductsStackScreen}
|
|
|
|
options={{
|
|
|
|
tabBarIcon: ({ focused, color }) => (
|
|
|
|
<Entypo name="shop" size={focused ? 27 : 23} color={color} />
|
|
|
|
),
|
|
|
|
}}
|
|
|
|
/>
|
|
|
|
<Tab.Screen
|
|
|
|
name="HomeTab"
|
|
|
|
component={HomeStackScreen}
|
|
|
|
options={{
|
|
|
|
tabBarIcon: ({ focused, color }) =>
|
|
|
|
focused ? (
|
|
|
|
<Image
|
|
|
|
source={homeActiveIcon}
|
|
|
|
style={{ width: 33, height: 33 }}
|
|
|
|
/>
|
|
|
|
) : (
|
|
|
|
<Image
|
|
|
|
source={homeDeactiveIcon}
|
|
|
|
style={{ width: 33, height: 33 }}
|
|
|
|
/>
|
|
|
|
),
|
|
|
|
}}
|
|
|
|
/>
|
|
|
|
</Tab.Navigator>
|
|
|
|
);
|
|
|
|
};
|
|
|
|
|
|
|
|
const HomeStack = createNativeStackNavigator();
|
|
|
|
const HomeStackScreen = () => {
|
|
|
|
return (
|
|
|
|
<HomeStack.Navigator
|
|
|
|
screenOptions={{ headerShown: false }}
|
|
|
|
initialRouteName="Home"
|
|
|
|
>
|
|
|
|
<HomeStack.Screen name="Home" component={Home} />
|
|
|
|
<VODStack.Screen name="VOD" component={Videos} />
|
|
|
|
<ProductsStack.Screen name="Products" component={Products} />
|
|
|
|
<VODStack.Screen name="Video" component={Video} />
|
|
|
|
<HomeStack.Screen name="Product" component={Product} />
|
|
|
|
</HomeStack.Navigator>
|
|
|
|
);
|
|
|
|
};
|
|
|
|
|
|
|
|
const ProductsStack = createNativeStackNavigator();
|
|
|
|
const ProductsStackScreen = () => {
|
|
|
|
return (
|
|
|
|
<ProductsStack.Navigator screenOptions={{ headerShown: false }}>
|
|
|
|
<ProductsStack.Screen name="Products" component={Products} />
|
|
|
|
<ProductsStack.Screen name="Product" component={Product} />
|
|
|
|
</ProductsStack.Navigator>
|
|
|
|
);
|
|
|
|
};
|
|
|
|
|
|
|
|
const VODStack = createNativeStackNavigator();
|
|
|
|
const VODStackScreen = () => {
|
|
|
|
return (
|
|
|
|
<VODStack.Navigator screenOptions={{ headerShown: false }}>
|
|
|
|
<VODStack.Screen name="VOD" component={Videos} />
|
|
|
|
<VODStack.Screen name="Video" component={Video} />
|
|
|
|
<VODStack.Screen name="VideoDisplay" component={VideoDisplay} />
|
|
|
|
</VODStack.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 Stack = createNativeStackNavigator();
|
|
|
|
const Navigation = ({ getStatus, isLogin }) => {
|
|
|
|
useEffect(() => {
|
|
|
|
getStatus();
|
|
|
|
}, []);
|
|
|
|
return (
|
|
|
|
<NavigationContainer>
|
|
|
|
<Stack.Navigator
|
|
|
|
// initialRouteName="Root"
|
|
|
|
screenOptions={{ headerShown: false }}
|
|
|
|
>
|
|
|
|
<Stack.Screen name="Splash" component={Splash} />
|
|
|
|
<Stack.Screen name="QR" component={QR} />
|
|
|
|
<Stack.Screen name="Root" component={BottomTabNavigator} />
|
|
|
|
<Stack.Screen name="Login" component={Login} />
|
|
|
|
<Stack.Screen name="Otp" component={Otp} />
|
|
|
|
<Stack.Screen name="Orders" component={OrdersFollowUp} />
|
|
|
|
<Stack.Screen name="Order" component={OrderDetails} />
|
|
|
|
<Stack.Screen name="Faq" component={Faq} />
|
|
|
|
<Stack.Screen name="Activation" component={Activation} />
|
|
|
|
<Stack.Screen name="QRContent" component={QRContent} />
|
|
|
|
<Stack.Screen name="Contact" component={Contact} />
|
|
|
|
</Stack.Navigator>
|
|
|
|
</NavigationContainer>
|
|
|
|
);
|
|
|
|
};
|
|
|
|
|
|
|
|
const mapStateToProps = (state) => ({
|
|
|
|
isLogin: state.user.status,
|
|
|
|
});
|
|
|
|
const mapDispatchToProps = {
|
|
|
|
getStatus: user.getStatus,
|
|
|
|
};
|
|
|
|
export default connect(mapStateToProps, mapDispatchToProps)(Navigation);
|