Skip to main content

BackHandler

Android-only API to listen to the hardware back button.

Methods

exitApp

exitApp: unit => unit

addEventListener

addEventListener: ([#hardwareBackPress], unit => nullable<bool>) => {remove: unit => unit}

Return Nullable.make(true) from the handler to prevent the default back behavior.

React.useEffect0(() => {
let subscription = BackHandler.addEventListener(#hardwareBackPress, () => {
// handle back...
Nullable.make(true)
})
Some(() => subscription.remove())
})