Closed viv-eak closed 3 years ago
still having the same issue.
as per docs preferredCountries: CountryCode preferred countries they appear first (withAlphaFilter must be false) :(
same issue
I noticed the same thing. The prop works, but it doesn't update after the component has been mounted.
A bit of a hacky solution is to add the prop key
with something like key={'countryPicker-'+countryCode}
(or whatever is being added to preferedCountries), which forces the component to re-render whenever said value updates. I'm using that to show the chosen country at the top :)
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
Issue Description
I want to use preferredCountries prop but it is not working.
Steps to Reproduce / Code Snippets
<CountryPicker theme={dark ? DARK_THEME : {}} {...{ countryCode, withFilter, withFlag, withCallingCodeButton, withAlphaFilter: false, withCallingCode, onSelect, preferredCountries: ['US'], modalProps: { visible, }, onClose: () => setVisible(false), onOpen: () => setVisible(true), containerButtonStyle: { paddingVertical: 0, }, }} />
Expected Results
It should add Us at the top.
Additional Information