I am making a react native app with oneSignal push notifications. I would like to just change the screen when a notification is received. I can do this if the app is in the foreground or if the notification was clicked. How would I trigger this if the app is closed or in the background?
import OneSignal from 'react-native-onesignal';
export default class Test extends Component {
componentWillMount() {
OneSignal.addEventListener('received', this.onReceived);
OneSignal.addEventListener('opened', this.onOpened);
OneSignal.addEventListener('registered', this.onRegistered);
OneSignal.addEventListener('ids', this.onIds);
}