import { View, Text, Pressable, TouchableOpacity, ActivityIndicator, Platform, } from "react-native"; import React from "react"; import { connect } from "react-redux"; import { useNavigation } from "@react-navigation/native"; import { userFactor } from "../../../redux/actions"; //style import tw from "tailwind-rn"; import Colors from "../../../constants/Colors"; import fontSize from "../../../constants/fontSize"; const ios = Platform.OS === "ios"; const Address = ({ addresses, update, userId, userAddressId, loading, mobile, theme, }) => { const navigation = useNavigation(); const Location = ({ address, active }) => { return ( userAddressId === address?.id ? {} : update({ userAddressId: address.id, userId }) } > {loading ? ( userAddressId !== address?.id ? ( ) : ( ) ) : null} {address.address} ); }; const light = React.useMemo(() => { return theme === 'light'; },[theme]); return ( {addresses.map((address, index) => ( ))} navigation.push("CreateAddress")} > یک آدرس جدید اضافه کنید + ); }; const mapStateToProps = (state) => ({ userId: state.user.status?.id, userAddressId: state.userFactor.info?.userAddressId, loading: state.userFactor.loading, mobile: state.publicApi.mobile, theme: state.publicApi.theme, }); const mapDispatchToProps = { update: userFactor.update, }; export default connect(mapStateToProps, mapDispatchToProps)(Address);