1import { BottomTabNavigationProp } from '@react-navigation/bottom-tabs';
2import { DrawerNavigationOptions } from '@react-navigation/drawer';
3import { PathConfig } from '@react-navigation/native';
4import { StackNavigationOptions } from '@react-navigation/stack';
5
6import ExpoApisStackNavigator, { Screens as APIScreens } from './ExpoApisStackNavigator';
7import ExpoComponentsStackNavigator, {
8  Screens as ComponentScreens,
9} from './ExpoComponentsStackNavigator';
10
11// @tsapeta: These navigators are being used by `bare-expo` app,
12// so make sure they still work there once you change something here.
13
14type ScreenConfig = {
15  linking: PathConfig;
16  navigator: ((props: { navigation: BottomTabNavigationProp<any> }) => JSX.Element) & {
17    navigationOptions: StackNavigationOptions & DrawerNavigationOptions;
18  };
19};
20
21const apis: ScreenConfig = {
22  linking: {
23    path: '/apis',
24    initialRouteName: 'ExpoApis',
25    screens: {
26      ExpoApis: '',
27      ...APIScreens.reduce(
28        (prev, curr) => ({
29          ...prev,
30          [curr.name]: curr.name.toLowerCase(),
31        }),
32        {}
33      ),
34    },
35  },
36  navigator: ExpoApisStackNavigator,
37};
38
39const components = {
40  linking: {
41    path: '/components',
42    initialRouteName: 'ExpoComponents',
43    screens: {
44      ExpoComponents: '',
45      ...ComponentScreens.reduce(
46        (prev, curr) => ({
47          ...prev,
48          [curr.name]: curr.route || curr.name.toLowerCase(),
49        }),
50        {}
51      ),
52    },
53  },
54  navigator: ExpoComponentsStackNavigator,
55};
56
57export default {
58  apis,
59  components,
60};
61