[英]How To Use Two React Native date Picker modal in same component
[英]react native, how to show flag in react-native-country-picker-modal
我正在使用react-native-country-picker-modal
並且我想在用戶 select 一個國家時顯示標志。 但它不會在屏幕上呈現。 誰能告訴我如何渲染標志? 下面是我的代碼
//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.