Notifications do not work with react native navigation v5

Please provide the following:

  1. SDK Version: 39
  2. Platforms(Android/iOS):

When I send a notification to an application developed with Expo, this application is open, the notification arrives and the user clicks on it, he is redirected to the notifications module of the app, however, when the application is closed, when clicking notification, I cannot direct the user to the notifications module.

I am using react navigation v5 to perform navigation in the app.

Here is the excerpt I use to receive the notification:

"export default function App () {
const notificationListener = useRef ();
const responseListener = useRef ();

const handleNotification = notification => {
store.dispatch (NotificacoesActions.notificacoesCheckRequest (notification));
}
useEffect (() => {
notificationListener.current = Notifications.addNotificationReceivedListener (notification => {
console.log (‘Received notification:’, notification);
});
responseListener.current = Notifications.addNotificationResponseReceivedListener (handleNotification);
return () => {
Notifications.removeNotificationSubscription (notificationListener);
Notifications.removeNotificationSubscription (responseListener);
};
}, );
}"

And the section used in redux-Saga to perform the navigation:

“function* handleNotification({ notification }) {
const notificacao = notification.request.content;
const notification_data = JSON.parse(notification.request.content.data.data);
const { usuario_notificacao_id } = notificacao.data;
NavigationService.navigator.navigate(‘Notificacoes’);
NavigationService.navigator.navigate(‘Notificacoes’, {
screen: ‘NotificacoesView’,
params: {
item: notificacao.data
}
});”

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