[英]react native, how to show flag in react-native-country-picker-modal
I'm using react-native-country-picker-modal
and I want to show flag when user select a country.我正在使用
react-native-country-picker-modal
并且我想在用户 select 一个国家时显示标志。 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)} />
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.