aboutsummaryrefslogtreecommitdiff
path: root/src/RootNavigation.ts
diff options
context:
space:
mode:
Diffstat (limited to 'src/RootNavigation.ts')
-rw-r--r--src/RootNavigation.ts15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/RootNavigation.ts b/src/RootNavigation.ts
new file mode 100644
index 00000000..827177a3
--- /dev/null
+++ b/src/RootNavigation.ts
@@ -0,0 +1,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
+ }
+}