Expo PUSH Notification handle app state

Please provide the following:

  1. SDK Version:38
  2. Platforms(Android/iOS/web/all): all

i have an app build in react native using expo. i would like to check the state of the app when receiving a notification. For example, if app is active show an alert that gives the option to user goes to detail screen and if the app is in background or closed, the notificaiton open the app and goes directly to the Detail Screen.

const _handleNotification = (notification) => {


        const {data}= notification||{}
        const {id} = data ||{}
        if(AppState.currentState==="active"){
            setnotificationId(id);
            setShowingSnackBar(true);
            dissmissSnack();
        }else{
            if(id){
                navigation.navigate('Detail', {id, onSelect},)
            }
        }
    };

the problem is when i receive the notification with the app closed, click in it, it will open the app but the AppState.currenteState is always as Active and dont go directly to the detail screen.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.