diff --git a/src/components/CustomTextInput.js b/src/components/CustomTextInput.js index 320d87f..b33e512 100644 --- a/src/components/CustomTextInput.js +++ b/src/components/CustomTextInput.js @@ -51,6 +51,7 @@ const FloatingLabelInput = ({ textAlign: textAlign, fontFamily: "regular", fontWeight: "900", + direction: direction ? direction : "rtl" }, }); return ( diff --git a/src/components/Drawer.js b/src/components/Drawer.js index 539cfab..105ef03 100644 --- a/src/components/Drawer.js +++ b/src/components/Drawer.js @@ -31,7 +31,7 @@ if ( UIManager.setLayoutAnimationEnabledExperimental(true); } -const Drawer = ({ position, setBoxPosition, user }) => { +const Drawer = ({ position, setBoxPosition, user = JSON.parse(user) }) => { const colorScheme = Appearance.getColorScheme(); const [routes, setRoutes] = useState([ { @@ -142,7 +142,7 @@ const Drawer = ({ position, setBoxPosition, user }) => { { backgroundColor: Colors.theme1[colorScheme].greenCF }, ]} > - {user.picFileId ? ( + {user?.picFileId ? ( { )} @@ -210,11 +210,11 @@ const Drawer = ({ position, setBoxPosition, user }) => { }; const mapStateToProps = (state) => ({ - user: JSON.parse(state.user.status), + user: state.user.status, }); const mapDispatchToProps = { logout: user.logout, }; -export default connect(mapStateToProps)(Drawer); +export default connect(mapStateToProps, mapDispatchToProps)(Drawer); diff --git a/src/redux/reducers/user.js b/src/redux/reducers/user.js index 156bc06..2be1251 100644 --- a/src/redux/reducers/user.js +++ b/src/redux/reducers/user.js @@ -23,7 +23,7 @@ const user = (state = initialState, action) => { case "public/sendOTP": return { ...state, loading: false, error: null }; case "user/getStatus": - return { ...state, status: data.status, error: null }; + return { ...state, status: JSON.parse(data.status), error: null }; case "user/login": case "user/otp/login": return { diff --git a/src/redux/store.js b/src/redux/store.js index 4741be7..3fc02b8 100644 --- a/src/redux/store.js +++ b/src/redux/store.js @@ -65,6 +65,8 @@ try { console.log(e); } +AsyncStorage.clear(); + console.disableYellowBox = true; export default store; diff --git a/src/screens/Home/index.js b/src/screens/Home/index.js index 0ed8ff5..4f6a836 100644 --- a/src/screens/Home/index.js +++ b/src/screens/Home/index.js @@ -26,8 +26,6 @@ const Home = ({ getBlogs, books, getBooks, - videos, - getVideos, userProducts, getUserProducts, }) => { @@ -35,7 +33,7 @@ const Home = ({ useEffect(() => { getBlogs(); - getBooks(); + getBooks({vod : true}); getUserProducts(); }, []); @@ -68,13 +66,13 @@ const Home = ({ contentContainerStyle={styles.contentContainerStyle} style={[styles.container, tw("flex")]} > - {userProducts.length > 0 && } + {userProduct?.length > 0 && }
- {books.length > 0 && } - {books.length > 0 && } - {blogs.length > 0 && } + {books?.length > 0 && } + {books?.length > 0 && } + {blogs?.length > 0 && } ); @@ -96,7 +94,6 @@ const mapStateToProps = (state) => ({ blogs: state.blog.list, books: state.book.list, userProducts: state.userProduct.list, - videos: state.product.listVOD, }); const mapDispatchToProps = { diff --git a/src/screens/Login/index.js b/src/screens/Login/index.js index 265cb0e..d4d4796 100644 --- a/src/screens/Login/index.js +++ b/src/screens/Login/index.js @@ -77,7 +77,7 @@ function Login(props) { diff --git a/src/screens/Otp/index.js b/src/screens/Otp/index.js index 44bd9a5..df2d6e3 100644 --- a/src/screens/Otp/index.js +++ b/src/screens/Otp/index.js @@ -87,7 +87,7 @@ function Otp(props) { const submit = async () => { setLoading(true); props.sendOtp({ - cellphone: props.route.params.phone, + cellphone: props.route.params?.phone, otp: String(getEnCode()), applicationToken: "1", userToken: "1", @@ -139,7 +139,7 @@ function Otp(props) { color: "#6f7074", }, ]} - >{`یک کد تائیدیه به شماره ${props.route.params.phone} ارسال شد. آن را در قسمت زیر وارد کنید`} + >{`یک کد تائیدیه به شماره ${props.route.params?.phone} ارسال شد. آن را در قسمت زیر وارد کنید`} (ref1 = ref)} onChangeText={(text) => onChangeCode(text, "1")} + regex={onInput.numberOnly} + direction="ltr" /> (ref2 = ref)} onChangeText={(text) => onChangeCode(text, "2")} + regex={onInput.numberOnly} + direction="ltr" /> (ref3 = ref)} onChangeText={(text) => onChangeCode(text, "3")} + regex={onInput.numberOnly} + direction="ltr" /> (ref4 = ref)} onChangeText={(text) => onChangeCode(text, "4")} + regex={onInput.numberOnly} + direction="ltr" /> ({ - userId: state.user.status.id, + userId: state.user.status?.id, loading: state.userProduct.loading, }); diff --git a/src/screens/Profile/components/List.js b/src/screens/Profile/components/List.js index b786c6a..bdc79de 100644 --- a/src/screens/Profile/components/List.js +++ b/src/screens/Profile/components/List.js @@ -109,7 +109,7 @@ const List = ({}) => { }, { icon: ( - + { }; const mapStateToProps = (state) => ({ - user: JSON.parse(state.user.status), + user: state.user.status, }); export default connect(mapStateToProps)(User); diff --git a/src/screens/QR/Scan/index.js b/src/screens/QR/Scan/index.js index 7ad4beb..b114a3e 100644 --- a/src/screens/QR/Scan/index.js +++ b/src/screens/QR/Scan/index.js @@ -96,4 +96,4 @@ export default function Scan({}) { {/* )} */} ); -} +} \ No newline at end of file diff --git a/src/screens/ShoppingCart/components/Code.js b/src/screens/ShoppingCart/components/Code.js index 5507b0e..cdc9363 100644 --- a/src/screens/ShoppingCart/components/Code.js +++ b/src/screens/ShoppingCart/components/Code.js @@ -70,7 +70,7 @@ function Code({ codeId, setCodeId, userId, factorId }) { const mapStateToProps = (state) => ({ codeId: state.userFactor.info?.codeId, - userId: state.user.status.id, + userId: state.user.status?.id, factorId: state.userFactor.info?.id, }); diff --git a/src/screens/ShoppingCart/index.js b/src/screens/ShoppingCart/index.js index 411b8ea..3260c1c 100644 --- a/src/screens/ShoppingCart/index.js +++ b/src/screens/ShoppingCart/index.js @@ -247,7 +247,7 @@ const mapStateToProps = (state) => ({ list: state.userProduct.list, payPrice: state.userProduct.sum, factorInfo: state.userFactor.info, - userId: state.user.status.id, + userId: state.user.status?.id, hasPhysical: state.userProduct.hasPhysical, loading: state.userProduct.loading, }); diff --git a/src/screens/Video/index.js b/src/screens/Video/index.js index 5c8dd16..8d77769 100644 --- a/src/screens/Video/index.js +++ b/src/screens/Video/index.js @@ -173,7 +173,7 @@ const mapStateToProps = (state) => ({ seasons: state.publicApi.categories, grades: state.publicApi.grades, isLogin: state.user.status, - userId: state.user.status.id, + userId: state.user.status?.id, loading: state.userProduct.loading, }); diff --git a/src/screens/VideoDisplay/components/Season/index.js b/src/screens/VideoDisplay/components/Season/index.js index 84ccd23..8fd4095 100644 --- a/src/screens/VideoDisplay/components/Season/index.js +++ b/src/screens/VideoDisplay/components/Season/index.js @@ -123,7 +123,7 @@ const mapStateToProps = (state) => ({ selectedVideo: state.publicApi.selectedVideo, realSeasons: state.publicApi.bookInfo?.categories, vods: state.publicApi.bookSection?.vods, - userid: state.user.status.id, + userid: state.user.status?.id, }); const mapDispatchToProps = { diff --git a/src/utils/onInput.js b/src/utils/onInput.js index 8da5361..5be91d8 100644 --- a/src/utils/onInput.js +++ b/src/utils/onInput.js @@ -147,6 +147,16 @@ class onInput { newText = newText.replace(/7/g, "7"); newText = newText.replace(/8/g, "8"); newText = newText.replace(/9/g, "9"); + newText = newText.replace(/۰/g, "0"); + newText = newText.replace(/۱/g, "1"); + newText = newText.replace(/۲/g, "2"); + newText = newText.replace(/۳/g, "3"); + newText = newText.replace(/۴/g, "4"); + newText = newText.replace(/۵/g, "5"); + newText = newText.replace(/۶/g, "6"); + newText = newText.replace(/۷/g, "7"); + newText = newText.replace(/۸/g, "8"); + newText = newText.replace(/۹/g, "9"); newText = newText.replace(/ا/g, ""); newText = newText.replace(/ب/g, ""); newText = newText.replace(/پ/g, ""); @@ -237,7 +247,7 @@ class onInput { newText = newText.replace(/N/g, ""); newText = newText.replace(/M/g, ""); if (!newText && newText.length !== 0) { - // toast.info("از اعداداستفاده کنید"); + toast.info("از اعداداستفاده کنید"); } return newText; };