Skip to content

Commit

Permalink
add listener remove
Browse files Browse the repository at this point in the history
  • Loading branch information
layacat committed Feb 1, 2025
1 parent f327ed0 commit f7ce198
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/hooks/useSearchBackPress/index.android.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ const useSearchBackPress: UseSearchBackPress = ({onClearSelection, onNavigationC
onNavigationCallBack();
return false;
};
BackHandler.addEventListener('hardwareBackPress', onBackPress);
return () => BackHandler.removeEventListener('hardwareBackPress', onBackPress);
const backHandler = BackHandler.addEventListener('hardwareBackPress', onBackPress);
return () => backHandler.remove();
}, [selectionMode, onClearSelection, onNavigationCallBack]),
);
};
Expand Down

0 comments on commit f7ce198

Please sign in to comment.