xcarpentier / react-native-country-picker-modal

🇦🇶 Country picker provides a modal allowing a user to select a country from a list. It display a flag next to each country name.
https://reactnative.gallery/xcarpentier/country-picker
MIT License
1.07k stars 796 forks source link

Emoji Flag Cropped #477

Open AhmadNaeemK opened 2 years ago

AhmadNaeemK commented 2 years ago

Issue Description

Flag get cropped when flagSize = 100 is passed.

Steps to Reproduce / Code Snippets

Screenshot 2022-06-27 at 1 26 16 PM

Expected Results

Screenshot 2022-06-27 at 1 27 46 PM

AhmadNaeemK commented 2 years ago

The issue is happening on ios and can be fixed by putting width styling in the EmojiFlag component

const EmojiFlag = memo(({ countryCode, flagSize }: FlagType) => {
  const { getEmojiFlagAsync } = useContext()
  const asyncResult = useAsync(getEmojiFlagAsync, [countryCode])

  if (asyncResult.loading) {
    return <ActivityIndicator size={'small'} />
  }
  return (
    <Text
      style={[styles.emojiFlag, {width: flagSize}, { fontSize: flagSize }]}
      allowFontScaling={false}
    >
      <Emoji {...{ name: asyncResult.result! }} />
    </Text>
  )
})