Search code examples
reactjsreact-nativereact-navigationreact-native-firebasereact-native-notifications

Is it possible to navigate from app.js with React Navigation?


I am switching over from react-native-router-flux to react-navigation v6.

I have my navigation wired up again for the most part, I am now struggling to navigate from app.js. I navigate from here only to handle notification navigation.

It seems like you can only access the navigation prop from screens that are stacks. I tried to add app.js to a stack but that did not work either...

I also tried the hook useNavigation() but I was not able to because app.js is a class component...

This was easy and out of the box with RNRF, is there something I am missing here with React Navigation v6?


Solution

  • Navigating to screens with no access to navigation props using createNavigationContainerRef. More details (Added this to answer section from my comment)