-
Notifications
You must be signed in to change notification settings - Fork 17
/
Copy pathRoutes.js
179 lines (172 loc) · 4.25 KB
/
Routes.js
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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
import React from 'react';
import { NavigationNativeContainer } from '@react-navigation/native';
import { createStackNavigator, TransitionPresets, HeaderStyleInterpolators } from '@react-navigation/stack';
import SitesList from './containers/Sites/List';
import SitesAdd from './containers/Sites/Add';
import SitesReauth from './containers/Sites/Reauth';
import PostsList from './containers/Posts/List';
import PostsEdit from './containers/Posts/Edit';
import PostsAdd from './containers/Posts/Add';
import TermsEdit from './containers/Terms/Edit';
import TermsAdd from './containers/Terms/Add';
import TermsList from './containers/Terms/List';
import UsersList from './containers/Users/List';
import UsersEdit from './containers/Users/Edit';
import UsersAdd from './containers/Users/Add';
import UsersSelect from './containers/Users/Select';
import CommentsList from './containers/Comments/List';
import SitesView from './containers/Sites/View';
import SettingsList from './containers/Settings/List';
import CommentsEdit from './containers/Comments/Edit';
import { getBrandColor, getSemanticColor } from './theme';
const defaultOptions = {
cardStyle: {
backgroundColor: getSemanticColor( 'systemBackground' ),
},
headerStyleInterpolator: HeaderStyleInterpolators.forUIKit,
};
const Main = createStackNavigator();
const Root = createStackNavigator();
const MainStack = () => {
return (
<Main.Navigator
initialRouteName="SitesList"
screenOptions={ defaultOptions }
>
<Main.Screen
name="SitesList"
component={ SitesList }
options={ {
title: 'Sites',
} }
/>
<Main.Screen
name="SitesView"
component={ SitesView }
options={ ( { route } ) => ( {
title: route.params ? route.params.site.name : '',
} ) }
/>
<Main.Screen
name="SitesReauth"
component={ SitesReauth }
/>
<Main.Screen
name="PostsList"
component={ PostsList }
options={ ( { route } ) => ( {
title: route.params ? route.params.type.name : '',
} ) }
/>
<Main.Screen
name="PostsEdit"
component={ PostsEdit }
options={ ( { route } ) => ( {
title: route.params ? `Edit ${ route.params.type.labels.singular_name }` : '',
} ) }
/>
<Main.Screen
name="PostsAdd"
component={ PostsAdd }
/>
<Main.Screen
name="TermsEdit"
component={ TermsEdit }
options={ ( { route } ) => ( {
title: route.params ? `Edit ${ route.params.taxonomy.labels.singular_name }` : '',
} ) }
/>
<Main.Screen
name="TermsAdd"
component={ TermsAdd }
/>
<Main.Screen
name="TermsList"
component={ TermsList }
options={ ( { route } ) => ( {
title: route.params ? route.params.taxonomy.name : '',
} ) }
/>
<Main.Screen
name="UsersList"
component={ UsersList }
options={ {
title: 'Users',
} }
/>
<Main.Screen
name="UsersAdd"
component={ UsersAdd }
/>
<Main.Screen
name="UsersEdit"
component={ UsersEdit }
/>
<Main.Screen
name="UsersSelect"
component={ UsersSelect }
/>
<Main.Screen
name="CommentsList"
component={ CommentsList }
options={ {
title: 'Comments',
} }
/>
<Main.Screen
name="CommentsEdit"
component={ CommentsEdit }
options={ {
title: 'Edit Comment',
} }
/>
<Main.Screen
name="SettingsList"
component={ SettingsList }
options={ {
title: 'Settings',
} }
/>
</Main.Navigator>
)
}
export default function RootStack() {
const theme = {
dark: false,
colors: {
primary: getBrandColor( 'primary' ),
backgroundColor: getSemanticColor( 'systemBackground' ),
card: getSemanticColor( 'secondarySystemBackground' ),
text: getSemanticColor( 'label' ),
border: getSemanticColor( 'separator' ),
},
};
return (
<NavigationNativeContainer
theme={ theme }
>
<Root.Navigator
headerMode="none"
mode="modal"
screenOptions={ {
...defaultOptions,
...TransitionPresets.ModalPresentationIOS,
cardOverlayEnabled: true,
gestureEnabled: true,
} }
>
<Root.Screen
name="Main"
component={ MainStack }
/>
<Root.Screen
name="SitesAdd"
component={ SitesAdd }
options={ {
title: 'Add New Site',
} }
/>
</Root.Navigator>
</NavigationNativeContainer>
);
}