From 25caef91166f693d69780adaf1aa39839928b884 Mon Sep 17 00:00:00 2001 From: Reza_ashrafi Date: Thu, 10 Mar 2022 15:41:36 +0330 Subject: [PATCH] reza linked to ar app --- app.json | 1 + navigation/index.js | 34 ++-- package.json | 2 + .../ProductSpecifications.js | 6 +- src/components/Search.js | 4 +- src/screens/AR/components/Book.js | 10 +- src/screens/AR/index.js | 3 +- src/screens/Home/index.js | 65 ++++---- src/screens/Login/index.js | 2 +- src/screens/Otp/index.js | 152 ++++++++++-------- src/screens/Product/components/Book.js | 4 +- src/screens/Product/components/Sample.js | 24 +++ src/screens/Products/components/Header.js | 1 + .../components/ProfileAddress/index.js | 4 +- yarn.lock | 46 +++++- 15 files changed, 235 insertions(+), 123 deletions(-) create mode 100644 src/screens/Product/components/Sample.js diff --git a/app.json b/app.json index 98db5e5..6354558 100644 --- a/app.json +++ b/app.json @@ -6,6 +6,7 @@ "orientation": "portrait", "userInterfaceStyle": "automatic", "icon": "", + "scheme": "danovin", "splash": { "image": "", "resizeMode": "contain", diff --git a/navigation/index.js b/navigation/index.js index f634017..3811c52 100644 --- a/navigation/index.js +++ b/navigation/index.js @@ -1,6 +1,8 @@ import React, { useEffect } from "react"; +import * as Linking from 'expo-linking'; import Svg, { G, Path } from "react-native-svg"; import { Appearance, Platform, Dimensions } from "react-native"; +import {Entypo} from '@expo/vector-icons'; import { NavigationContainer, DefaultTheme } from "@react-navigation/native"; import { createNativeStackNavigator } from "@react-navigation/native-stack"; import { createBottomTabNavigator } from "@react-navigation/bottom-tabs"; @@ -34,6 +36,7 @@ import ProfileBookmark from "../src/screens/Profile/components/ProfileBookmark"; import ProfileAddress from "../src/screens/Profile/components/ProfileAddress"; import Blogs from "../src/screens/Blogs"; import Blog from "../src/screens/Blog"; +import Sample from "../src/screens/Product/components/Sample"; //style import fontSize from "../src/constants/fontSize"; @@ -44,33 +47,34 @@ const colorScheme = Appearance.getColorScheme(); const Tab = createBottomTabNavigator(); const BottomTabNavigator = () => { - const [height, setHeight] = React.useState(88); + const [headerShown, setHeaderShown] = React.useState(true); React.useEffect(() => { setTimeout(() => { - setHeight(89); - }, 1000); + setHeaderShown(false); + }, 500); }, []); return ( { + @@ -378,6 +383,7 @@ const ProductsStackScreen = () => { > + ); }; @@ -427,13 +433,19 @@ const PROFILEStackScreen = () => { ); }; +const prefix = Linking.createURL('/') + const Stack = createNativeStackNavigator(); const Navigation = ({ getStatus, isLogin }) => { + const linking = { + prefixes: [prefix], + }; + useEffect(() => { getStatus(); }, []); return ( - + { }} > - - + + diff --git a/package.json b/package.json index 1d15f5e..d743719 100644 --- a/package.json +++ b/package.json @@ -27,6 +27,7 @@ "expo-device": "~4.1.0", "expo-font": "^10.0.4", "expo-linear-gradient": "~11.0.3", + "expo-linking": "~3.0.0", "expo-screen-orientation": "~4.1.1", "expo-status-bar": "~1.2.0", "i18next": "^21.6.3", @@ -47,6 +48,7 @@ "react-native-select-dropdown": "^1.6.0", "react-native-svg": "^12.1.1", "react-native-web": "0.17.1", + "react-native-webview": "11.15.0", "react-navigation-stack": "^2.10.4", "react-redux": "^7.2.6", "redux": "^4.1.2", diff --git a/src/components/BottomSheetComponents/ProductSpecifications.js b/src/components/BottomSheetComponents/ProductSpecifications.js index 5c4aee6..892148f 100644 --- a/src/components/BottomSheetComponents/ProductSpecifications.js +++ b/src/components/BottomSheetComponents/ProductSpecifications.js @@ -32,7 +32,7 @@ const ProductSpecifications = ({ list, mobile }) => { }, ]} > - {persian[prop]} + {prop?.description || 'description'} { }, ]} > - {list[prop]} + {prop?.value || 'value'} @@ -83,7 +83,7 @@ const ProductSpecifications = ({ list, mobile }) => { - {Object?.keys(list)?.map((prop, index) => ( + {list?.map((prop, index) => ( ))} diff --git a/src/components/Search.js b/src/components/Search.js index feaf5a8..ea9a35f 100644 --- a/src/components/Search.js +++ b/src/components/Search.js @@ -23,7 +23,7 @@ const Search = ({ placeholder, textAlign, direction, onChange, value }) => { fontSize: fontSize.tiny, color: Colors.theme1[colorScheme].gray2077, borderWidth: 0.5, - borderColor: Colors.theme1[colorScheme].gray20, + borderColor: Colors.theme1[colorScheme].gray20 + '88', paddingVertical: 10, paddingHorizontal: 10, direction: direction, @@ -38,7 +38,7 @@ const Search = ({ placeholder, textAlign, direction, onChange, value }) => { style={[styles.inputStyle, tw("rounded-md")]} onChangeText={(text) => onChange(text)} placeholder={placeholder} - placeholderTextColor={Colors.theme1[colorScheme].gray2077} + placeholderTextColor={Colors.theme1[colorScheme].gray20 + '88'} value={value} /> diff --git a/src/screens/AR/components/Book.js b/src/screens/AR/components/Book.js index ea86313..cea15d0 100644 --- a/src/screens/AR/components/Book.js +++ b/src/screens/AR/components/Book.js @@ -1,6 +1,8 @@ -import { View, Text, Image, Dimensions, Appearance } from "react-native"; +import { Pressable, Text, Image, Dimensions, Appearance } from "react-native"; import React from "react"; import { connect } from "react-redux"; +import { useNavigation } from "@react-navigation/native"; +import * as Linking from 'expo-linking'; //style import tw from "tailwind-rn"; @@ -10,13 +12,15 @@ import Colors from "../../../constants/Colors"; const { width, height } = Dimensions.get("window"); const Book = ({ book, mobile }) => { + const navigation = useNavigation(); const colorScheme = Appearance.getColorScheme(); return ( - Linking.openURL(`https://ar.dnvn.ir/lunch?id=${book.id}`)} > { > {book.title} - + ); }; diff --git a/src/screens/AR/index.js b/src/screens/AR/index.js index d8c026c..85559b3 100644 --- a/src/screens/AR/index.js +++ b/src/screens/AR/index.js @@ -38,6 +38,7 @@ function AR({ getArList, arList, mobile }) { paddingTop: Platform.OS === "android" ? StatusBar.currentHeight : 0, position: "relative", backgroundColor: "white", + flex : 1 }} > - - - - - {!mobile && } - {userProduct?.length > 0 && } - -
- - {books?.length > 0 && } - {books?.length > 0 && } - {blogs?.length > 0 && } - - + + + + + {!mobile && } + {userProduct?.length > 0 && } + +
+ + {books?.length > 0 && } + {books?.length > 0 && } + {blogs?.length > 0 && } + + ); }; diff --git a/src/screens/Login/index.js b/src/screens/Login/index.js index ce4e7da..1aa1ba8 100644 --- a/src/screens/Login/index.js +++ b/src/screens/Login/index.js @@ -120,7 +120,7 @@ function Login(props) { onChange={onChangePhone} autoFocus={true} direction="ltr" - regex={onInput.phonenumber} + regex={(text) => onInput.phonenumber(text)} /> { diff --git a/src/screens/Otp/index.js b/src/screens/Otp/index.js index 2c1d54d..b86e278 100644 --- a/src/screens/Otp/index.js +++ b/src/screens/Otp/index.js @@ -8,7 +8,7 @@ import { TouchableOpacity, ActivityIndicator, Appearance, - Platform + Platform, } from "react-native"; import tw from "tailwind-rn"; import { connect } from "react-redux"; @@ -20,8 +20,7 @@ import { user } from "../../redux/actions"; import fontSize from "../../constants/fontSize"; import Colors from "../../constants/Colors"; - -const ios = Platform.OS === 'ios'; +const ios = Platform.OS === "ios"; const { width } = Dimensions.get("window"); let ref1; let ref2; @@ -38,40 +37,45 @@ function Otp(props) { const [fourthCode, setFourthCode] = useState(""); const [time, setTime] = useState(60); const [loading, setLoading] = useState(false); + const [timeEnd, setTimeEnd] = useState(false); const onChangeCode = (value, key) => { - switch (key) { - case "1": - setFirstCode(value); - if (value !== "") { - ref2.focus(); - } - break; - case "2": - setSecondCode(value); - if (value !== "") { - ref3.focus(); - } else { - ref1.focus(); - } - break; - case "3": - setThirdCode(value); - if (value !== "") { - ref4.focus(); - } else { - ref2.focus(); - } - break; - case "4": - setFourthCode(value); - if (value !== "") { - // ref3.focus(); - } else { - ref3.focus(); - } + if (onInput.numberOnly(value) || value === "") { + switch (key) { + case "1": + setFirstCode(value); + if (value !== "") { + ref2.focus(); + } + break; + case "2": + setSecondCode(value); + if (value !== "") { + ref3.focus(); + } else { + ref1.focus(); + } + break; + case "3": + setThirdCode(value); + if (value !== "") { + ref4.focus(); + } else { + ref2.focus(); + } + break; + case "4": + setFourthCode(value); + if (value !== "") { + // ref3.focus(); + } else { + ref3.focus(); + } - break; + break; + } + } else { + return; } }; @@ -105,6 +109,7 @@ function Otp(props) { }, 1000); let timeout = setTimeout(() => { clearInterval(interval); + setTimeEnd(true); }, 60000); return () => { clearInterval(interval); @@ -132,7 +137,11 @@ function Otp(props) { /> (ref1 = ref)} onChangeText={(text) => onChangeCode(text, "1")} regex={onInput.numberOnly} @@ -170,12 +179,12 @@ function Otp(props) { fontSize: fontSize.xl3, fontFamily: "bold", color: Colors.theme1[colorScheme].green79, - width : ios ? fontSize.xl3 + 40 : "" + width: fontSize.xl3 + 40, }, ]} underlineColorAndroid={"transparent"} value={secondCode} - maxLength={1} + maxLength={2} ref={(ref) => (ref2 = ref)} onChangeText={(text) => onChangeCode(text, "2")} regex={onInput.numberOnly} @@ -188,12 +197,12 @@ function Otp(props) { fontSize: fontSize.xl3, fontFamily: "bold", color: Colors.theme1[colorScheme].green79, - width : ios ? fontSize.xl3 + 40 : "" + width: fontSize.xl3 + 40, }, ]} underlineColorAndroid={"transparent"} value={thirdCode} - maxLength={1} + maxLength={2} ref={(ref) => (ref3 = ref)} onChangeText={(text) => onChangeCode(text, "3")} regex={onInput.numberOnly} @@ -206,12 +215,12 @@ function Otp(props) { fontSize: fontSize.xl3, fontFamily: "bold", color: Colors.theme1[colorScheme].green79, - width : ios ? fontSize.xl3 + 40 : "" + width: fontSize.xl3 + 40, }, ]} underlineColorAndroid={"transparent"} value={fourthCode} - maxLength={1} + maxLength={2} ref={(ref) => (ref4 = ref)} onChangeText={(text) => onChangeCode(text, "4")} regex={onInput.numberOnly} @@ -221,7 +230,11 @@ function Otp(props) { - - {"زمان باقی مانده تا انقضای کد: " + time} - - props.navigation.navigate("Login")} - > + {!timeEnd ? ( + {"زمان باقی مانده تا ارسال مجدد: " + time} + + ) : ( + props.navigation.navigate("Login")} > - {"بازگشت به مرحله قبل و اصلاح شماره"} - - + + {"بازگشت به مرحله قبل و اصلاح شماره"} + + + )} ); @@ -275,7 +295,7 @@ function Otp(props) { const mapStateToProps = (state) => ({ isLogin: state.user.status, - mobile : state.publicApi.mobile + mobile: state.publicApi.mobile, }); const mapDispatchToProps = { diff --git a/src/screens/Product/components/Book.js b/src/screens/Product/components/Book.js index 70301ca..48d7b0e 100644 --- a/src/screens/Product/components/Book.js +++ b/src/screens/Product/components/Book.js @@ -230,7 +230,7 @@ function Book({ book, grades, pushToCart, userId, loading, mobile }) { color={Colors.theme1[colorScheme].redFF1} border={{ color: Colors.theme1[colorScheme].redFF1, width: 1 }} width={"33%"} - onPress={() => {}} + onPress={() => navigation.push('Sample')} /> } + component={} height={height - height / 4} /> { + return ( + + + + ); +}; + +export default Sample; diff --git a/src/screens/Products/components/Header.js b/src/screens/Products/components/Header.js index 2768623..c91cca4 100644 --- a/src/screens/Products/components/Header.js +++ b/src/screens/Products/components/Header.js @@ -17,6 +17,7 @@ const Header = ({ setFilterOptions, filterOptions, levels, productTypes }) => { setFilterOptions({ ...filterOptions, search: val })} placeholder={"نام کتاب یا دوره را جستجو کنید"} + value={filterOptions.search} /> setHeight(Dimensions.get("window").height)} > diff --git a/yarn.lock b/yarn.lock index cad6e24..c5b14fa 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2764,6 +2764,11 @@ escape-html@~1.0.3: resolved "https://registry.yarnpkg.com/escape-html/-/escape-html-1.0.3.tgz#0258eae4d3d0c0974de1c169188ef0051d1d1988" integrity sha1-Aljq5NPQwJdN4cFpGI7wBR0dGYg= +escape-string-regexp@2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-2.0.0.tgz#a30304e99daa32e23b2fd20f51babd07cffca344" + integrity sha512-UpzcLCXolUWcNu5HtVMHYdXJjArjsF9C0aNnquZYY4uW/Vu0miy5YoWvbV345HauVvcAUnpRuhMMcqTcGOY2+w== + escape-string-regexp@^1.0.5: version "1.0.5" resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz#1b61c0562190a8dff6ae3bb2cf0200ca130b86d4" @@ -2927,6 +2932,16 @@ expo-linear-gradient@~11.0.3: resolved "https://registry.yarnpkg.com/expo-linear-gradient/-/expo-linear-gradient-11.0.3.tgz#bc559b9a251c9dc8aa37fb6c66c7a497fe92993c" integrity sha512-LuzTM5+iEHCQfC2TBHAAI+ZjPvf0TvGiA7GYMsyTnakGA2r4JtsV8Ah/miQPKhfG06jLDOo4grUoSMGqbmSrEw== +expo-linking@~3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/expo-linking/-/expo-linking-3.0.0.tgz#67f06b0be4ac1da911c46535a704d24eca34e344" + integrity sha512-TgRB4JTdhMRo79rTu9E9zwzWyBUJxHpSbHFlv0ZfMAwU+qFCsL9zZsL44R/yj7xrvcLOjqbCVmBszLQ0pFOt1g== + dependencies: + expo-constants "~13.0.0" + invariant "^2.2.4" + qs "^6.9.1" + url-parse "^1.4.4" + expo-modules-autolinking@0.5.2: version "0.5.2" resolved "https://registry.yarnpkg.com/expo-modules-autolinking/-/expo-modules-autolinking-0.5.2.tgz#fb8812a88d6e22d014188c8252ea0c17c1ef4893" @@ -3521,7 +3536,7 @@ interpret@^1.0.0: resolved "https://registry.yarnpkg.com/interpret/-/interpret-1.4.0.tgz#665ab8bc4da27a774a40584e812e3e0fa45b1a1e" integrity sha512-agE4QfB2Lkp9uICn7BAqoscw4SZP9kTE2hxiFI3jBPmXJfdqiahTbUuKGsMoN2GtqL9AxhYioAcVvgsb1HvRbA== -invariant@^2.2.4: +invariant@2.2.4, invariant@^2.2.4: version "2.2.4" resolved "https://registry.yarnpkg.com/invariant/-/invariant-2.2.4.tgz#610f3c92c9359ce1db616e538008d23ff35158e6" integrity sha512-phJfQVBuaJM5raOpJjSfkiD6BpbCE4Ns//LaXl6wGYtUBY83nWS6Rf9tXm2e8VaK60JEjYldbPif/A2B1C2gNA== @@ -4719,6 +4734,11 @@ object-copy@^0.1.0: define-property "^0.2.5" kind-of "^3.0.3" +object-inspect@^1.9.0: + version "1.12.0" + resolved "https://registry.yarnpkg.com/object-inspect/-/object-inspect-1.12.0.tgz#6e2c120e868fd1fd18cb4f18c31741d0d6e776f0" + integrity sha512-Ho2z80bVIvJloH+YzRmpZVQe87+qASmBUKZDWgx9cu+KDrX2ZDH/3tMy+gXbZETVGs2M8YdxObOh7XAtim9Y0g== + object-keys@^1.0.12, object-keys@^1.1.1: version "1.1.1" resolved "https://registry.yarnpkg.com/object-keys/-/object-keys-1.1.1.tgz#1c47f272df277f3b1daf061677d9c82e2322c60e" @@ -5038,6 +5058,13 @@ pump@^3.0.0: end-of-stream "^1.1.0" once "^1.3.1" +qs@^6.9.1: + version "6.10.3" + resolved "https://registry.yarnpkg.com/qs/-/qs-6.10.3.tgz#d6cde1b2ffca87b5aa57889816c5f81535e22e8e" + integrity sha512-wr7M2E0OFRfIfJZjKGieI8lBKb7fRCH4Fv5KNPEs7gJ8jadvotdsS08PzOKR7opXhZ/Xkjtt3WF9g38drmyRqQ== + dependencies: + side-channel "^1.0.4" + query-string@^7.0.0: version "7.0.1" resolved "https://registry.yarnpkg.com/query-string/-/query-string-7.0.1.tgz#45bd149cf586aaa582dffc7ec7a8ad97dd02f75d" @@ -5201,6 +5228,14 @@ react-native-web@0.17.1: normalize-css-color "^1.0.2" prop-types "^15.6.0" +react-native-webview@11.15.0: + version "11.15.0" + resolved "https://registry.yarnpkg.com/react-native-webview/-/react-native-webview-11.15.0.tgz#b5aea9da579ca17fb9fd324e5202b1b5b8ce9fa8" + integrity sha512-0Wv+8qu8XuACx1xZwzc2Yfl+rOvxUouLcPxUKdkhaMVNpwoM5/ePpczCQZ3LpiRnSoEtjaUkfyQHbJQ+x4dDJQ== + dependencies: + escape-string-regexp "2.0.0" + invariant "2.2.4" + react-native@0.64.3: version "0.64.3" resolved "https://registry.yarnpkg.com/react-native/-/react-native-0.64.3.tgz#40db6385963b4b17325f9cc86dd19132394b03fc" @@ -5695,6 +5730,15 @@ shelljs@^0.8.4: interpret "^1.0.0" rechoir "^0.6.2" +side-channel@^1.0.4: + version "1.0.4" + resolved "https://registry.yarnpkg.com/side-channel/-/side-channel-1.0.4.tgz#efce5c8fdc104ee751b25c58d4290011fa5ea2cf" + integrity sha512-q5XPytqFEIKHkGdiMIrY10mvLRvnQh42/+GoBlFW3b2LXLE2xxJpZFdm94we0BaoV3RwJyGqg5wS7epxTv0Zvw== + dependencies: + call-bind "^1.0.0" + get-intrinsic "^1.0.2" + object-inspect "^1.9.0" + signal-exit@^3.0.0, signal-exit@^3.0.2: version "3.0.6" resolved "https://registry.yarnpkg.com/signal-exit/-/signal-exit-3.0.6.tgz#24e630c4b0f03fea446a2bd299e62b4a6ca8d0af"