diff --git a/navigation/index.js b/navigation/index.js
index bfe77d6..0621251 100644
--- a/navigation/index.js
+++ b/navigation/index.js
@@ -4,6 +4,7 @@ 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";
@@ -47,11 +48,7 @@ const BottomTabNavigator = () => {
component={AuthStackScreen}
options={{
tabBarIcon: ({ focused, color }) => (
-
+
),
}}
/>
@@ -97,10 +94,14 @@ const BottomTabNavigator = () => {
const HomeStack = createNativeStackNavigator();
const HomeStackScreen = () => {
return (
-
+
+
);
};
@@ -108,10 +109,14 @@ const HomeStackScreen = () => {
const ProductsStack = createNativeStackNavigator();
const ProductsStackScreen = () => {
return (
-
+
+
);
};
@@ -119,7 +124,10 @@ const ProductsStackScreen = () => {
const AuthStack = createNativeStackNavigator();
const AuthStackScreen = () => {
return (
-
+
@@ -127,15 +135,30 @@ const AuthStackScreen = () => {
);
};
-const Stack = createNativeStackNavigator();
+const OrderStack = createNativeStackNavigator();
+const OrderStackScreen = () => {
+ return(
+
+
+
+
+ );
+}
-const Navigation = () => {
+const Stack = createNativeStackNavigator();
+const Navigation = ({ profile }) => {
return (
+
+
+
diff --git a/src/components/Drawer.js b/src/components/Drawer.js
new file mode 100644
index 0000000..4252b78
--- /dev/null
+++ b/src/components/Drawer.js
@@ -0,0 +1,107 @@
+import React, { useState } from "react";
+import {
+ View,
+ Platform,
+ UIManager,
+ Dimensions,
+ Pressable,
+ Text,
+ TouchableOpacity,
+} from "react-native";
+import { useNavigation } from "@react-navigation/native";
+import { Entypo, FontAwesome, Ionicons, AntDesign } from "@expo/vector-icons";
+import tw from "tailwind-rn";
+
+const width = Dimensions.get("window").width;
+const height = Dimensions.get("window").height;
+
+if (
+ Platform.OS === "android" &&
+ UIManager.setLayoutAnimationEnabledExperimental
+) {
+ UIManager.setLayoutAnimationEnabledExperimental(true);
+}
+
+const Drawer = ({ position, setBoxPosition }) => {
+ const [routes, setRoutes] = useState([
+ {
+ name: "صفحه اصلی",
+ route: "Home",
+ icon: ,
+ toast: "",
+ message: "",
+ },
+ {
+ name: "فعال سازی",
+ route: "Activation",
+ icon: ,
+ toast: "",
+ message: "",
+ },
+ {
+ name: "پروفایل",
+ route: "Profile",
+ icon: ,
+ toast: "",
+ message: "",
+ },
+ {
+ name: "واقعیت افزوده",
+ route: "AR",
+ icon: ,
+ toast: "",
+ message: "",
+ },
+ {
+ name: "سفارشات",
+ route: "Orders",
+ icon: ,
+ toast: "",
+ message: "",
+ }
+ ]);
+ const navigation = useNavigation();
+ const Route = ({ route }) => {
+ return (
+ navigation.navigate(route.route)}
+ >
+ {route.icon}
+
+ {route.name}
+
+
+ );
+ };
+ return (
+ console.log(e.currentTarget._nativeTag)}
+ style={[
+ tw(`absolute z-50 top-0 flex flex-row justify-end `),
+ {
+ left: position,
+ width: width,
+ height: height,
+ },
+ ]}
+ >
+ setBoxPosition()}
+ style={[tw(`w-1/5 h-full ${position === "0%" ? "" : ""}`)]}
+ >
+
+ {routes.map((route, index) => (
+
+ ))}
+
+
+ );
+};
+
+export default Drawer;
diff --git a/src/components/Navbar.js b/src/components/Navbar.js
index f407809..b042b41 100644
--- a/src/components/Navbar.js
+++ b/src/components/Navbar.js
@@ -1,4 +1,4 @@
-import React, { useCallback } from "react";
+import React, { useCallback, useState } from "react";
import {
Image,
StyleSheet,
@@ -6,7 +6,9 @@ import {
Pressable,
} from "react-native";
import { useNavigation } from "@react-navigation/native";
+import { Ionicons } from "@expo/vector-icons";
import tw from "tailwind-rn";
+import Drawer from "./Drawer";
//colors
import Color from "../constants/Colors";
@@ -17,8 +19,9 @@ import logoIcon from "../assets/icons/logo.png";
import qrLightIcon from "../assets/icons/qr-light.png";
import arLightIcon from "../assets/icons/ar-light.png";
-const Navbar = ({ notification }) => {
+const Navbar = ({ notification, back, setBoxPosition }) => {
const navigation = useNavigation();
+
const Button = useCallback(({ icon, route }) => {
return (
{
return (
-
+ setBoxPosition()}>
{
)}
>
)}
-
+
navigation.navigate("خانه")}
+ onPress={() => navigation.navigate("Home")}
style={tw("absolute right-1/2 top-1/2")}
>
{
]}
/>
-
+
+ {back && (
+ navigation.goBack()}
+ />
+ )}
diff --git a/src/screens/Home/components/Scroll.js b/src/screens/Home/components/Scroll.js
index 289f580..753d938 100644
--- a/src/screens/Home/components/Scroll.js
+++ b/src/screens/Home/components/Scroll.js
@@ -1,43 +1,60 @@
-import React from 'react';
+import React from "react";
import {
View,
Image,
Dimensions,
TouchableOpacity,
FlatList,
-} from 'react-native';
-import Header from '../components/Header';
-import tw from 'tailwind-rn';
+} from "react-native";
+import { useNavigation } from "@react-navigation/native";
+import Header from "../components/Header";
+import tw from "tailwind-rn";
-import {connect} from 'react-redux';
+import { connect } from "react-redux";
-import olum1Image from '../assets/olum1.png';
+import olum1Image from "../assets/olum1.png";
-const width = Dimensions.get('window').width;
-const height = Dimensions.get('window').height;
+const width = Dimensions.get("window").width;
+const height = Dimensions.get("window").height;
-function Scroll({products}) {
+function Scroll({ products }) {
return (
-
-
+
+
(
-
- )}
+ style={[tw("mt-3 pb-2")]}
+ data={[{}]}
+ renderItem={({}) => }
+ keyExtractor={(item) => item.id}
/>
);
}
-const Product = ({product, position}) => {
+const Box = ({ products }) => {
+ return (
+
+ {products.map((item, index) => (
+
+ ))}
+
+ );
+};
+
+const Product = ({ product, position }) => {
+ const navigation = useNavigation();
return (
navigation.navigate('Product')}
style={[
- tw('rounded-md mx-1 overflow-hidden rounded-md'),
+ tw("rounded-md mx-1 overflow-hidden rounded-md"),
{
width: position === 0 ? 163 : 79,
height: position === 0 ? 245 : 118,
@@ -45,12 +62,12 @@ const Product = ({product, position}) => {
]}
// onPress={() => navigation.navigate('Product')}
>
-
+
);
};
-const mapStateToProps = state => ({
+const mapStateToProps = (state) => ({
// features: state.publicApi.home?.features,
});
export default connect(mapStateToProps, {})(Scroll);
@@ -59,27 +76,35 @@ Scroll.defaultProps = {
products: [
{
imageUrl: olum1Image,
+ id: 0,
},
{
imageUrl: olum1Image,
+ id: 1,
},
{
imageUrl: olum1Image,
+ id: 2,
},
{
imageUrl: olum1Image,
+ id: 3,
},
{
imageUrl: olum1Image,
+ id: 4,
},
{
imageUrl: olum1Image,
+ id: 5,
},
{
imageUrl: olum1Image,
+ id: 6,
},
{
imageUrl: olum1Image,
+ id: 7,
},
],
};
diff --git a/src/screens/Home/components/Videos.js b/src/screens/Home/components/Videos.js
index c4c9765..1b45572 100644
--- a/src/screens/Home/components/Videos.js
+++ b/src/screens/Home/components/Videos.js
@@ -70,7 +70,7 @@ const Video = ({book, grades}) => {
tw('mt-1 pr-1'),
{color: Color.theme1.light.blue5, fontFamily : 'light', fontSize : width / 40},
]}>{`پایه ${'اول'}`}
-
+
);
};
diff --git a/src/screens/Home/index.js b/src/screens/Home/index.js
index 0764b10..4a40873 100644
--- a/src/screens/Home/index.js
+++ b/src/screens/Home/index.js
@@ -1,4 +1,4 @@
-import React from "react";
+import React, { useState } from "react";
import { useTranslation } from "react-i18next";
import {
View,
@@ -8,6 +8,7 @@ import {
SafeAreaView,
Platform,
StatusBar,
+ LayoutAnimation,
} from "react-native";
import Navbar from "../../components/Navbar";
import tw from "tailwind-rn";
@@ -15,18 +16,28 @@ import Scroll from "./components/Scroll";
import MyBooks from "./components/MyBooks";
import Videos from "./components/Videos";
import Blogs from "./components/Blogs";
+import Drawer from "../../components/Drawer";
// import { SafeAreaView } from 'react-native-safe-area-context';
// Within your render function
function Home(props) {
+ const [position, setPosition] = useState("100%");
+
+ const setBoxPosition = () => {
+ LayoutAnimation.configureNext(LayoutAnimation.Presets.easeInEaseOut);
+ setPosition(position === "100%" ? "0%" : "100%");
+ };
+
return (
-
+
+
{
setLoading(true);
- // if (!checkPhoneNumber()) {
- // setLoading(false);
- // return asyncAwesomeAlert("خطا", "شماره وارد شده اشتباه است", {
- // showCancelButton: false,
- // });
- // }
- // let res = await services.getSmsCode({
- // cellphone: digitToEn(phone),
- // });
- // if (res.ok) {
- // setLoading(false);
+ if (!checkPhoneNumber()) {
+ setLoading(false);
+ return asyncAwesomeAlert("خطا", "شماره وارد شده اشتباه است", {
+ showCancelButton: false,
+ });
+ }
+ let res = await services.getSmsCode({
+ cellphone: digitToEn(phone),
+ });
+ if (res.ok) {
+ setLoading(false);
props.navigation.navigate("Otp", { phone: digitToEn(phone) });
- // }
+ }
setLoading(false);
};
diff --git a/src/screens/OrderDetails/components/Book.js b/src/screens/OrderDetails/components/Book.js
index 2d8f2bf..55643a3 100644
--- a/src/screens/OrderDetails/components/Book.js
+++ b/src/screens/OrderDetails/components/Book.js
@@ -18,28 +18,27 @@ export default function Book({book}) {
source={book}
style={[
tw.style('rounded-md'),
- {width: width / 5.5, height: height / 8},
+ {width: 60, height: 90},
]}
/>
علوم اجتماعی
پایه دوم
نسخه دیجیتال
@@ -48,19 +47,20 @@ export default function Book({book}) {
1
126.000 تومان
diff --git a/src/screens/OrderDetails/index.js b/src/screens/OrderDetails/index.js
index 80d39e1..88751e4 100644
--- a/src/screens/OrderDetails/index.js
+++ b/src/screens/OrderDetails/index.js
@@ -1,288 +1,383 @@
-import React from 'react';
-import {View, Text, Dimensions, StyleSheet, ScrollView} from 'react-native';
-import Book from './components/Book';
-import {connect} from 'react-redux';
-import tw from 'tailwind-react-native-classnames';
-import b1Image from './assets/b1.png';
-import _ from 'lodash';
+import React, { useState } from "react";
+import {
+ View,
+ Text,
+ Dimensions,
+ StyleSheet,
+ ScrollView,
+ SafeAreaView,
+ Platform,
+ StatusBar,
+ LayoutAnimation,
+} from "react-native";
+import Navbar from "../../components/Navbar";
+import Drawer from "../../components/Drawer";
+import Book from "./components/Book";
+import { connect } from "react-redux";
+import tw from "tailwind-react-native-classnames";
+import b1Image from "./assets/b1.png";
+import _ from "lodash";
-const width = Dimensions.get('window').width;
-const height = Dimensions.get('window').height;
+const width = Dimensions.get("window").width;
+const height = Dimensions.get("window").height;
const colors = {
- 1: '#FFF700',
- 4: '#FF0000',
- 3: '#4CFF00',
- 2: '#196EC0',
+ 1: "#FFF700",
+ 4: "#FF0000",
+ 3: "#4CFF00",
+ 2: "#196EC0",
};
const status = {
- 1: 'در حال پردازش',
- 4: 'درخواست رد شد',
- 3: 'تکمیل شد',
- 2: 'ارسال شده',
+ 1: "در حال پردازش",
+ 4: "درخواست رد شد",
+ 3: "تکمیل شد",
+ 2: "ارسال شده",
};
-function OrderDetails({order}) {
+function OrderDetails({ order }) {
+ const [position, setPosition] = useState("100%");
+
+ const setBoxPosition = () => {
+ LayoutAnimation.configureNext(LayoutAnimation.Presets.easeInEaseOut);
+ setPosition(position === "100%" ? "0%" : "100%");
+ };
return (
-
-
-
+
+
+
+
- {_.join(['شماره سفارش:', order.number], ' ')}
-
-
+ tw.style(
+ "flex flex-row-reverse w-full justify-between items-center p-3"
+ ),
+ { backgroundColor: "#EEF7FF" },
+ ]}
+ >
- {status[order.status]}
+ { fontSize: width / 36, color: "#20297B", fontFamily: "regular" },
+ ]}
+ >
+ {_.join(["شماره سفارش:", order.number], " ")}
-
+
+
+ {status[order.status]}
+
+
+
-
-
-
- آدرس تحویل:
-
-
- {order.address}
-
-
-
-
+ tw.style("w-full flex flex-row-reverse py-4"),
+ { borderBottomWidth: 1, borderColor: "#86A0B933" },
+ ]}
+ >
- مشخصات تحویل گیرنده:
+ { fontSize: width / 36, color: "#05335F", fontFamily: "bold" },
+ ]}
+ >
+ آدرس تحویل:
- {order.name}
+ tw.style("flex-1 font-light text-right mr-2"),
+ {
+ fontSize: width / 40,
+ lineHeight: 17,
+ color: "#05335F",
+ fontFamily: "light",
+ },
+ ]}
+ >
+ {order.address}
-
-
- شماره موبایل:
-
-
- {order.cellphone}
-
-
-
-
-
- {_.join(['کد تحویل', order.receiveCode], ' ')}
-
-
- این کد را پس از دریافت کالا، به مامور ارسال دانوین اعلام فرمایید
-
-
-
- {order.items.map((item, index) => (
-
- ))}
-
-
-
-
- مبلغ سبد خرید:
-
-
- {_.join([order.shoppingCardPrice, 'تومان'], ' ')}
-
+ tw.style("w-full flex flex-row-reverse justify-between py-4"),
+ { borderBottomWidth: 1, borderColor: "#86A0B933" },
+ ]}
+ >
+
+
+ مشخصات تحویل گیرنده:
+
+
+ {order.name}
+
+
+
+
+ شماره موبایل:
+
+
+ {order.cellphone}
+
+
-
+
- تخفیف:
+ { fontSize: width / 36, color: "#05335F", fontFamily: "bold" },
+ ]}
+ >
+ {_.join(["کد تحویل", order.receiveCode], " ")}
- {_.join([order.discountPrice, 'تومان'], ' ')}
+ tw.style("font-light text-right mt-1"),
+ { fontSize: width / 40, color: "#05335F", fontFamily: "regular" },
+ ]}
+ >
+ این کد را پس از دریافت کالا، به مامور ارسال دانوین اعلام فرمایید
-
-
-
-
- هزینه ارسال کالا:
-
-
- {_.join([order.sendPrice, 'تومان'], ' ')}
-
+
+ {order.items.map((item, index) => (
+
+ ))}
-
-
- جمع هزینه پرداختی:
-
-
- {_.join([order.totalPrice, 'تومان'], ' ')}
-
+
+
+
+ مبلغ سبد خرید:
+
+
+ {_.join([order.shoppingCardPrice, "تومان"], " ")}
+
+
+
+
+ تخفیف:
+
+
+ {_.join([order.discountPrice, "تومان"], " ")}
+
+
-
-
-
-
- نحوه پرداخت:
-
-
- {order.payMethod}
-
+
+
+
+ هزینه ارسال کالا:
+
+
+ {_.join([order.sendPrice, "تومان"], " ")}
+
+
+
+
+ جمع هزینه پرداختی:
+
+
+ {_.join([order.totalPrice, "تومان"], " ")}
+
+
-
-
- شماره تراکنش:
-
-
- {order.transactionNumber}
-
+
+
+
+ نحوه پرداخت:
+
+
+ {order.payMethod}
+
+
+
+
+ شماره تراکنش:
+
+
+ {order.transactionNumber}
+
+
-
-
-
-
- تاریخ تحویل:
-
-
- {order.date}
-
+
+
+
+ تاریخ تحویل:
+
+
+ {order.date}
+
+
-
-
+
+
);
}
const styles = StyleSheet.create({
contentContainerStyle: {
- paddingBottom: 50,
- alignItems: 'flex-end',
+ paddingBottom: 100,
+ alignItems: "flex-end",
},
container: {
width: width,
- backgroundColor: 'white',
- flexDirection: 'column',
+ backgroundColor: "white",
+ flexDirection: "column",
paddingVertical: 5,
paddingHorizontal: 10,
},
@@ -292,21 +387,21 @@ export default OrderDetails;
OrderDetails.defaultProps = {
order: {
- number: '535353523653',
- receiveCode: '300031',
+ number: "535353523653",
+ receiveCode: "300031",
status: 2,
items: [b1Image, b1Image],
- date: '1400/1/11',
- cost: '1.240.000',
+ date: "1400/1/11",
+ cost: "1.240.000",
address:
- 'تهران خیابان انقلاب حدفاصل ابوریحان و فلسطین بن بست سروش پلاک 2 واحد 12 شرقی',
- name: 'هومن عابدی',
- cellphone: '09121234568',
- shoppingCardPrice: '981.000',
- discountPrice: '12.000',
- sendPrice: '18.000',
- totalPrice: '18.000',
- payMethod: 'حضوری',
- transactionNumber: ' BS3194DNB98312',
+ "تهران خیابان انقلاب حدفاصل ابوریحان و فلسطین بن بست سروش پلاک 2 واحد 12 شرقی",
+ name: "هومن عابدی",
+ cellphone: "09121234568",
+ shoppingCardPrice: "981.000",
+ discountPrice: "12.000",
+ sendPrice: "18.000",
+ totalPrice: "18.000",
+ payMethod: "حضوری",
+ transactionNumber: " BS3194DNB98312",
},
};
diff --git a/src/screens/OrdersFollowUp/components/Order.js b/src/screens/OrdersFollowUp/components/Order.js
index 6fae2e0..fbcb232 100644
--- a/src/screens/OrdersFollowUp/components/Order.js
+++ b/src/screens/OrdersFollowUp/components/Order.js
@@ -6,10 +6,12 @@ import {
StyleSheet,
Image,
Pressable,
+ TouchableOpacity
} from 'react-native';
+import { useNavigation } from '@react-navigation/native';
import tw from 'tailwind-react-native-classnames';
import leftArrowIcon from '../assets/leftArrow.png';
-import plusIcon from '../assets/plus.png';
+import { AntDesign } from '@expo/vector-icons';
import _ from 'lodash';
const width = Dimensions.get('window').width;
@@ -30,6 +32,7 @@ const status = {
};
function Order({order}) {
+ const navigation = useNavigation();
return (
{_.join(['شماره سفارش:', order.number], ' ')}
@@ -54,7 +57,7 @@ function Order({order}) {
{status[order.status]}
@@ -75,7 +78,7 @@ function Order({order}) {
source={item}
style={[
tw.style('rounded-md ml-1.5'),
- {width: width / 5.8, height: height / 8},
+ {width: 60, height: 90},
]}
/>
))
@@ -86,7 +89,7 @@ function Order({order}) {
source={item}
style={[
tw.style('rounded-md ml-1.5'),
- {width: width / 5.8, height: height / 8},
+ {width: 60, height: 90},
]}
/>
))}
@@ -97,8 +100,8 @@ function Order({order}) {
'flex flex-row-reverse items-center justify-center relative rounded-md overflow-hidden',
),
{
- width: width / 5.8,
- height: height / 8,
+ width: 60,
+ height: 90,
backgroundColor: '#EBEBEB',
},
]}>
@@ -106,16 +109,17 @@ function Order({order}) {
source={order.items[2]}
style={[tw.style('absolute left-0 top-0 h-full w-full z-10')]}
/> */}
-
+
)}
-
+
{_.join(['جمع فاکتور:', order.cost], ' ')}
- navigation.navigate('Order')}
style={[
tw.style('rounded-md flex flex-row-reverse justify-center px-5 py-3'),
{borderWidth: 1, borderColor: '#1999C0'},
]}>
-
+
جزئیات سفارش
-
+
{_.join(['تاریخ سفارش:', order.date], ' ')}
diff --git a/src/screens/OrdersFollowUp/index.js b/src/screens/OrdersFollowUp/index.js
index 3503c4b..e68e1d9 100644
--- a/src/screens/OrdersFollowUp/index.js
+++ b/src/screens/OrdersFollowUp/index.js
@@ -1,34 +1,62 @@
-import React from 'react';
-import {View, Text, Dimensions, StyleSheet, ScrollView} from 'react-native';
-import Order from './components/Order';
-import {connect} from 'react-redux';
-import b1Image from './assets/b1.png';
-import b2Image from './assets/b2.png';
-import b3Image from './assets/b3.png';
+import React, {useState} from "react";
+import {
+ View,
+ Text,
+ Dimensions,
+ StyleSheet,
+ ScrollView,
+ SafeAreaView,
+ StatusBar,
+ Platform,
+ LayoutAnimation,
+} from "react-native";
+import Order from "./components/Order";
+import Navbar from "../../components/Navbar";
+import Drawer from "../../components/Drawer";
+import { connect } from "react-redux";
+import b1Image from "./assets/b1.png";
+import b2Image from "./assets/b2.png";
+import b3Image from "./assets/b3.png";
-const width = Dimensions.get('window').width;
+const width = Dimensions.get("window").width;
-function OrdersFollowUp({orders}) {
+function OrdersFollowUp({ orders }) {
+ const [position, setPosition] = useState("100%");
+
+ const setBoxPosition = () => {
+ LayoutAnimation.configureNext(LayoutAnimation.Presets.easeInEaseOut);
+ setPosition(position === "100%" ? "0%" : "100%");
+ };
return (
-
- {
- orders.map((order, index) => )
- }
-
+
+
+
+
+ {orders.map((order, index) => (
+
+ ))}
+
+
);
}
const styles = StyleSheet.create({
contentContainerStyle: {
- paddingBottom: 50,
- alignItems: 'flex-end',
+ paddingBottom: 100,
+ alignItems: "flex-end",
},
container: {
width: width,
- backgroundColor: 'white',
- flexDirection: 'column',
+ backgroundColor: "white",
+ flexDirection: "column",
paddingVertical: 5,
paddingHorizontal: 10,
},
@@ -39,28 +67,28 @@ export default OrdersFollowUp;
OrdersFollowUp.defaultProps = {
orders: [
{
- number: '535353523653',
- receiveCode: '300031',
+ number: "535353523653",
+ receiveCode: "300031",
status: 2,
items: [b1Image, b2Image, b3Image, b3Image],
- date: '1400/1/12',
- cost: '1.240.000',
+ date: "1400/1/12",
+ cost: "1.240.000",
},
{
- number: '535353523653',
- receiveCode: '300031',
+ number: "535353523653",
+ receiveCode: "300031",
status: 3,
items: [b1Image, b2Image, b3Image],
- date: '1400/1/12',
- cost: '1.240.000',
+ date: "1400/1/12",
+ cost: "1.240.000",
},
{
- number: '535353523653',
- receiveCode: '300031',
+ number: "535353523653",
+ receiveCode: "300031",
status: 4,
items: [b1Image, b2Image, b3Image],
- date: '1400/1/12',
- cost: '1.240.000',
+ date: "1400/1/12",
+ cost: "1.240.000",
},
],
};
diff --git a/src/screens/Otp/index.js b/src/screens/Otp/index.js
index f2f8ba7..3845097 100644
--- a/src/screens/Otp/index.js
+++ b/src/screens/Otp/index.js
@@ -15,7 +15,7 @@ import AsyncStorage from "@react-native-async-storage/async-storage";
import { connect } from "react-redux";
import Logo from "../Login/assets/logo.png";
import IranFlag from "../Login/components/IranFlag";
-// import { digitToEn, digitToPersian } from "../../utils";
+import { digitToEn, digitToPersian } from "../../utils";
import services from "./services";
import { buildAction } from "../../reducers/DefaultReducer";
import { PROFILE_RECORD } from "../../actions/actionTypes";
@@ -44,6 +44,12 @@ function Otp(props) {
const [time, setTime] = useState(60);
const [loading, setLoading] = useState(false);
+ // useEffect(() => {
+ // if (fourthCode) {
+ // submit();
+ // }
+ // }, [fourthCode]);
+
const checkValue = (value) => {
return faNums.includes(digitToPersian(value));
};
@@ -55,34 +61,34 @@ function Otp(props) {
switch (key) {
case "1":
setFirstCode(value);
- if(value !== ''){
+ if (value !== "") {
ref2.focus();
}
break;
case "2":
setSecondCode(value);
- if(value !== ''){
+ if (value !== "") {
ref3.focus();
- }else{
+ } else {
ref1.focus();
}
break;
case "3":
setThirdCode(value);
- if(value !== ''){
+ if (value !== "") {
ref4.focus();
- }else{
+ } else {
ref2.focus();
}
break;
case "4":
setFourthCode(value);
- if(value !== ''){
+ if (value !== "") {
// ref3.focus();
- }else{
+ } else {
ref3.focus();
}
- // submit();
+
break;
}
};
@@ -104,6 +110,12 @@ function Otp(props) {
applicationToken: "1",
userToken: "1",
});
+ console.log(
+ digitToEn(firstCode) +
+ digitToEn(secondCode) +
+ digitToEn(thirdCode) +
+ digitToEn(fourthCode)
+ );
if (res.ok) {
setLoading(false);
await AsyncStorage.setItem("accessToken", res.data.accessToken);
@@ -118,26 +130,26 @@ function Otp(props) {
);
props.navigation.reset({
index: 0,
- routes: [{ name: "Home" }],
+ routes: [{ name: "Root" }],
});
}
setLoading(false);
};
useEffect(() => {
- // let interval = setInterval(() => {
- // if (time > 0) {
- // setTime(timer - 1);
- // timer -= 1;
- // }
- // }, 1000);
- // let timeout = setTimeout(() => {
- // clearInterval(interval)
- // }, 60000)
- // return () => {
- // clearInterval(interval);
- // clearTimeout(timeout)
- // }
+ let interval = setInterval(() => {
+ if (time > 0) {
+ setTime(timer - 1);
+ timer -= 1;
+ }
+ }, 1000);
+ let timeout = setTimeout(() => {
+ clearInterval(interval);
+ }, 60000);
+ return () => {
+ clearInterval(interval);
+ clearTimeout(timeout);
+ };
}, []);
return (
@@ -261,7 +273,7 @@ function Otp(props) {
textAlign: "center",
fontFamily: "light",
fontSize: width / 36,
- color : '#196EC0'
+ color: "#196EC0",
}}
>
{"بازگشت به مرحله قبل و اصلاح شماره"}
diff --git a/src/screens/Product/index.js b/src/screens/Product/index.js
index b86cff9..c68f683 100644
--- a/src/screens/Product/index.js
+++ b/src/screens/Product/index.js
@@ -64,7 +64,7 @@ function Product({
paddingTop: Platform.OS === "android" ? StatusBar.currentHeight : 0,
}}
>
-
+
-
+
{
function Splash({ navigation, profile }) {
useEffect(() => {
setTimeout(() => {
- // !profile.accessToken ? navigation.reset({
- 1
+ !profile.accessToken
? navigation.reset({
index: 0,
routes: [{ name: "Login" }],
})
: navigation.reset({
index: 0,
- routes: [{ name: "Home" }],
+ routes: [{ name: "Root" }],
});
}, 2000);
}, [profile]);
diff --git a/src/services/api/oldindex.js b/src/services/api/oldindex.js
index d67b933..3c1cc4d 100644
--- a/src/services/api/oldindex.js
+++ b/src/services/api/oldindex.js
@@ -2,12 +2,12 @@
import apiConfig from './config';
import {
- AsyncStorage,
Alert,
AlertIOS,
Platform,
ToastAndroid,
} from 'react-native';
+import AsyncStorage from '@react-native-async-storage/async-storage';
import {toastMessage} from '../../utils/message';
import RNRestart from 'react-native-restart';