instabug-reactnative
Version:
React Native plugin for integrating the Instabug SDK
17 lines (16 loc) • 517 B
JavaScript
import { AppState } from 'react-native';
let subscription = null;
// Register the event listener manually
export const addAppStateListener = (handleAppStateChange) => {
if (!subscription) {
subscription = AppState.addEventListener('change', handleAppStateChange);
}
};
// Unregister the event listener manually
//todo: find where to Unregister appState listener
export const removeAppStateListener = () => {
if (subscription) {
subscription.remove();
subscription = null;
}
};