Datetimepicker: Hide the picker while the app is running in the background / inactive

Created on 16 Sep 2020  路  4Comments  路  Source: react-native-datetimepicker/datetimepicker

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

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

All 4 comments

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)

Was this page helpful?
0 / 5 - 0 ratings

Related issues

danlugo92 picture danlugo92  路  5Comments

yesIamFaded picture yesIamFaded  路  5Comments

alxvallejo picture alxvallejo  路  6Comments

StarryFire picture StarryFire  路  3Comments

nabati picture nabati  路  3Comments