|
|
@ -3,7 +3,6 @@ import { |
|
|
|
Text, |
|
|
|
Text, |
|
|
|
Pressable, |
|
|
|
Pressable, |
|
|
|
TouchableOpacity, |
|
|
|
TouchableOpacity, |
|
|
|
Appearance, |
|
|
|
|
|
|
|
ActivityIndicator, |
|
|
|
ActivityIndicator, |
|
|
|
Platform |
|
|
|
Platform |
|
|
|
} from "react-native"; |
|
|
|
} from "react-native"; |
|
|
@ -19,8 +18,7 @@ import fontSize from "../../../constants/fontSize"; |
|
|
|
|
|
|
|
|
|
|
|
const ios = Platform.OS === "ios"; |
|
|
|
const ios = Platform.OS === "ios"; |
|
|
|
|
|
|
|
|
|
|
|
const Address = ({ addresses, update, userId, userAddressId, loading, mobile }) => { |
|
|
|
const Address = ({ addresses, update, userId, userAddressId, loading, mobile, theme }) => { |
|
|
|
const colorScheme = Appearance.getColorScheme(); |
|
|
|
|
|
|
|
const navigation = useNavigation(); |
|
|
|
const navigation = useNavigation(); |
|
|
|
|
|
|
|
|
|
|
|
const Location = ({ address, active }) => { |
|
|
|
const Location = ({ address, active }) => { |
|
|
@ -30,13 +28,13 @@ const Address = ({ addresses, update, userId, userAddressId, loading, mobile }) |
|
|
|
{ |
|
|
|
{ |
|
|
|
backgroundColor: |
|
|
|
backgroundColor: |
|
|
|
userAddressId === address?.id |
|
|
|
userAddressId === address?.id |
|
|
|
? Colors.theme1[colorScheme].greenCF + "15" |
|
|
|
? Colors.theme1[theme].greenCF + "15" |
|
|
|
: Colors.theme1[colorScheme].grayE3 + "44", |
|
|
|
: Colors.theme1[theme].grayE3 + "44", |
|
|
|
borderWidth: 1.5, |
|
|
|
borderWidth: 1.5, |
|
|
|
borderColor: |
|
|
|
borderColor: |
|
|
|
userAddressId === address?.id |
|
|
|
userAddressId === address?.id |
|
|
|
? Colors.theme1[colorScheme].greenCF |
|
|
|
? Colors.theme1[theme].greenCF |
|
|
|
: Colors.theme1[colorScheme].grayE3, |
|
|
|
: Colors.theme1[theme].grayE3, |
|
|
|
}, |
|
|
|
}, |
|
|
|
tw( |
|
|
|
tw( |
|
|
|
`flex flex-row-reverse items-center w-full px-3 rounded-sm mt-2 ${mobile ? "py-2" : "py-4"}` |
|
|
|
`flex flex-row-reverse items-center w-full px-3 rounded-sm mt-2 ${mobile ? "py-2" : "py-4"}` |
|
|
@ -51,7 +49,7 @@ const Address = ({ addresses, update, userId, userAddressId, loading, mobile }) |
|
|
|
{loading && userAddressId !== address?.id ? ( |
|
|
|
{loading && userAddressId !== address?.id ? ( |
|
|
|
<ActivityIndicator |
|
|
|
<ActivityIndicator |
|
|
|
size="small" |
|
|
|
size="small" |
|
|
|
color={Colors.theme1[colorScheme].greenC8} |
|
|
|
color={Colors.theme1[theme].greenC8} |
|
|
|
/> |
|
|
|
/> |
|
|
|
) : ( |
|
|
|
) : ( |
|
|
|
<View |
|
|
|
<View |
|
|
@ -59,13 +57,13 @@ const Address = ({ addresses, update, userId, userAddressId, loading, mobile }) |
|
|
|
tw("w-5 h-5 rounded-full"), |
|
|
|
tw("w-5 h-5 rounded-full"), |
|
|
|
{ |
|
|
|
{ |
|
|
|
backgroundColor: active |
|
|
|
backgroundColor: active |
|
|
|
? Colors.theme1[colorScheme].greenCF |
|
|
|
? Colors.theme1[theme].greenCF |
|
|
|
: "white", |
|
|
|
: "white", |
|
|
|
borderWidth: userAddressId === address?.id ? 4 : 1, |
|
|
|
borderWidth: userAddressId === address?.id ? 4 : 1, |
|
|
|
borderColor: |
|
|
|
borderColor: |
|
|
|
userAddressId === address?.id |
|
|
|
userAddressId === address?.id |
|
|
|
? Colors.theme1[colorScheme].black |
|
|
|
? Colors.theme1[theme].black |
|
|
|
: Colors.theme1[colorScheme].gray20 + "33", |
|
|
|
: Colors.theme1[theme].gray20 + "33", |
|
|
|
}, |
|
|
|
}, |
|
|
|
]} |
|
|
|
]} |
|
|
|
></View> |
|
|
|
></View> |
|
|
@ -102,8 +100,8 @@ const Address = ({ addresses, update, userId, userAddressId, loading, mobile }) |
|
|
|
<TouchableOpacity |
|
|
|
<TouchableOpacity |
|
|
|
style={[ |
|
|
|
style={[ |
|
|
|
{ |
|
|
|
{ |
|
|
|
backgroundColor: Colors.theme1[colorScheme].grayE3 + "44", |
|
|
|
backgroundColor: Colors.theme1[theme].grayE3 + "44", |
|
|
|
borderColor: Colors.theme1[colorScheme].gray2077 + '55', |
|
|
|
borderColor: Colors.theme1[theme].gray2077 + '55', |
|
|
|
borderWidth: 1.5, |
|
|
|
borderWidth: 1.5, |
|
|
|
}, |
|
|
|
}, |
|
|
|
tw( |
|
|
|
tw( |
|
|
@ -116,7 +114,7 @@ const Address = ({ addresses, update, userId, userAddressId, loading, mobile }) |
|
|
|
style={{ |
|
|
|
style={{ |
|
|
|
fontFamily: "regular", |
|
|
|
fontFamily: "regular", |
|
|
|
fontSize: mobile ? fontSize.sm : fontSize.lg, |
|
|
|
fontSize: mobile ? fontSize.sm : fontSize.lg, |
|
|
|
color: Colors.theme1[colorScheme].gray2077, |
|
|
|
color: Colors.theme1[theme].gray2077, |
|
|
|
}} |
|
|
|
}} |
|
|
|
> |
|
|
|
> |
|
|
|
یک آدرس جدید اضافه کنید |
|
|
|
یک آدرس جدید اضافه کنید |
|
|
@ -125,7 +123,7 @@ const Address = ({ addresses, update, userId, userAddressId, loading, mobile }) |
|
|
|
style={{ |
|
|
|
style={{ |
|
|
|
marginRight: 5, |
|
|
|
marginRight: 5, |
|
|
|
fontSize: mobile ? fontSize.xl : fontSize.xl4, |
|
|
|
fontSize: mobile ? fontSize.xl : fontSize.xl4, |
|
|
|
color: Colors.theme1[colorScheme].gray20, |
|
|
|
color: Colors.theme1[theme].gray20, |
|
|
|
}} |
|
|
|
}} |
|
|
|
> |
|
|
|
> |
|
|
|
+ |
|
|
|
+ |
|
|
@ -139,7 +137,8 @@ const mapStateToProps = (state) => ({ |
|
|
|
userId: state.user.status?.id, |
|
|
|
userId: state.user.status?.id, |
|
|
|
userAddressId: state.userFactor.info?.userAddressId, |
|
|
|
userAddressId: state.userFactor.info?.userAddressId, |
|
|
|
loading: state.userFactor.loading, |
|
|
|
loading: state.userFactor.loading, |
|
|
|
mobile: state.publicApi.mobile |
|
|
|
mobile: state.publicApi.mobile, |
|
|
|
|
|
|
|
theme: state.publicApi.theme |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
const mapDispatchToProps = { |
|
|
|
const mapDispatchToProps = { |
|
|
|