blob: feb9284580b96049f44770739294157119b43ac8 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
|
import {BackHandler} from 'react-native'
import {RootStoreModel} from 'state/index'
export function onBack(cb: () => boolean): () => void {
const subscription = BackHandler.addEventListener('hardwareBackPress', cb)
return () => subscription.remove()
}
export function init(store: RootStoreModel) {
onBack(() => store.shell.closeAnyActiveElement())
}
|