diff --git a/src/CountryPicker.tsx b/src/CountryPicker.tsx index 74bf018a..35494753 100644 --- a/src/CountryPicker.tsx +++ b/src/CountryPicker.tsx @@ -115,6 +115,13 @@ export const CountryPicker = (props: CountryPickerProps) => { }) const { translation, getCountriesAsync } = useContext() const { visible, filter, countries, filterFocus } = state + + useEffect(() => { + if (state.visible !== props.visible) { + setState({ ...state, visible: props.visible }); + } + }, [props.visible]) + const onOpen = () => { setState({ ...state, visible: true }) if (handleOpen) {