aboutsummaryrefslogtreecommitdiff
path: root/src/RootNavigation.ts
blob: 827177a302ce7f86edb43aff1bba569824e7be9a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
import {NavigationContainerRef} from '@react-navigation/native';
import * as React from 'react';

export const navigationRef: React.RefObject<NavigationContainerRef> = React.createRef();

export function navigate(name: string) {
  if (navigationRef.current) {
    // Perform navigation if the app has mounted
    //console.log('Reached root navigation');
    navigationRef.current.navigate(name);
  } else {
    // TODO: Decide what to do if the app hasn't mounted
    // Ignore this, or add these actions to a queue you can call later
  }
}