Browse Source

Improve navigators to match linter

Arnaud Vergnet 1 year ago
parent
commit
3e4f2f4ac1
2 changed files with 457 additions and 409 deletions
  1. 208
    181
      src/navigation/MainNavigator.js
  2. 249
    228
      src/navigation/TabNavigator.js

+ 208
- 181
src/navigation/MainNavigator.js View File

@@ -1,204 +1,231 @@
1 1
 // @flow
2 2
 
3 3
 import * as React from 'react';
4
+import {createStackNavigator, TransitionPresets} from '@react-navigation/stack';
5
+import i18n from 'i18n-js';
6
+import {Platform} from 'react-native';
4 7
 import SettingsScreen from '../screens/Other/Settings/SettingsScreen';
5 8
 import AboutScreen from '../screens/About/AboutScreen';
6 9
 import AboutDependenciesScreen from '../screens/About/AboutDependenciesScreen';
7 10
 import DebugScreen from '../screens/About/DebugScreen';
8
-import {createStackNavigator, TransitionPresets} from "@react-navigation/stack";
9
-import i18n from "i18n-js";
10
-import TabNavigator from "./TabNavigator";
11
-import GameMainScreen from "../screens/Game/screens/GameMainScreen";
12
-import VoteScreen from "../screens/Amicale/VoteScreen";
13
-import LoginScreen from "../screens/Amicale/LoginScreen";
14
-import {Platform} from "react-native";
15
-import SelfMenuScreen from "../screens/Services/SelfMenuScreen";
16
-import ProximoMainScreen from "../screens/Services/Proximo/ProximoMainScreen";
17
-import ProximoListScreen from "../screens/Services/Proximo/ProximoListScreen";
18
-import ProximoAboutScreen from "../screens/Services/Proximo/ProximoAboutScreen";
19
-import ProfileScreen from "../screens/Amicale/ProfileScreen";
20
-import ClubListScreen from "../screens/Amicale/Clubs/ClubListScreen";
21
-import ClubAboutScreen from "../screens/Amicale/Clubs/ClubAboutScreen";
22
-import ClubDisplayScreen from "../screens/Amicale/Clubs/ClubDisplayScreen";
23
-import {createScreenCollapsibleStack, getWebsiteStack} from "../utils/CollapsibleUtils";
24
-import BugReportScreen from "../screens/Other/FeedbackScreen";
25
-import WebsiteScreen from "../screens/Services/WebsiteScreen";
26
-import EquipmentScreen from "../screens/Amicale/Equipment/EquipmentListScreen";
27
-import EquipmentLendScreen from "../screens/Amicale/Equipment/EquipmentRentScreen";
28
-import EquipmentConfirmScreen from "../screens/Amicale/Equipment/EquipmentConfirmScreen";
29
-import DashboardEditScreen from "../screens/Other/Settings/DashboardEditScreen";
30
-import GameStartScreen from "../screens/Game/screens/GameStartScreen";
11
+import TabNavigator from './TabNavigator';
12
+import GameMainScreen from '../screens/Game/screens/GameMainScreen';
13
+import VoteScreen from '../screens/Amicale/VoteScreen';
14
+import LoginScreen from '../screens/Amicale/LoginScreen';
15
+import SelfMenuScreen from '../screens/Services/SelfMenuScreen';
16
+import ProximoMainScreen from '../screens/Services/Proximo/ProximoMainScreen';
17
+import ProximoListScreen from '../screens/Services/Proximo/ProximoListScreen';
18
+import ProximoAboutScreen from '../screens/Services/Proximo/ProximoAboutScreen';
19
+import ProfileScreen from '../screens/Amicale/ProfileScreen';
20
+import ClubListScreen from '../screens/Amicale/Clubs/ClubListScreen';
21
+import ClubAboutScreen from '../screens/Amicale/Clubs/ClubAboutScreen';
22
+import ClubDisplayScreen from '../screens/Amicale/Clubs/ClubDisplayScreen';
23
+import {
24
+  createScreenCollapsibleStack,
25
+  getWebsiteStack,
26
+} from '../utils/CollapsibleUtils';
27
+import BugReportScreen from '../screens/Other/FeedbackScreen';
28
+import WebsiteScreen from '../screens/Services/WebsiteScreen';
29
+import EquipmentScreen from '../screens/Amicale/Equipment/EquipmentListScreen';
30
+import EquipmentLendScreen from '../screens/Amicale/Equipment/EquipmentRentScreen';
31
+import EquipmentConfirmScreen from '../screens/Amicale/Equipment/EquipmentConfirmScreen';
32
+import DashboardEditScreen from '../screens/Other/Settings/DashboardEditScreen';
33
+import GameStartScreen from '../screens/Game/screens/GameStartScreen';
31 34
 
32
-const modalTransition = Platform.OS === 'ios' ? TransitionPresets.ModalPresentationIOS : TransitionPresets.ModalSlideFromBottomIOS;
35
+const modalTransition =
36
+  Platform.OS === 'ios'
37
+    ? TransitionPresets.ModalPresentationIOS
38
+    : TransitionPresets.ModalSlideFromBottomIOS;
33 39
 
34 40
 const defaultScreenOptions = {
35
-    gestureEnabled: true,
36
-    cardOverlayEnabled: true,
37
-    ...TransitionPresets.SlideFromRightIOS,
41
+  gestureEnabled: true,
42
+  cardOverlayEnabled: true,
43
+  ...TransitionPresets.SlideFromRightIOS,
38 44
 };
39 45
 
40
-
41 46
 const MainStack = createStackNavigator();
42 47
 
43
-function MainStackComponent(props: { createTabNavigator: () => React.Node }) {
44
-    return (
45
-        <MainStack.Navigator
46
-            initialRouteName={'main'}
47
-            headerMode={'screen'}
48
-            screenOptions={defaultScreenOptions}
49
-        >
50
-            <MainStack.Screen
51
-                name="main"
52
-                component={props.createTabNavigator}
53
-                options={{
54
-                    headerShown: false,
55
-                    title: i18n.t('screens.home.title'),
56
-                }}
57
-            />
58
-            {createScreenCollapsibleStack(
59
-                "settings",
60
-                MainStack,
61
-                SettingsScreen,
62
-                i18n.t('screens.settings.title'))}
63
-            {createScreenCollapsibleStack(
64
-                "dashboard-edit",
65
-                MainStack,
66
-                DashboardEditScreen,
67
-                i18n.t('screens.settings.dashboardEdit.title'))}
68
-            {createScreenCollapsibleStack(
69
-                "about",
70
-                MainStack,
71
-                AboutScreen,
72
-                i18n.t('screens.about.title'))}
73
-            {createScreenCollapsibleStack(
74
-                "dependencies",
75
-                MainStack,
76
-                AboutDependenciesScreen,
77
-                i18n.t('screens.about.libs'))}
78
-            {createScreenCollapsibleStack(
79
-                "debug",
80
-                MainStack,
81
-                DebugScreen,
82
-                i18n.t('screens.about.debug'))}
83
-
84
-            {createScreenCollapsibleStack(
85
-                "game-start",
86
-                MainStack,
87
-                GameStartScreen,
88
-                i18n.t('screens.game.title'))}
89
-            <MainStack.Screen
90
-                name="game-main"
91
-                component={GameMainScreen}
92
-                options={{
93
-                    title: i18n.t("screens.game.title"),
94
-                }}
95
-            />
96
-            {createScreenCollapsibleStack(
97
-                "login",
98
-                MainStack,
99
-                LoginScreen,
100
-                i18n.t('screens.login.title'),
101
-                true,
102
-                {headerTintColor: "#fff"},
103
-                'transparent')}
104
-            {getWebsiteStack("website", MainStack, WebsiteScreen, "")}
48
+function MainStackComponent(props: {
49
+  createTabNavigator: () => React.Node,
50
+}): React.Node {
51
+  const {createTabNavigator} = props;
52
+  return (
53
+    <MainStack.Navigator
54
+      initialRouteName="main"
55
+      headerMode="screen"
56
+      screenOptions={defaultScreenOptions}>
57
+      <MainStack.Screen
58
+        name="main"
59
+        component={createTabNavigator}
60
+        options={{
61
+          headerShown: false,
62
+          title: i18n.t('screens.home.title'),
63
+        }}
64
+      />
65
+      {createScreenCollapsibleStack(
66
+        'settings',
67
+        MainStack,
68
+        SettingsScreen,
69
+        i18n.t('screens.settings.title'),
70
+      )}
71
+      {createScreenCollapsibleStack(
72
+        'dashboard-edit',
73
+        MainStack,
74
+        DashboardEditScreen,
75
+        i18n.t('screens.settings.dashboardEdit.title'),
76
+      )}
77
+      {createScreenCollapsibleStack(
78
+        'about',
79
+        MainStack,
80
+        AboutScreen,
81
+        i18n.t('screens.about.title'),
82
+      )}
83
+      {createScreenCollapsibleStack(
84
+        'dependencies',
85
+        MainStack,
86
+        AboutDependenciesScreen,
87
+        i18n.t('screens.about.libs'),
88
+      )}
89
+      {createScreenCollapsibleStack(
90
+        'debug',
91
+        MainStack,
92
+        DebugScreen,
93
+        i18n.t('screens.about.debug'),
94
+      )}
105 95
 
96
+      {createScreenCollapsibleStack(
97
+        'game-start',
98
+        MainStack,
99
+        GameStartScreen,
100
+        i18n.t('screens.game.title'),
101
+      )}
102
+      <MainStack.Screen
103
+        name="game-main"
104
+        component={GameMainScreen}
105
+        options={{
106
+          title: i18n.t('screens.game.title'),
107
+        }}
108
+      />
109
+      {createScreenCollapsibleStack(
110
+        'login',
111
+        MainStack,
112
+        LoginScreen,
113
+        i18n.t('screens.login.title'),
114
+        true,
115
+        {headerTintColor: '#fff'},
116
+        'transparent',
117
+      )}
118
+      {getWebsiteStack('website', MainStack, WebsiteScreen, '')}
106 119
 
107
-            {createScreenCollapsibleStack(
108
-                "self-menu",
109
-                MainStack,
110
-                SelfMenuScreen,
111
-                i18n.t('screens.menu.title'))}
112
-            {createScreenCollapsibleStack(
113
-                "proximo",
114
-                MainStack,
115
-                ProximoMainScreen,
116
-                i18n.t('screens.proximo.title'))}
117
-            {createScreenCollapsibleStack(
118
-                "proximo-list",
119
-                MainStack,
120
-                ProximoListScreen,
121
-                i18n.t('screens.proximo.articleList'),
122
-            )}
123
-            {createScreenCollapsibleStack(
124
-                "proximo-about",
125
-                MainStack,
126
-                ProximoAboutScreen,
127
-                i18n.t('screens.proximo.title'),
128
-                true,
129
-                {...modalTransition},
130
-            )}
120
+      {createScreenCollapsibleStack(
121
+        'self-menu',
122
+        MainStack,
123
+        SelfMenuScreen,
124
+        i18n.t('screens.menu.title'),
125
+      )}
126
+      {createScreenCollapsibleStack(
127
+        'proximo',
128
+        MainStack,
129
+        ProximoMainScreen,
130
+        i18n.t('screens.proximo.title'),
131
+      )}
132
+      {createScreenCollapsibleStack(
133
+        'proximo-list',
134
+        MainStack,
135
+        ProximoListScreen,
136
+        i18n.t('screens.proximo.articleList'),
137
+      )}
138
+      {createScreenCollapsibleStack(
139
+        'proximo-about',
140
+        MainStack,
141
+        ProximoAboutScreen,
142
+        i18n.t('screens.proximo.title'),
143
+        true,
144
+        {...modalTransition},
145
+      )}
131 146
 
132
-            {createScreenCollapsibleStack(
133
-                "profile",
134
-                MainStack,
135
-                ProfileScreen,
136
-                i18n.t('screens.profile.title'))}
137
-            {createScreenCollapsibleStack(
138
-                "club-list",
139
-                MainStack,
140
-                ClubListScreen,
141
-                i18n.t('screens.clubs.title'))}
142
-            {createScreenCollapsibleStack(
143
-                "club-information",
144
-                MainStack,
145
-                ClubDisplayScreen,
146
-                i18n.t('screens.clubs.details'),
147
-                true,
148
-                {...modalTransition})}
149
-            {createScreenCollapsibleStack(
150
-                "club-about",
151
-                MainStack,
152
-                ClubAboutScreen,
153
-                i18n.t('screens.clubs.title'),
154
-                true,
155
-                {...modalTransition})}
156
-            {createScreenCollapsibleStack(
157
-                "equipment-list",
158
-                MainStack,
159
-                EquipmentScreen,
160
-                i18n.t('screens.equipment.title'))}
161
-            {createScreenCollapsibleStack(
162
-                "equipment-rent",
163
-                MainStack,
164
-                EquipmentLendScreen,
165
-                i18n.t('screens.equipment.book'))}
166
-            {createScreenCollapsibleStack(
167
-                "equipment-confirm",
168
-                MainStack,
169
-                EquipmentConfirmScreen,
170
-                i18n.t('screens.equipment.confirm'))}
171
-            {createScreenCollapsibleStack(
172
-                "vote",
173
-                MainStack,
174
-                VoteScreen,
175
-                i18n.t('screens.vote.title'))}
176
-            {createScreenCollapsibleStack(
177
-                "feedback",
178
-                MainStack,
179
-                BugReportScreen,
180
-                i18n.t('screens.feedback.title'))}
181
-        </MainStack.Navigator>
182
-    );
147
+      {createScreenCollapsibleStack(
148
+        'profile',
149
+        MainStack,
150
+        ProfileScreen,
151
+        i18n.t('screens.profile.title'),
152
+      )}
153
+      {createScreenCollapsibleStack(
154
+        'club-list',
155
+        MainStack,
156
+        ClubListScreen,
157
+        i18n.t('screens.clubs.title'),
158
+      )}
159
+      {createScreenCollapsibleStack(
160
+        'club-information',
161
+        MainStack,
162
+        ClubDisplayScreen,
163
+        i18n.t('screens.clubs.details'),
164
+        true,
165
+        {...modalTransition},
166
+      )}
167
+      {createScreenCollapsibleStack(
168
+        'club-about',
169
+        MainStack,
170
+        ClubAboutScreen,
171
+        i18n.t('screens.clubs.title'),
172
+        true,
173
+        {...modalTransition},
174
+      )}
175
+      {createScreenCollapsibleStack(
176
+        'equipment-list',
177
+        MainStack,
178
+        EquipmentScreen,
179
+        i18n.t('screens.equipment.title'),
180
+      )}
181
+      {createScreenCollapsibleStack(
182
+        'equipment-rent',
183
+        MainStack,
184
+        EquipmentLendScreen,
185
+        i18n.t('screens.equipment.book'),
186
+      )}
187
+      {createScreenCollapsibleStack(
188
+        'equipment-confirm',
189
+        MainStack,
190
+        EquipmentConfirmScreen,
191
+        i18n.t('screens.equipment.confirm'),
192
+      )}
193
+      {createScreenCollapsibleStack(
194
+        'vote',
195
+        MainStack,
196
+        VoteScreen,
197
+        i18n.t('screens.vote.title'),
198
+      )}
199
+      {createScreenCollapsibleStack(
200
+        'feedback',
201
+        MainStack,
202
+        BugReportScreen,
203
+        i18n.t('screens.feedback.title'),
204
+      )}
205
+    </MainStack.Navigator>
206
+  );
183 207
 }
184 208
 
185
-type Props = {
186
-    defaultHomeRoute: string | null,
187
-    defaultHomeData: { [key: string]: any }
188
-}
189
-
190
-export default class MainNavigator extends React.Component<Props> {
209
+type PropsType = {
210
+  defaultHomeRoute: string | null,
211
+  // eslint-disable-next-line flowtype/no-weak-types
212
+  defaultHomeData: {[key: string]: string},
213
+};
191 214
 
192
-    createTabNavigator: () => React.Node;
215
+export default class MainNavigator extends React.Component<PropsType> {
216
+  createTabNavigator: () => React.Node;
193 217
 
194
-    constructor(props: Props) {
195
-        super(props);
196
-        this.createTabNavigator = () => <TabNavigator {...props}/>
197
-    }
218
+  constructor(props: PropsType) {
219
+    super(props);
220
+    this.createTabNavigator = (): React.Node => (
221
+      <TabNavigator
222
+        defaultHomeRoute={props.defaultHomeRoute}
223
+        defaultHomeData={props.defaultHomeData}
224
+      />
225
+    );
226
+  }
198 227
 
199
-    render() {
200
-        return (
201
-            <MainStackComponent createTabNavigator={this.createTabNavigator}/>
202
-        );
203
-    }
228
+  render(): React.Node {
229
+    return <MainStackComponent createTabNavigator={this.createTabNavigator} />;
230
+  }
204 231
 }

+ 249
- 228
src/navigation/TabNavigator.js View File

@@ -1,271 +1,292 @@
1
+// @flow
2
+
1 3
 import * as React from 'react';
2 4
 import {createStackNavigator, TransitionPresets} from '@react-navigation/stack';
3
-import {createBottomTabNavigator} from "@react-navigation/bottom-tabs";
5
+import {createBottomTabNavigator} from '@react-navigation/bottom-tabs';
4 6
 
7
+import {Title, useTheme} from 'react-native-paper';
8
+import {Platform} from 'react-native';
9
+import i18n from 'i18n-js';
10
+import {createCollapsibleStack} from 'react-navigation-collapsible';
11
+import {View} from 'react-native-animatable';
5 12
 import HomeScreen from '../screens/Home/HomeScreen';
6 13
 import PlanningScreen from '../screens/Planning/PlanningScreen';
7 14
 import PlanningDisplayScreen from '../screens/Planning/PlanningDisplayScreen';
8 15
 import ProxiwashScreen from '../screens/Proxiwash/ProxiwashScreen';
9 16
 import ProxiwashAboutScreen from '../screens/Proxiwash/ProxiwashAboutScreen';
10 17
 import PlanexScreen from '../screens/Planex/PlanexScreen';
11
-import AsyncStorageManager from "../managers/AsyncStorageManager";
12
-import {Title, useTheme} from 'react-native-paper';
13
-import {Platform} from 'react-native';
14
-import i18n from "i18n-js";
15
-import ClubDisplayScreen from "../screens/Amicale/Clubs/ClubDisplayScreen";
16
-import ScannerScreen from "../screens/Home/ScannerScreen";
17
-import FeedItemScreen from "../screens/Home/FeedItemScreen";
18
-import {createCollapsibleStack} from "react-navigation-collapsible";
19
-import GroupSelectionScreen from "../screens/Planex/GroupSelectionScreen";
20
-import CustomTabBar from "../components/Tabbar/CustomTabBar";
21
-import WebsitesHomeScreen from "../screens/Services/ServicesScreen";
22
-import ServicesSectionScreen from "../screens/Services/ServicesSectionScreen";
23
-import AmicaleContactScreen from "../screens/Amicale/AmicaleContactScreen";
24
-import {createScreenCollapsibleStack, getWebsiteStack} from "../utils/CollapsibleUtils";
25
-import {View} from "react-native-animatable";
26
-import Mascot, {MASCOT_STYLE} from "../components/Mascot/Mascot";
27
-
28
-const modalTransition = Platform.OS === 'ios' ? TransitionPresets.ModalPresentationIOS : TransitionPresets.ModalSlideFromBottomIOS;
18
+import AsyncStorageManager from '../managers/AsyncStorageManager';
19
+import ClubDisplayScreen from '../screens/Amicale/Clubs/ClubDisplayScreen';
20
+import ScannerScreen from '../screens/Home/ScannerScreen';
21
+import FeedItemScreen from '../screens/Home/FeedItemScreen';
22
+import GroupSelectionScreen from '../screens/Planex/GroupSelectionScreen';
23
+import CustomTabBar from '../components/Tabbar/CustomTabBar';
24
+import WebsitesHomeScreen from '../screens/Services/ServicesScreen';
25
+import ServicesSectionScreen from '../screens/Services/ServicesSectionScreen';
26
+import AmicaleContactScreen from '../screens/Amicale/AmicaleContactScreen';
27
+import {
28
+  createScreenCollapsibleStack,
29
+  getWebsiteStack,
30
+} from '../utils/CollapsibleUtils';
31
+import Mascot, {MASCOT_STYLE} from '../components/Mascot/Mascot';
29 32
 
33
+const modalTransition =
34
+  Platform.OS === 'ios'
35
+    ? TransitionPresets.ModalPresentationIOS
36
+    : TransitionPresets.ModalSlideFromBottomIOS;
30 37
 
31 38
 const defaultScreenOptions = {
32
-    gestureEnabled: true,
33
-    cardOverlayEnabled: true,
34
-    ...modalTransition,
39
+  gestureEnabled: true,
40
+  cardOverlayEnabled: true,
41
+  ...modalTransition,
35 42
 };
36 43
 
37
-
38 44
 const ServicesStack = createStackNavigator();
39 45
 
40
-function ServicesStackComponent() {
41
-    return (
42
-        <ServicesStack.Navigator
43
-            initialRouteName="index"
44
-            headerMode={"screen"}
45
-            screenOptions={defaultScreenOptions}
46
-        >
47
-            {createScreenCollapsibleStack(
48
-                "index",
49
-                ServicesStack,
50
-                WebsitesHomeScreen,
51
-                i18n.t('screens.services.title'))}
52
-            {createScreenCollapsibleStack(
53
-                "services-section",
54
-                ServicesStack,
55
-                ServicesSectionScreen,
56
-                "SECTION")}
57
-            {createScreenCollapsibleStack(
58
-                "amicale-contact",
59
-                ServicesStack,
60
-                AmicaleContactScreen,
61
-                i18n.t('screens.amicaleAbout.title'))}
62
-        </ServicesStack.Navigator>
63
-    );
46
+function ServicesStackComponent(): React.Node {
47
+  return (
48
+    <ServicesStack.Navigator
49
+      initialRouteName="index"
50
+      headerMode="screen"
51
+      screenOptions={defaultScreenOptions}>
52
+      {createScreenCollapsibleStack(
53
+        'index',
54
+        ServicesStack,
55
+        WebsitesHomeScreen,
56
+        i18n.t('screens.services.title'),
57
+      )}
58
+      {createScreenCollapsibleStack(
59
+        'services-section',
60
+        ServicesStack,
61
+        ServicesSectionScreen,
62
+        'SECTION',
63
+      )}
64
+      {createScreenCollapsibleStack(
65
+        'amicale-contact',
66
+        ServicesStack,
67
+        AmicaleContactScreen,
68
+        i18n.t('screens.amicaleAbout.title'),
69
+      )}
70
+    </ServicesStack.Navigator>
71
+  );
64 72
 }
65 73
 
66 74
 const ProxiwashStack = createStackNavigator();
67 75
 
68
-function ProxiwashStackComponent() {
69
-    return (
70
-        <ProxiwashStack.Navigator
71
-            initialRouteName="index"
72
-            headerMode={"screen"}
73
-            screenOptions={defaultScreenOptions}
74
-        >
75
-            {createScreenCollapsibleStack(
76
-                "index",
77
-                ProxiwashStack,
78
-                ProxiwashScreen,
79
-                i18n.t('screens.proxiwash.title'))}
80
-            {createScreenCollapsibleStack(
81
-                "proxiwash-about",
82
-                ProxiwashStack,
83
-                ProxiwashAboutScreen,
84
-                i18n.t('screens.proxiwash.title'))}
85
-        </ProxiwashStack.Navigator>
86
-    );
76
+function ProxiwashStackComponent(): React.Node {
77
+  return (
78
+    <ProxiwashStack.Navigator
79
+      initialRouteName="index"
80
+      headerMode="screen"
81
+      screenOptions={defaultScreenOptions}>
82
+      {createScreenCollapsibleStack(
83
+        'index',
84
+        ProxiwashStack,
85
+        ProxiwashScreen,
86
+        i18n.t('screens.proxiwash.title'),
87
+      )}
88
+      {createScreenCollapsibleStack(
89
+        'proxiwash-about',
90
+        ProxiwashStack,
91
+        ProxiwashAboutScreen,
92
+        i18n.t('screens.proxiwash.title'),
93
+      )}
94
+    </ProxiwashStack.Navigator>
95
+  );
87 96
 }
88 97
 
89 98
 const PlanningStack = createStackNavigator();
90 99
 
91
-function PlanningStackComponent() {
92
-    return (
93
-        <PlanningStack.Navigator
94
-            initialRouteName="index"
95
-            headerMode={"screen"}
96
-            screenOptions={defaultScreenOptions}
97
-        >
98
-            <PlanningStack.Screen
99
-                name="index"
100
-                component={PlanningScreen}
101
-                options={{title: i18n.t('screens.planning.title'),}}
102
-            />
103
-            {createScreenCollapsibleStack(
104
-                "planning-information",
105
-                PlanningStack,
106
-                PlanningDisplayScreen,
107
-                i18n.t('screens.planning.eventDetails'))}
108
-        </PlanningStack.Navigator>
109
-    );
100
+function PlanningStackComponent(): React.Node {
101
+  return (
102
+    <PlanningStack.Navigator
103
+      initialRouteName="index"
104
+      headerMode="screen"
105
+      screenOptions={defaultScreenOptions}>
106
+      <PlanningStack.Screen
107
+        name="index"
108
+        component={PlanningScreen}
109
+        options={{title: i18n.t('screens.planning.title')}}
110
+      />
111
+      {createScreenCollapsibleStack(
112
+        'planning-information',
113
+        PlanningStack,
114
+        PlanningDisplayScreen,
115
+        i18n.t('screens.planning.eventDetails'),
116
+      )}
117
+    </PlanningStack.Navigator>
118
+  );
110 119
 }
111 120
 
112 121
 const HomeStack = createStackNavigator();
113 122
 
114
-function HomeStackComponent(initialRoute: string | null, defaultData: { [key: string]: any }) {
115
-    let params = undefined;
116
-    if (initialRoute != null)
117
-        params = {data: defaultData, nextScreen: initialRoute, shouldOpen: true};
118
-    const {colors} = useTheme();
119
-    return (
120
-        <HomeStack.Navigator
121
-            initialRouteName={"index"}
122
-            headerMode={"screen"}
123
-            screenOptions={defaultScreenOptions}
124
-        >
125
-            {createCollapsibleStack(
126
-                <HomeStack.Screen
127
-                    name="index"
128
-                    component={HomeScreen}
129
-                    options={{
130
-                        title: i18n.t('screens.home.title'),
131
-                        headerStyle: {
132
-                            backgroundColor: colors.surface,
133
-                        },
134
-                        headerTitle: () =>
135
-                            <View style={{flexDirection: "row"}}>
136
-                                <Mascot
137
-                                    style={{
138
-                                        width: 50
139
-                                    }}
140
-                                    emotion={MASCOT_STYLE.RANDOM}
141
-                                    animated={true}
142
-                                    entryAnimation={{
143
-                                        animation: "bounceIn",
144
-                                        duration: 1000
145
-                                    }}
146
-                                    loopAnimation={{
147
-                                        animation: "pulse",
148
-                                        duration: 2000,
149
-                                        iterationCount: "infinite"
150
-                                    }}
151
-                                />
152
-                                <Title style={{
153
-                                    marginLeft: 10,
154
-                                    marginTop: "auto",
155
-                                    marginBottom: "auto",
156
-                                }}>{i18n.t('screens.home.title')}</Title>
157
-                            </View>
158
-                    }}
159
-                    initialParams={params}
160
-                />,
161
-                {
162
-                    collapsedColor: colors.surface,
163
-                    useNativeDriver: true,
164
-                }
165
-            )}
166
-            <HomeStack.Screen
167
-                name="scanner"
168
-                component={ScannerScreen}
169
-                options={{title: i18n.t('screens.scanner.title'),}}
170
-            />
123
+function HomeStackComponent(
124
+  initialRoute: string | null,
125
+  defaultData: {[key: string]: string},
126
+): React.Node {
127
+  let params;
128
+  if (initialRoute != null)
129
+    params = {data: defaultData, nextScreen: initialRoute, shouldOpen: true};
130
+  const {colors} = useTheme();
131
+  return (
132
+    <HomeStack.Navigator
133
+      initialRouteName="index"
134
+      headerMode="screen"
135
+      screenOptions={defaultScreenOptions}>
136
+      {createCollapsibleStack(
137
+        <HomeStack.Screen
138
+          name="index"
139
+          component={HomeScreen}
140
+          options={{
141
+            title: i18n.t('screens.home.title'),
142
+            headerStyle: {
143
+              backgroundColor: colors.surface,
144
+            },
145
+            headerTitle: (): React.Node => (
146
+              <View style={{flexDirection: 'row'}}>
147
+                <Mascot
148
+                  style={{
149
+                    width: 50,
150
+                  }}
151
+                  emotion={MASCOT_STYLE.RANDOM}
152
+                  animated
153
+                  entryAnimation={{
154
+                    animation: 'bounceIn',
155
+                    duration: 1000,
156
+                  }}
157
+                  loopAnimation={{
158
+                    animation: 'pulse',
159
+                    duration: 2000,
160
+                    iterationCount: 'infinite',
161
+                  }}
162
+                />
163
+                <Title
164
+                  style={{
165
+                    marginLeft: 10,
166
+                    marginTop: 'auto',
167
+                    marginBottom: 'auto',
168
+                  }}>
169
+                  {i18n.t('screens.home.title')}
170
+                </Title>
171
+              </View>
172
+            ),
173
+          }}
174
+          initialParams={params}
175
+        />,
176
+        {
177
+          collapsedColor: colors.surface,
178
+          useNativeDriver: true,
179
+        },
180
+      )}
181
+      <HomeStack.Screen
182
+        name="scanner"
183
+        component={ScannerScreen}
184
+        options={{title: i18n.t('screens.scanner.title')}}
185
+      />
171 186
 
172
-            {createScreenCollapsibleStack(
173
-                "club-information",
174
-                HomeStack,
175
-                ClubDisplayScreen,
176
-                i18n.t('screens.clubs.details'))}
177
-            {createScreenCollapsibleStack(
178
-                "feed-information",
179
-                HomeStack,
180
-                FeedItemScreen,
181
-                i18n.t('screens.home.feed'))}
182
-            {createScreenCollapsibleStack(
183
-                "planning-information",
184
-                HomeStack,
185
-                PlanningDisplayScreen,
186
-                i18n.t('screens.planning.eventDetails'))}
187
-        </HomeStack.Navigator>
188
-    );
187
+      {createScreenCollapsibleStack(
188
+        'club-information',
189
+        HomeStack,
190
+        ClubDisplayScreen,
191
+        i18n.t('screens.clubs.details'),
192
+      )}
193
+      {createScreenCollapsibleStack(
194
+        'feed-information',
195
+        HomeStack,
196
+        FeedItemScreen,
197
+        i18n.t('screens.home.feed'),
198
+      )}
199
+      {createScreenCollapsibleStack(
200
+        'planning-information',
201
+        HomeStack,
202
+        PlanningDisplayScreen,
203
+        i18n.t('screens.planning.eventDetails'),
204
+      )}
205
+    </HomeStack.Navigator>
206
+  );
189 207
 }
190 208
 
191 209
 const PlanexStack = createStackNavigator();
192 210
 
193
-function PlanexStackComponent() {
194
-    return (
195
-        <PlanexStack.Navigator
196
-            initialRouteName="index"
197
-            headerMode={"screen"}
198
-            screenOptions={defaultScreenOptions}
199
-        >
200
-            {getWebsiteStack(
201
-                "index",
202
-                PlanexStack,
203
-                PlanexScreen,
204
-                i18n.t("screens.planex.title"))}
205
-            {createScreenCollapsibleStack(
206
-                "group-select",
207
-                PlanexStack,
208
-                GroupSelectionScreen,
209
-                "")}
210
-        </PlanexStack.Navigator>
211
-    );
211
+function PlanexStackComponent(): React.Node {
212
+  return (
213
+    <PlanexStack.Navigator
214
+      initialRouteName="index"
215
+      headerMode="screen"
216
+      screenOptions={defaultScreenOptions}>
217
+      {getWebsiteStack(
218
+        'index',
219
+        PlanexStack,
220
+        PlanexScreen,
221
+        i18n.t('screens.planex.title'),
222
+      )}
223
+      {createScreenCollapsibleStack(
224
+        'group-select',
225
+        PlanexStack,
226
+        GroupSelectionScreen,
227
+        '',
228
+      )}
229
+    </PlanexStack.Navigator>
230
+  );
212 231
 }
213 232
 
214 233
 const Tab = createBottomTabNavigator();
215 234
 
216
-type Props = {
217
-    defaultHomeRoute: string | null,
218
-    defaultHomeData: { [key: string]: any }
219
-}
235
+type PropsType = {
236
+  defaultHomeRoute: string | null,
237
+  defaultHomeData: {[key: string]: string},
238
+};
220 239
 
221
-export default class TabNavigator extends React.Component<Props> {
240
+export default class TabNavigator extends React.Component<PropsType> {
241
+  createHomeStackComponent: () => React.Node;
222 242
 
223
-    createHomeStackComponent: () => HomeStackComponent;
224
-    defaultRoute: string;
243
+  defaultRoute: string;
225 244
 
226
-    constructor(props) {
227
-        super(props);
228
-        if (props.defaultHomeRoute != null)
229
-            this.defaultRoute = 'home';
230
-        else
231
-            this.defaultRoute = AsyncStorageManager.getString(AsyncStorageManager.PREFERENCES.defaultStartScreen.key).toLowerCase();
232
-        this.createHomeStackComponent = () => HomeStackComponent(props.defaultHomeRoute, props.defaultHomeData);
233
-    }
245
+  constructor(props: PropsType) {
246
+    super(props);
247
+    if (props.defaultHomeRoute != null) this.defaultRoute = 'home';
248
+    else
249
+      this.defaultRoute = AsyncStorageManager.getString(
250
+        AsyncStorageManager.PREFERENCES.defaultStartScreen.key,
251
+      ).toLowerCase();
252
+    this.createHomeStackComponent = (): React.Node =>
253
+      HomeStackComponent(props.defaultHomeRoute, props.defaultHomeData);
254
+  }
234 255
 
235
-    render() {
236
-        return (
237
-            <Tab.Navigator
238
-                initialRouteName={this.defaultRoute}
239
-                tabBar={props => <CustomTabBar {...props} />}
240
-            >
241
-                <Tab.Screen
242
-                    name="services"
243
-                    option
244
-                    component={ServicesStackComponent}
245
-                    options={{title: i18n.t('screens.services.title')}}
246
-                />
247
-                <Tab.Screen
248
-                    name="proxiwash"
249
-                    component={ProxiwashStackComponent}
250
-                    options={{title: i18n.t('screens.proxiwash.title')}}
251
-                />
252
-                <Tab.Screen
253
-                    name="home"
254
-                    component={this.createHomeStackComponent}
255
-                    options={{title: i18n.t('screens.home.title')}}
256
-                />
257
-                <Tab.Screen
258
-                    name="planning"
259
-                    component={PlanningStackComponent}
260
-                    options={{title: i18n.t('screens.planning.title')}}
261
-                />
256
+  render(): React.Node {
257
+    return (
258
+      <Tab.Navigator
259
+        initialRouteName={this.defaultRoute}
260
+        // eslint-disable-next-line react/jsx-props-no-spreading
261
+        tabBar={(props: {...}): React.Node => <CustomTabBar {...props} />}>
262
+        <Tab.Screen
263
+          name="services"
264
+          option
265
+          component={ServicesStackComponent}
266
+          options={{title: i18n.t('screens.services.title')}}
267
+        />
268
+        <Tab.Screen
269
+          name="proxiwash"
270
+          component={ProxiwashStackComponent}
271
+          options={{title: i18n.t('screens.proxiwash.title')}}
272
+        />
273
+        <Tab.Screen
274
+          name="home"
275
+          component={this.createHomeStackComponent}
276
+          options={{title: i18n.t('screens.home.title')}}
277
+        />
278
+        <Tab.Screen
279
+          name="planning"
280
+          component={PlanningStackComponent}
281
+          options={{title: i18n.t('screens.planning.title')}}
282
+        />
262 283
 
263
-                <Tab.Screen
264
-                    name="planex"
265
-                    component={PlanexStackComponent}
266
-                    options={{title: i18n.t("screens.planex.title")}}
267
-                />
268
-            </Tab.Navigator>
269
-        );
270
-    }
284
+        <Tab.Screen
285
+          name="planex"
286
+          component={PlanexStackComponent}
287
+          options={{title: i18n.t('screens.planex.title')}}
288
+        />
289
+      </Tab.Navigator>
290
+    );
291
+  }
271 292
 }

Loading…
Cancel
Save