const appState = useAppState()
const [show, setShow] = useState(false)
useEffect(() => {
if (appState.match(/inactive|background/)) {
setShow(false)
}
}, [appState])
The state changes correctly, but hiding the picker is terminated when the app is going on to the background
There is likely a general problem with hiding a picker without clicking on the buttons (Cancel / OK)
EDIT: This multitasking may conflict with e.g. entering a PIN code
I had a similar issue a while ago. However, I could not find a proper solution. Here is my question on stackoverflow:
https://stackoverflow.com/questions/55604706/how-to-close-android-datepicker-in-react-native
I am thinking about writing a pure js datepicker component.
All I had to do was put the PIN Code view in the native modal to cover the calendar, but that was my case
@pavermakov Unfortunately in this version value of the instance is undefined (by ref)
Most helpful comment
There is likely a general problem with hiding a picker without clicking on the buttons (Cancel / OK)
EDIT: This multitasking may conflict with e.g. entering a PIN code