|
|
|
@ -3,7 +3,6 @@ import { |
|
|
|
|
Text, |
|
|
|
|
Pressable, |
|
|
|
|
TouchableOpacity, |
|
|
|
|
Appearance, |
|
|
|
|
ActivityIndicator, |
|
|
|
|
Platform |
|
|
|
|
} from "react-native"; |
|
|
|
@ -19,8 +18,7 @@ import fontSize from "../../../constants/fontSize"; |
|
|
|
|
|
|
|
|
|
const ios = Platform.OS === "ios"; |
|
|
|
|
|
|
|
|
|
const Address = ({ addresses, update, userId, userAddressId, loading, mobile }) => { |
|
|
|
|
const colorScheme = Appearance.getColorScheme(); |
|
|
|
|
const Address = ({ addresses, update, userId, userAddressId, loading, mobile, theme }) => { |
|
|
|
|
const navigation = useNavigation(); |
|
|
|
|
|
|
|
|
|
const Location = ({ address, active }) => { |
|
|
|
@ -30,13 +28,13 @@ const Address = ({ addresses, update, userId, userAddressId, loading, mobile }) |
|
|
|
|
{ |
|
|
|
|
backgroundColor: |
|
|
|
|
userAddressId === address?.id |
|
|
|
|
? Colors.theme1[colorScheme].greenCF + "15" |
|
|
|
|
: Colors.theme1[colorScheme].grayE3 + "44", |
|
|
|
|
? Colors.theme1[theme].greenCF + "15" |
|
|
|
|
: Colors.theme1[theme].grayE3 + "44", |
|
|
|
|
borderWidth: 1.5, |
|
|
|
|
borderColor: |
|
|
|
|
userAddressId === address?.id |
|
|
|
|
? Colors.theme1[colorScheme].greenCF |
|
|
|
|
: Colors.theme1[colorScheme].grayE3, |
|
|
|
|
? Colors.theme1[theme].greenCF |
|
|
|
|
: Colors.theme1[theme].grayE3, |
|
|
|
|
}, |
|
|
|
|
tw( |
|
|
|
|
`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 ? ( |
|
|
|
|
<ActivityIndicator |
|
|
|
|
size="small" |
|
|
|
|
color={Colors.theme1[colorScheme].greenC8} |
|
|
|
|
color={Colors.theme1[theme].greenC8} |
|
|
|
|
/> |
|
|
|
|
) : ( |
|
|
|
|
<View |
|
|
|
@ -59,13 +57,13 @@ const Address = ({ addresses, update, userId, userAddressId, loading, mobile }) |
|
|
|
|
tw("w-5 h-5 rounded-full"), |
|
|
|
|
{ |
|
|
|
|
backgroundColor: active |
|
|
|
|
? Colors.theme1[colorScheme].greenCF |
|
|
|
|
? Colors.theme1[theme].greenCF |
|
|
|
|
: "white", |
|
|
|
|
borderWidth: userAddressId === address?.id ? 4 : 1, |
|
|
|
|
borderColor: |
|
|
|
|
userAddressId === address?.id |
|
|
|
|
? Colors.theme1[colorScheme].black |
|
|
|
|
: Colors.theme1[colorScheme].gray20 + "33", |
|
|
|
|
? Colors.theme1[theme].black |
|
|
|
|
: Colors.theme1[theme].gray20 + "33", |
|
|
|
|
}, |
|
|
|
|
]} |
|
|
|
|
></View> |
|
|
|
@ -102,8 +100,8 @@ const Address = ({ addresses, update, userId, userAddressId, loading, mobile }) |
|
|
|
|
<TouchableOpacity |
|
|
|
|
style={[ |
|
|
|
|
{ |
|
|
|
|
backgroundColor: Colors.theme1[colorScheme].grayE3 + "44", |
|
|
|
|
borderColor: Colors.theme1[colorScheme].gray2077 + '55', |
|
|
|
|
backgroundColor: Colors.theme1[theme].grayE3 + "44", |
|
|
|
|
borderColor: Colors.theme1[theme].gray2077 + '55', |
|
|
|
|
borderWidth: 1.5, |
|
|
|
|
}, |
|
|
|
|
tw( |
|
|
|
@ -116,7 +114,7 @@ const Address = ({ addresses, update, userId, userAddressId, loading, mobile }) |
|
|
|
|
style={{ |
|
|
|
|
fontFamily: "regular", |
|
|
|
|
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={{ |
|
|
|
|
marginRight: 5, |
|
|
|
|
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, |
|
|
|
|
userAddressId: state.userFactor.info?.userAddressId, |
|
|
|
|
loading: state.userFactor.loading, |
|
|
|
|
mobile: state.publicApi.mobile |
|
|
|
|
mobile: state.publicApi.mobile, |
|
|
|
|
theme: state.publicApi.theme |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
const mapDispatchToProps = { |
|
|
|
|