-
Notifications
You must be signed in to change notification settings - Fork 17
/
Routes.js
168 lines (160 loc) · 4.33 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
import React from 'react';
import { NavigationNativeContainer } from '@react-navigation/native';
import { Text } from 'react-native';
import { createStackNavigator, TransitionPresets, HeaderStyleInterpolators } from '@react-navigation/stack';
import { connect } from 'react-redux';
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 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 PostsEditScreen from './components/Posts/EditScreen';
import MediaEditScreen from './components/Media/EditScreen';
import ProfileButton from './components/Sites/ProfileButton.js';
const defaultOptions = {
cardStyle: {
backgroundColor: 'white',
borderTopWidth: 0,
shadowRadius: 0,
shadowOffset: {
height: 0,
},
shadowColor: 'transparent',
},
headerStyle: {
shadowOpacity: 0,
},
headerStyleInterpolator: HeaderStyleInterpolators.forUIKit,
};
const Main = createStackNavigator();
const Root = createStackNavigator();
const MainStack = () => {
const PostTitle = connect( ( state, props ) => ( { ...state.sites[state.activeSite.id].data.types[props.route.params.type] } ) )( props => {
return <Text>{ props.name }</Text>;
} );
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 : '',
headerRight: () => {
return <ProfileButton />;
},
} ) }
/>
<Main.Screen name="SitesReauth" component={ SitesReauth } />
<Main.Screen
name="PostsList"
component={ PostsList }
options={ ( { route } ) => ( {
title: <PostTitle route={ route } />,
} ) }
/>
<Main.Screen
name="PostsEdit"
component={ PostsEditScreen }
/>
<Main.Screen
name="PostsAdd"
component={ PostsEditScreen }
/>
<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="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() {
return (
<NavigationNativeContainer>
<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.Screen name="UsersEdit" component={ UsersEdit } />
<Root.Screen
name="MediaEdit"
component={ MediaEditScreen }
options={ {
title: 'Edit Media',
} }
/>
</Root.Navigator>
</NavigationNativeContainer>
);
}