We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent d8c20d9 commit 2205407Copy full SHA for 2205407
src/hooks/useAppState.ts
@@ -3,6 +3,9 @@ import { AppState, AppStateStatus } from 'react-native';
3
4
export function useAppState(onChange: (appState: AppStateStatus) => void) {
5
useEffect(() => {
6
- return AppState.addEventListener('change', onChange);
+ AppState.addEventListener('change', onChange);
7
+ return () => {
8
+ AppState.removeEventListener('change', onChange);
9
+ };
10
}, [onChange]);
11
}
0 commit comments