diff options
author | Shravya Ramesh <37447613+shravyaramesh@users.noreply.github.com> | 2021-01-02 07:41:03 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-01-02 10:41:03 -0500 |
commit | ecd10fc394f2d2b6be08cee55f7b9a75ab276ac7 (patch) | |
tree | 648fbb34a9ae74c96efd285db4a272f53095fc57 /src/RootNavigation.ts | |
parent | 75d5e910767f531e8261d5fd70ad427214599102 (diff) |
[TMA-294] Redirecting to Notification Screen (#161)
* Added nav ref & redirect to notifScreen onTap
* Added type NavigationContainerRef
Co-authored-by: Ashm Walia <ashmwalia@outlook.com>
Diffstat (limited to 'src/RootNavigation.ts')
-rw-r--r-- | src/RootNavigation.ts | 15 |
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 + } +} |