reza fixed some issue

master
Reza_ashrafi 2 years ago
parent 69cd321508
commit fd706f237d
  1. 2
      src/components/CustomTextInput.js
  2. 77
      src/screens/Address/index.js

@ -23,6 +23,7 @@ const FloatingLabelInput = ({
keyboardType, keyboardType,
multiline, multiline,
theme, theme,
editable = true,
...props ...props
}) => { }) => {
const [isFocused, setIsFocused] = React.useState(false); const [isFocused, setIsFocused] = React.useState(false);
@ -91,6 +92,7 @@ const FloatingLabelInput = ({
onBlur={() => (value ? {} : setIsFocused(() => false))} onBlur={() => (value ? {} : setIsFocused(() => false))}
keyboardType={keyboardType} keyboardType={keyboardType}
multiline={multiline} multiline={multiline}
editable={editable}
placeholderTextColor={theme === 'light' ? Colors.theme1.gray20 + 'aa' : Colors.theme1.white + '55'} placeholderTextColor={theme === 'light' ? Colors.theme1.gray20 + 'aa' : Colors.theme1.white + '55'}
/> />
</View> </View>

@ -119,41 +119,97 @@ const Address = ({
if (!firstName) { if (!firstName) {
return asyncAwesomeAlert("خطا", "نام خود را وارد کنید.", { return asyncAwesomeAlert("خطا", "نام خود را وارد کنید.", {
showCancelButton: false, showCancelButton: false,
confirmText: "باشه",
}); });
} }
if (!lastName) { if (!lastName) {
return asyncAwesomeAlert("خطا", "نام خانوادگی خود را وارد کنید", { return asyncAwesomeAlert("خطا", "نام خانوادگی خود را وارد کنید", {
showCancelButton: false, showCancelButton: false,
confirmText: "باشه",
}); });
} }
if (!cellphone) { if (!cellphone) {
return asyncAwesomeAlert("خطا", "شماره موبایل خود را وارد کنید.", { return asyncAwesomeAlert("خطا", "شماره موبایل خود را وارد کنید.", {
showCancelButton: false, 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) { if (!phone) {
return asyncAwesomeAlert("خطا", "شماره تلفن خود را وارد کنید.", { return asyncAwesomeAlert("خطا", "شماره تلفن خود را وارد کنید.", {
showCancelButton: false, 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) { if (!provinceId) {
return asyncAwesomeAlert("خطا", "نام استان خود را وارد کنید.", { return asyncAwesomeAlert("خطا", "نام استان خود را وارد کنید.", {
showCancelButton: false, showCancelButton: false,
confirmText: "باشه",
}); });
} }
if (!cityId) { if (!cityId) {
return asyncAwesomeAlert("خطا", "نام شهرستان خود را وارد کنید.", { return asyncAwesomeAlert("خطا", "نام شهرستان خود را وارد کنید.", {
showCancelButton: false, showCancelButton: false,
confirmText: "باشه",
}); });
} }
if (!postalCode) { if (!postalCode) {
return asyncAwesomeAlert("خطا", "کد پستی خود را وارد کنید.", { return asyncAwesomeAlert("خطا", "کد پستی خود را وارد کنید.", {
showCancelButton: false, showCancelButton: false,
confirmText: "باشه",
});
} else {
if (postalCode.length !== 10) {
return asyncAwesomeAlert("خطا", "کد ملی میبایست ده رقم باشد.", {
showCancelButton: false,
confirmText: "باشه",
}); });
} }
}
if (!mapAddress) { if (!mapAddress) {
return asyncAwesomeAlert("خطا", "آدرس خود را از روی نقشه انتخاب کن", { return asyncAwesomeAlert("خطا", "آدرس خود را از روی نقشه انتخاب کن", {
showCancelButton: false, showCancelButton: false,
confirmText: "باشه",
}); });
} }
@ -195,6 +251,26 @@ const Address = ({
cityId, cityId,
docFileIds, docFileIds,
} = profileFields; } = 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 = { const data = {
firstName: firstName, firstName: firstName,
lastName: lastName, lastName: lastName,
@ -360,6 +436,7 @@ const Address = ({
} }
autoFocus={false} autoFocus={false}
regex={(text) => onInput.numberOnly(text)} regex={(text) => onInput.numberOnly(text)}
editable={false}
/> />
<CustomTextInput <CustomTextInput
keyboardType="numeric" keyboardType="numeric"

Loading…
Cancel
Save