blob: 2c04f29558e29c2ea06f16e0d63aeaf39f2590a2 (
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
|
/**
* The root navigator is used to switch between major navigation flows of your app.
* Generally speaking, it will contain an auth flow (registration, login, forgot password)
* and a "main" flow (which is contained in your MainNavigator) which the user
* will use once logged in.
*/
import React from "react"
import { NavigationContainer, NavigationContainerRef } from "@react-navigation/native"
import { createStackNavigator } from "@react-navigation/stack"
import { MainNavigator } from "./main-navigator"
import { color } from "../theme"
/**
* 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.
*
* We recommend using MobX-State-Tree store(s) to handle state rather than navigation params.
*
* For more information, see this documentation:
* https://reactnavigation.org/docs/params/
* https://reactnavigation.org/docs/typescript#type-checking-the-navigator
*/
export type RootParamList = {
mainStack: undefined
}
const Stack = createStackNavigator<RootParamList>()
const RootStack = () => {
return (
<Stack.Navigator
screenOptions={{
cardStyle: { backgroundColor: color.palette.deepPurple },
headerShown: false,
}}
>
<Stack.Screen
name="mainStack"
component={MainNavigator}
options={{
headerShown: false,
}}
/>
</Stack.Navigator>
)
}
export const RootNavigator = React.forwardRef<
NavigationContainerRef,
Partial<React.ComponentProps<typeof NavigationContainer>>
>((props, ref) => {
return (
<NavigationContainer {...props} ref={ref}>
<RootStack />
</NavigationContainer>
)
})
RootNavigator.displayName = "RootNavigator"
|