I'm using react-native-country-picker-modal
and I want to show flag when user select a country. But it's not rendering on screen. Anyone can tell me how to render flag? below is my code
//function to set flag
const countryChange = ({ flag}) => {
setState(state => ({
...state,
flag: flag,
}));
};
....
<Image
source={{uri: flag}}
style={{tintColor: colors.blackColor, width: 28, height: 20}}
/>
....
<CountryPicker
cca2={cca2}
visible={countryPickerModalVisible}
withFlagButton={true}
withFilter
onClose={onCountryPickerModalClose}
onSelect={countryChange}
withFlag
/>
const [withCallingCode, setWithCallingCode] = useState<boolean>(true)
const [withAlphaFilter, setWithAlphaFilter] = useState<boolean>(true)
const [withFilter, setwithFilter] = useState<boolean>(true)
const [countryCode, setCountryCode] = useState('US')
const [visible, setVisible] = useState(false)
<CountryPicker
{...{
countryCode,
withCallingCode,
withAlphaFilter,
withFilter,
onSelect,
}}
modalProps={{
visible: visible
}}
onOpen={() => setVisible(true)}
onClose={() => setVisible(false)} />
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.