'React native, Firebase notification quit state listener re-fire after refreshing app

I'm using React native 0.65.1 and "@react-native-firebase/messaging": "12.8.0", and have messaging().getInitialNotification() listener for cases that the app opened from quit state by notification. Besides that, I have multiple languages in the app, and in case a user changes his language from RTL to LTR (or the other way around...), I'm calling

import RNRestart from 'react-native-restart'

RNRestart.Restart()

The problem is, that in case the user started the current session of the app (only from a quit state) by a notification, if he will change the language in the same session in a way that causes refresh, the getInitialNotification listener will be fired again (with navigation or UI manipulation that's not needed). Searched through the docs if there's any way to delete a message after the first time of listener runs, couldn't find any, and don't have any other idea how to encounter this issue (open as well for a suggestion on how to fix it from the other end of Restart, if someone has an idea how to switch from RTL to LTR in another way or with equivalent method/library that won't cause this issue).

(onNotificationOpenedApp (from background state) and onMessage (on foreground state) don't create this issue...)

Thanks in advance :)



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source