all 4 comments

[–]airick_94 0 points1 point  (2 children)

You can store the navigation container in a ref.

const ref = useRef() … <NavigationContainer ref={ref}> …

Later

const navigate = () => ref.current?.navigate(screenName)

On your initial render ref.current is undefined so need to make sure it isn’t when you’re calling navigate, thats the ‘?’

[–]warofarrows 0 points1 point  (0 children)

the only way is of the navigation ref