1 | import * as React from 'react';
|
2 | import NavigationRouteContext from './NavigationRouteContext';
|
3 |
|
4 | /**
|
5 | * Hook to access the route prop of the parent screen anywhere.
|
6 | *
|
7 | * @returns Route prop of the parent screen.
|
8 | */
|
9 | export default function useRoute() {
|
10 | const route = React.useContext(NavigationRouteContext);
|
11 |
|
12 | if (route === undefined) {
|
13 | throw new Error("Couldn't find a route object. Is your component inside a screen in a navigator?");
|
14 | }
|
15 |
|
16 | return route;
|
17 | }
|
18 | //# sourceMappingURL=useRoute.js.map |
\ | No newline at end of file |