1 | import * as React from 'react';
|
2 | import NavigationContainerRefContext from './NavigationContainerRefContext';
|
3 | import NavigationContext from './NavigationContext';
|
4 |
|
5 |
|
6 |
|
7 |
|
8 |
|
9 |
|
10 | export default function useNavigation() {
|
11 | const root = React.useContext(NavigationContainerRefContext);
|
12 | const navigation = React.useContext(NavigationContext);
|
13 |
|
14 | if (navigation === undefined && root === undefined) {
|
15 | throw new Error("Couldn't find a navigation object. Is your component inside NavigationContainer?");
|
16 | }
|
17 |
|
18 |
|
19 | return navigation !== null && navigation !== void 0 ? navigation : root;
|
20 | }
|
21 |
|
\ | No newline at end of file |