1 | import type { NavigationState, ParamListBase } from '@react-navigation/routers';
|
2 | import type * as React from 'react';
|
3 |
|
4 | import Group from './Group';
|
5 | import Screen from './Screen';
|
6 | import type { EventMapBase, TypedNavigator } from './types';
|
7 |
|
8 |
|
9 |
|
10 |
|
11 |
|
12 |
|
13 |
|
14 |
|
15 | export default function createNavigatorFactory<
|
16 | State extends NavigationState,
|
17 | ScreenOptions extends {},
|
18 | EventMap extends EventMapBase,
|
19 | NavigatorComponent extends React.ComponentType<any>
|
20 | >(Navigator: NavigatorComponent) {
|
21 | return function <ParamList extends ParamListBase>(): TypedNavigator<
|
22 | ParamList,
|
23 | State,
|
24 | ScreenOptions,
|
25 | EventMap,
|
26 | typeof Navigator
|
27 | > {
|
28 | if (arguments[0] !== undefined) {
|
29 | throw new Error(
|
30 | "Creating a navigator doesn't take an argument. Maybe you are trying to use React Navigation 4 API? See https://reactnavigation.org/docs/hello-react-navigation for the latest API and guides."
|
31 | );
|
32 | }
|
33 |
|
34 | return {
|
35 | Navigator,
|
36 | Group,
|
37 | Screen,
|
38 | };
|
39 | };
|
40 | }
|