blob: 095a9bfcdb308e1fe57c53eadb6a31f11758ea4f (
about) (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
|
/**
* This is the navigator you will modify to display the logged-in screens of your app.
* You can use RootNavigator to also display an auth flow or other user flows.
*
* You'll likely spend most of your time in this file.
*/
import React from 'react'
import { createStackNavigator } from '@react-navigation/stack'
import { WelcomeScreen, DemoScreen, DemoListScreen, GraphScreen } from '../screens'
/**
* This type allows TypeScript to know what routes are defined in this navigator
* as well as what properties (if any) they might take when navigating to them.
*
* If no params are allowed, pass through `undefined`. Generally speaking, we
* recommend using your MobX-State-Tree store(s) to keep application state
* rather than passing state through navigation params.
*
* For more information, see this documentation:
* https://reactnavigation.org/docs/params/
* https://reactnavigation.org/docs/typescript#type-checking-the-navigator
*/
export type PrimaryParamList = {
welcome: undefined
demo: undefined
demoList: undefined
graph: undefined
}
// Documentation: https://reactnavigation.org/docs/stack-navigator/
const Stack = createStackNavigator<PrimaryParamList>()
export function MainNavigator() {
return (
<Stack.Navigator
screenOptions={{
cardStyle: { backgroundColor: 'transparent' },
headerShown: false,
}}
>
<Stack.Screen name="graph" component={GraphScreen} />
</Stack.Navigator>
)
}
/**
<Stack.Screen name="welcome" component={WelcomeScreen} />
<Stack.Screen name="demo" component={DemoScreen} />
<Stack.Screen name="demoList" component={DemoListScreen} />
* A list of routes from which we're allowed to leave the app when
* the user presses the back button on Android.
*
* Anything not on this list will be a standard `back` action in
* react-navigation.
*
* `canExit` is used in ./app/app.tsx in the `useBackButtonHandler` hook.
*/
const exitRoutes = ['welcome']
export const canExit = (routeName: string) => exitRoutes.includes(routeName)
|