Fix useAndroidHardwareBackHandler hook
This commit is contained in:
parent
8795ca85b5
commit
c43e506a76
1 changed files with 2 additions and 2 deletions
|
|
@ -4,12 +4,12 @@
|
|||
import {EffectCallback, useEffect} from 'react';
|
||||
import {BackHandler} from 'react-native';
|
||||
|
||||
import EphemeralStore from '@store/ephemeral_store';
|
||||
import NavigationStore from '@store/navigation_store';
|
||||
|
||||
const useAndroidHardwareBackHandler = (componentId: string, callback: EffectCallback) => {
|
||||
useEffect(() => {
|
||||
const backHandler = BackHandler.addEventListener('hardwareBackPress', () => {
|
||||
if (EphemeralStore.getNavigationTopComponentId() === componentId) {
|
||||
if (NavigationStore.getNavigationTopComponentId() === componentId) {
|
||||
callback();
|
||||
return true;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue