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.

188 lines
5.5 KiB

import React, { useEffect } 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,
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 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";
3 years ago
import Video from "../src/screens/Video";
import VideoDisplay from "../src/screens/VideoDisplay";
import { user } from "../src/redux/actions";
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,
},
tabBarLabelStyle: {
fontSize: width / 39,
fontFamily: "light",
},
tabBarShowLabel: false,
// 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 }) => (
<MaterialIcons
name="ondemand-video"
size={focused ? 27 : 23}
color={color}
/>
),
}}
/>
<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 }) => (
<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="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} />
3 years ago
<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.Navigator>
</NavigationContainer>
);
};
const mapStateToProps = (state) => ({
isLogin: state.user.status,
});
const mapDispatchToProps = {
getStatus: user.getStatus,
};
export default connect(mapStateToProps, mapDispatchToProps)(Navigation);