From fd706f237d37f7c229bc31905316ea3921d6a279 Mon Sep 17 00:00:00 2001 From: Reza_ashrafi Date: Thu, 5 May 2022 20:48:53 +0430 Subject: [PATCH] reza fixed some issue --- src/components/CustomTextInput.js | 2 + src/screens/Address/index.js | 77 +++++++++++++++++++++++++++++++ 2 files changed, 79 insertions(+) diff --git a/src/components/CustomTextInput.js b/src/components/CustomTextInput.js index 283ca41..e411b0f 100644 --- a/src/components/CustomTextInput.js +++ b/src/components/CustomTextInput.js @@ -23,6 +23,7 @@ const FloatingLabelInput = ({ keyboardType, multiline, theme, + editable = true, ...props }) => { const [isFocused, setIsFocused] = React.useState(false); @@ -91,6 +92,7 @@ const FloatingLabelInput = ({ onBlur={() => (value ? {} : setIsFocused(() => false))} keyboardType={keyboardType} multiline={multiline} + editable={editable} placeholderTextColor={theme === 'light' ? Colors.theme1.gray20 + 'aa' : Colors.theme1.white + '55'} /> diff --git a/src/screens/Address/index.js b/src/screens/Address/index.js index a1d2976..69568ab 100644 --- a/src/screens/Address/index.js +++ b/src/screens/Address/index.js @@ -119,41 +119,97 @@ const Address = ({ if (!firstName) { return asyncAwesomeAlert("خطا", "نام خود را وارد کنید.", { showCancelButton: false, + confirmText: "باشه", }); } if (!lastName) { return asyncAwesomeAlert("خطا", "نام خانوادگی خود را وارد کنید", { showCancelButton: false, + confirmText: "باشه", }); } if (!cellphone) { return asyncAwesomeAlert("خطا", "شماره موبایل خود را وارد کنید.", { showCancelButton: false, + confirmText: "باشه", }); + } else { + if (cellphone.slice(0, 2) !== "09") { + return asyncAwesomeAlert( + "خطا", + "فرمت شماره موبایل وارد شده اشتباه است.", + { + showCancellphoneButton: false, + confirmText: "باشه", + } + ); + } + if (cel.length !== 11) { + return asyncAwesomeAlert( + "خطا", + "شماره موبایل میبایست یازده رقم باشد.", + { + showCancelButton: false, + confirmText: "باشه", + } + ); + } } + if (!phone) { return asyncAwesomeAlert("خطا", "شماره تلفن خود را وارد کنید.", { showCancelButton: false, + confirmText: "باشه", }); + } else { + if (phone.slice(0, 1) !== "0") { + return asyncAwesomeAlert( + "خطا", + "فرمت شماره تلفن وارد شده اشتباه است.", + { + showCancelButton: false, + confirmText: "باشه", + } + ); + } + if (phone.length !== 11) { + return asyncAwesomeAlert("خطا", "شماره تلفن میبایست یازده رقم باشد.", { + showCancelButton: false, + confirmText: "باشه", + }); + } } + if (!provinceId) { return asyncAwesomeAlert("خطا", "نام استان خود را وارد کنید.", { showCancelButton: false, + confirmText: "باشه", }); } if (!cityId) { return asyncAwesomeAlert("خطا", "نام شهرستان خود را وارد کنید.", { showCancelButton: false, + confirmText: "باشه", }); } if (!postalCode) { return asyncAwesomeAlert("خطا", "کد پستی خود را وارد کنید.", { showCancelButton: false, + confirmText: "باشه", }); + } else { + if (postalCode.length !== 10) { + return asyncAwesomeAlert("خطا", "کد ملی میبایست ده رقم باشد.", { + showCancelButton: false, + confirmText: "باشه", + }); + } } + if (!mapAddress) { return asyncAwesomeAlert("خطا", "آدرس خود را از روی نقشه انتخاب کن", { showCancelButton: false, + confirmText: "باشه", }); } @@ -195,6 +251,26 @@ const Address = ({ cityId, docFileIds, } = profileFields; + + if (phone) { + if (phone.slice(0, 1) !== "0") { + return asyncAwesomeAlert( + "خطا", + "فرمت شماره تلفن وارد شده اشتباه است.", + { + showCancelButton: false, + confirmText: "باشه", + } + ); + } + if (phone.length !== 11) { + return asyncAwesomeAlert("خطا", "شماره تلفن میبایست یازده رقم باشد.", { + showCancelButton: false, + confirmText: "باشه", + }); + } + } + const data = { firstName: firstName, lastName: lastName, @@ -360,6 +436,7 @@ const Address = ({ } autoFocus={false} regex={(text) => onInput.numberOnly(text)} + editable={false} />