簡體   English   中英

react native,如何在 react-native-country-picker-modal 中顯示標志

[英]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.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM