|
|
@ -8,6 +8,8 @@ import { |
|
|
|
Platform, |
|
|
|
Platform, |
|
|
|
Dimensions, |
|
|
|
Dimensions, |
|
|
|
Appearance, |
|
|
|
Appearance, |
|
|
|
|
|
|
|
KeyboardAvoidingView, |
|
|
|
|
|
|
|
TouchableWithoutFeedback, |
|
|
|
} from "react-native"; |
|
|
|
} from "react-native"; |
|
|
|
import React, { useEffect, useState } from "react"; |
|
|
|
import React, { useEffect, useState } from "react"; |
|
|
|
import { connect } from "react-redux"; |
|
|
|
import { connect } from "react-redux"; |
|
|
@ -28,7 +30,9 @@ import tw from "tailwind-rn"; |
|
|
|
import Colors from "../../constants/Colors"; |
|
|
|
import Colors from "../../constants/Colors"; |
|
|
|
import fontSize from "../../constants/fontSize"; |
|
|
|
import fontSize from "../../constants/fontSize"; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//variables
|
|
|
|
const ios = Platform.OS === "ios"; |
|
|
|
const ios = Platform.OS === "ios"; |
|
|
|
|
|
|
|
const { height } = Dimensions.get("window"); |
|
|
|
|
|
|
|
|
|
|
|
const Address = ({ |
|
|
|
const Address = ({ |
|
|
|
user, |
|
|
|
user, |
|
|
@ -243,9 +247,14 @@ const Address = ({ |
|
|
|
<SafeAreaView |
|
|
|
<SafeAreaView |
|
|
|
style={{ |
|
|
|
style={{ |
|
|
|
paddingTop: Platform.OS === "android" ? StatusBar.currentHeight : 0, |
|
|
|
paddingTop: Platform.OS === "android" ? StatusBar.currentHeight : 0, |
|
|
|
position: "relative", |
|
|
|
// position: "relative",
|
|
|
|
|
|
|
|
flex: 1, |
|
|
|
}} |
|
|
|
}} |
|
|
|
> |
|
|
|
> |
|
|
|
|
|
|
|
<ScrollView style={tw("flex-1 px-4")}> |
|
|
|
|
|
|
|
<KeyboardAvoidingView behavior={"padding"} style={[{ height }]}> |
|
|
|
|
|
|
|
<TouchableWithoutFeedback> |
|
|
|
|
|
|
|
<View style={tw("flex-1")}> |
|
|
|
<Navbar |
|
|
|
<Navbar |
|
|
|
headerOptions={{ |
|
|
|
headerOptions={{ |
|
|
|
logo: false, |
|
|
|
logo: false, |
|
|
@ -257,12 +266,6 @@ const Address = ({ |
|
|
|
back: true, |
|
|
|
back: true, |
|
|
|
}} |
|
|
|
}} |
|
|
|
/> |
|
|
|
/> |
|
|
|
<ScrollView |
|
|
|
|
|
|
|
contentContainerStyle={styles.contentContainerStyle} |
|
|
|
|
|
|
|
style={styles.container} |
|
|
|
|
|
|
|
> |
|
|
|
|
|
|
|
<View style={tw("w-full flex pb-4")}> |
|
|
|
|
|
|
|
{/* <MapSelector /> */} |
|
|
|
|
|
|
|
<Header |
|
|
|
<Header |
|
|
|
title="اطلاعات هویتی" |
|
|
|
title="اطلاعات هویتی" |
|
|
|
text="( لطفا نام و نام خانوادگی خود را به طور کامل وارد نمایید )" |
|
|
|
text="( لطفا نام و نام خانوادگی خود را به طور کامل وارد نمایید )" |
|
|
@ -274,7 +277,9 @@ const Address = ({ |
|
|
|
name="firstName" |
|
|
|
name="firstName" |
|
|
|
maxlength="40" |
|
|
|
maxlength="40" |
|
|
|
value={ |
|
|
|
value={ |
|
|
|
profilePage ? profileFields.firstName : addressFields?.firstName |
|
|
|
profilePage |
|
|
|
|
|
|
|
? profileFields.firstName |
|
|
|
|
|
|
|
: addressFields?.firstName |
|
|
|
} |
|
|
|
} |
|
|
|
onChange={(name, value) => |
|
|
|
onChange={(name, value) => |
|
|
|
profilePage |
|
|
|
profilePage |
|
|
@ -303,6 +308,7 @@ const Address = ({ |
|
|
|
/> |
|
|
|
/> |
|
|
|
{profilePage && ( |
|
|
|
{profilePage && ( |
|
|
|
<CustomTextInput |
|
|
|
<CustomTextInput |
|
|
|
|
|
|
|
keyboardType="numeric" |
|
|
|
label="کد ملی" |
|
|
|
label="کد ملی" |
|
|
|
placeholder="" |
|
|
|
placeholder="" |
|
|
|
textAlign="left" |
|
|
|
textAlign="left" |
|
|
@ -313,7 +319,7 @@ const Address = ({ |
|
|
|
setProfileFields({ ...profileFields, nationalId: value }) |
|
|
|
setProfileFields({ ...profileFields, nationalId: value }) |
|
|
|
} |
|
|
|
} |
|
|
|
autoFocus={false} |
|
|
|
autoFocus={false} |
|
|
|
regex={onInput.numberOnly} |
|
|
|
regex={(text) => onInput.numberOnly(text)} |
|
|
|
/> |
|
|
|
/> |
|
|
|
)} |
|
|
|
)} |
|
|
|
<View style={tw("mt-4")}></View> |
|
|
|
<View style={tw("mt-4")}></View> |
|
|
@ -323,13 +329,16 @@ const Address = ({ |
|
|
|
به همراه پیش شماره وارد کنید )" |
|
|
|
به همراه پیش شماره وارد کنید )" |
|
|
|
/> |
|
|
|
/> |
|
|
|
<CustomTextInput |
|
|
|
<CustomTextInput |
|
|
|
|
|
|
|
keyboardType="numeric" |
|
|
|
label="شماره موبایل" |
|
|
|
label="شماره موبایل" |
|
|
|
placeholder="" |
|
|
|
placeholder="" |
|
|
|
textAlign="left" |
|
|
|
textAlign="left" |
|
|
|
name="cellphone" |
|
|
|
name="cellphone" |
|
|
|
maxlength="11" |
|
|
|
maxlength="11" |
|
|
|
value={ |
|
|
|
value={ |
|
|
|
profilePage ? profileFields.cellphone : addressFields?.cellphone |
|
|
|
profilePage |
|
|
|
|
|
|
|
? profileFields.cellphone |
|
|
|
|
|
|
|
: addressFields?.cellphone |
|
|
|
} |
|
|
|
} |
|
|
|
onChange={(name, value) => |
|
|
|
onChange={(name, value) => |
|
|
|
profilePage |
|
|
|
profilePage |
|
|
@ -337,9 +346,10 @@ const Address = ({ |
|
|
|
: onChange(name, value) |
|
|
|
: onChange(name, value) |
|
|
|
} |
|
|
|
} |
|
|
|
autoFocus={false} |
|
|
|
autoFocus={false} |
|
|
|
regex={onInput.phonenumber} |
|
|
|
regex={(text) => onInput.numberOnly(text)} |
|
|
|
/> |
|
|
|
/> |
|
|
|
<CustomTextInput |
|
|
|
<CustomTextInput |
|
|
|
|
|
|
|
keyboardType="numeric" |
|
|
|
label="شماره تلفن" |
|
|
|
label="شماره تلفن" |
|
|
|
placeholder="" |
|
|
|
placeholder="" |
|
|
|
textAlign="left" |
|
|
|
textAlign="left" |
|
|
@ -352,7 +362,7 @@ const Address = ({ |
|
|
|
: onChange(name, value) |
|
|
|
: onChange(name, value) |
|
|
|
} |
|
|
|
} |
|
|
|
autoFocus={false} |
|
|
|
autoFocus={false} |
|
|
|
regex={onInput.phonenumber} |
|
|
|
regex={(text) => onInput.numberOnly(text)} |
|
|
|
/> |
|
|
|
/> |
|
|
|
<View style={tw("mt-4")}></View> |
|
|
|
<View style={tw("mt-4")}></View> |
|
|
|
<Header |
|
|
|
<Header |
|
|
@ -396,11 +406,12 @@ const Address = ({ |
|
|
|
</View> |
|
|
|
</View> |
|
|
|
<View style={tw("mb-4")}> |
|
|
|
<View style={tw("mb-4")}> |
|
|
|
<CustomTextInput |
|
|
|
<CustomTextInput |
|
|
|
|
|
|
|
keyboardType="numeric" |
|
|
|
label="کد پستی" |
|
|
|
label="کد پستی" |
|
|
|
placeholder="" |
|
|
|
placeholder="" |
|
|
|
textAlign="left" |
|
|
|
textAlign="left" |
|
|
|
name="postalCode" |
|
|
|
name="postalCode" |
|
|
|
maxlength="60" |
|
|
|
maxlength="10" |
|
|
|
value={ |
|
|
|
value={ |
|
|
|
profilePage |
|
|
|
profilePage |
|
|
|
? profileFields.postalCode |
|
|
|
? profileFields.postalCode |
|
|
@ -408,17 +419,22 @@ const Address = ({ |
|
|
|
} |
|
|
|
} |
|
|
|
onChange={(name, value) => |
|
|
|
onChange={(name, value) => |
|
|
|
profilePage |
|
|
|
profilePage |
|
|
|
? setProfileFields({ ...profileFields, postalCode: value }) |
|
|
|
? setProfileFields({ |
|
|
|
|
|
|
|
...profileFields, |
|
|
|
|
|
|
|
postalCode: value, |
|
|
|
|
|
|
|
}) |
|
|
|
: onChange(name, value) |
|
|
|
: onChange(name, value) |
|
|
|
} |
|
|
|
} |
|
|
|
autoFocus={false} |
|
|
|
autoFocus={false} |
|
|
|
regex={(val) => val} |
|
|
|
regex={(text) => onInput.numberOnly(text)} |
|
|
|
/> |
|
|
|
/> |
|
|
|
</View> |
|
|
|
</View> |
|
|
|
|
|
|
|
|
|
|
|
<CustomPressable |
|
|
|
<CustomPressable |
|
|
|
title={ |
|
|
|
title={ |
|
|
|
profilePage ? "ذخیره اطلاعات و بازگشت به صفحه قبل" : "ثبت آدرس" |
|
|
|
profilePage |
|
|
|
|
|
|
|
? "ذخیره اطلاعات و بازگشت به صفحه قبل" |
|
|
|
|
|
|
|
: "ثبت آدرس" |
|
|
|
} |
|
|
|
} |
|
|
|
backgroundColor={Colors.theme1[colorScheme].greenCF} |
|
|
|
backgroundColor={Colors.theme1[colorScheme].greenCF} |
|
|
|
color={"white"} |
|
|
|
color={"white"} |
|
|
@ -427,6 +443,8 @@ const Address = ({ |
|
|
|
onPress={() => (profilePage ? submitProfile() : submit())} |
|
|
|
onPress={() => (profilePage ? submitProfile() : submit())} |
|
|
|
/> |
|
|
|
/> |
|
|
|
</View> |
|
|
|
</View> |
|
|
|
|
|
|
|
</TouchableWithoutFeedback> |
|
|
|
|
|
|
|
</KeyboardAvoidingView> |
|
|
|
</ScrollView> |
|
|
|
</ScrollView> |
|
|
|
</SafeAreaView> |
|
|
|
</SafeAreaView> |
|
|
|
); |
|
|
|
); |
|
|
@ -434,13 +452,14 @@ const Address = ({ |
|
|
|
|
|
|
|
|
|
|
|
const styles = StyleSheet.create({ |
|
|
|
const styles = StyleSheet.create({ |
|
|
|
contentContainerStyle: { |
|
|
|
contentContainerStyle: { |
|
|
|
paddingBottom: 100, |
|
|
|
paddingBottom: 0, |
|
|
|
}, |
|
|
|
}, |
|
|
|
container: { |
|
|
|
container: { |
|
|
|
backgroundColor: "white", |
|
|
|
backgroundColor: "white", |
|
|
|
flexDirection: "column", |
|
|
|
flexDirection: "column", |
|
|
|
paddingVertical: 5, |
|
|
|
paddingVertical: 5, |
|
|
|
paddingHorizontal: 16, |
|
|
|
paddingHorizontal: 16, |
|
|
|
|
|
|
|
flex: 1, |
|
|
|
}, |
|
|
|
}, |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|