import { NavigationContainer, useNavigation } from "@react-navigation/native"; import React, { useEffect, useState } from "react"; import { useWindowDimensions, View } from "react-native"; import { createStackNavigator } from "@react-navigation/stack"; import Main from "../pages/home/main"; import SearchPage from "../pages/search/SearchPage"; import SearchHeader from "../components/search/Header"; import ProductSinglePage from "../pages/product/ProductSinglePage"; import CheckOut from "../pages/checkout/CheckOut"; import Paymentoption from "../pages/checkout/Paymentoption"; import ShippingOption from "../pages/checkout/ShippingOption"; import AddressSelection from "../pages/checkout/AddressSelection"; import AccountSettings from "../pages/profile/AccountSettings"; import HelpCenter from "../pages/profile/HelpCentre"; import ViewHistory from "../pages/profile/ViewHistory"; import MyFavorites from "../pages/profile/MyFavorites"; import MyWallet from "../pages/profile/MyWallet"; import MyPurchases from "../pages/profile/MyPurchases"; import ShopSinglePage from "../pages/shop/ShopSinglePage"; import CheckOutMultiple from "../pages/cart/CheckOutMultiple"; import PaymentoptionMulti from "../pages/cart/Paymentoption"; import ShippingOptionMulti from "../pages/cart/ShippingOption"; import AddressSelectionMulti from "../pages/cart/AddressSelection"; import Register from "../pages/auth/Register"; import Login from "../pages/auth/Login"; import AsyncStorage from "@react-native-async-storage/async-storage"; import Address from "../pages/address/Address"; import Addresses from "../pages/address/Addresses"; import ForgotPassword from "../pages/auth/ForgotPassword"; import AccountAndSecurity from "../pages/profile/AccountAndSecurity"; import { get_all_vendors } from "../services/api/controllers/vendor"; import { get_all_products } from "../services/api/controllers/product"; import AddressCheckout from "../pages/address/AddressCheckout"; const Stack = createStackNavigator(); const Route = () => { const { height, width } = useWindowDimensions(); const [cartList, setcartList] = useState([]); const [user, setuser] = useState(false); const [product, setproduct] = useState([]); const [products, setproducts] = useState([]); // const navigation = useNavigation(); useEffect(() => { /* ---------------Check for the user saved email--------------- */ AsyncStorage.getItem("AccessToken") .then((pass) => { pass === null ? setuser(false) : setuser(true); }) .catch((error) => { console.log(error + "weeewwww"); }); }, []); useEffect(() => { /* ---------------Check for the user saved email--------------- */ get_all_products() .then((result) => { if (result.error) { setError(result.error); } else { const filtered = result.data.filter( (item) => item.product_type !== "variation" && item.product_image !== "" && item.product_image !== null ); const filtered1 = result.data.filter( (item) => item.product_type === "variation" && item.product_image !== "" && item.product_image !== null ); setproduct(filtered); setproducts(filtered1); } }) .catch((error) => { setError(error.message); }) .finally(() => { // setprodIsLoading(false); // Set loading to false when done loading }); }, []); return ( {(props) => } {(props) => } {(props) => } {(props) =>
} {(props) => ( )} {(props) => ( )} {(props) => } {(props) => } {(props) => } {(props) => } {(props) => } {(props) => } {(props) => } {(props) => } {(props) => } {(props) => } {(props) => } {(props) =>
} {(props) => } {(props) => } {(props) => } {(props) => } {(props) => } {(props) => } {(props) => } ); }; export default Route;