react-native-appstate-emitter-listener
v0.1.2
Published
Listen to Appstate change
Downloads
3
Readme
react-native-appstate-emitter-listener
Listen to Appstate change
Installation
npm install react-native-appstate-emitter-listener
Usage
import {
addEventListener,
initActivityListener,
} from 'react-native-appstate-emitter-listener';
// ...
//To init android activity listener
initActivityListener();
//listenable states are: 'change' | 'activityChange' | 'window'
addEventListener('change', (e) => {
console.log('state changed:', e);
setState(e.state);
});
Contributing
See the contributing guide to learn how to contribute to the repository and the development workflow.
License
MIT
Made with create-react-native-library