React Native get navigation object outside screen component

Viewed 2245

I need to be able to navigate and reset navigation stack from modules that are not necessarily screen components. It means, I can't use:

const {navigate} = this.props.navigation;

In my case, I need to properly redirect user to the right screen when he taps on push notification. I only have a callback:

onNotification: function(notification) {
    // show correct screen and reset navigation stack
}

I just need more flexibility with navigation. So how can I do it for my case?

2 Answers
Related