Browse Source

Fix startup crash

Arnaud Vergnet 6 months ago
parent
commit
7d0df0e7ce
2 changed files with 21 additions and 14 deletions
  1. 19
    12
      src/navigation/MainNavigator.tsx
  2. 2
    2
      src/navigation/TabNavigator.tsx

+ 19
- 12
src/navigation/MainNavigator.tsx View File

@@ -115,19 +115,9 @@ function getIntroScreens() {
115 115
   );
116 116
 }
117 117
 
118
-function MainStackComponent(props: {
119
-  showIntro: boolean;
120
-  createTabNavigator: () => React.ReactElement;
121
-}) {
122
-  const { showIntro, createTabNavigator } = props;
123
-  if (showIntro) {
124
-    return getIntroScreens();
125
-  }
118
+function getRegularScreens(createTabNavigator: () => React.ReactElement) {
126 119
   return (
127
-    <MainStack.Navigator
128
-      initialRouteName={showIntro ? MainRoutes.Intro : MainRoutes.Main}
129
-      headerMode={'screen'}
130
-    >
120
+    <>
131 121
       <MainStack.Screen
132 122
         name={MainRoutes.Main}
133 123
         component={createTabNavigator}
@@ -303,6 +293,21 @@ function MainStackComponent(props: {
303 293
           title: i18n.t('screens.feedback.title'),
304 294
         }}
305 295
       />
296
+    </>
297
+  );
298
+}
299
+
300
+function MainStackComponent(props: {
301
+  showIntro: boolean;
302
+  createTabNavigator: () => React.ReactElement;
303
+}) {
304
+  const { showIntro, createTabNavigator } = props;
305
+  return (
306
+    <MainStack.Navigator
307
+      initialRouteName={showIntro ? MainRoutes.Intro : MainRoutes.Main}
308
+      headerMode={'screen'}
309
+    >
310
+      {showIntro ? getIntroScreens() : getRegularScreens(createTabNavigator)}
306 311
     </MainStack.Navigator>
307 312
   );
308 313
 }
@@ -315,6 +320,8 @@ type PropsType = {
315 320
 export default function MainNavigator(props: PropsType) {
316 321
   const { preferences } = usePreferences();
317 322
   const showIntro = getPreferenceBool(PreferenceKeys.showIntro, preferences);
323
+  console.log(preferences);
324
+
318 325
   return (
319 326
     <MainStackComponent
320 327
       showIntro={showIntro !== false}

+ 2
- 2
src/navigation/TabNavigator.tsx View File

@@ -254,7 +254,7 @@ const ICONS: {
254 254
     normal: '',
255 255
     focused: '',
256 256
   },
257
-  planning: {
257
+  events: {
258 258
     normal: 'calendar-range-outline',
259 259
     focused: 'calendar-range',
260 260
   },
@@ -285,7 +285,7 @@ export default function TabNavigator(props: PropsType) {
285 285
     services: i18n.t('screens.services.title'),
286 286
     proxiwash: i18n.t('screens.proxiwash.title'),
287 287
     home: i18n.t('screens.home.title'),
288
-    planning: i18n.t('screens.planning.title'),
288
+    events: i18n.t('screens.planning.title'),
289 289
     planex: i18n.t('screens.planex.title'),
290 290
   };
291 291
   return (

Loading…
Cancel
Save