Skip to content

Commit

Permalink
Revert "optimize AppNavigator"
Browse files Browse the repository at this point in the history
This reverts commit 00bc340.
  • Loading branch information
rezkiy37 committed May 24, 2024
1 parent ab290dc commit ed1d5c3
Showing 1 changed file with 7 additions and 17 deletions.
24 changes: 7 additions & 17 deletions src/libs/Navigation/AppNavigator/index.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
import React, {lazy, memo, Suspense, useContext, useEffect} from 'react';
import React, {useContext, useEffect} from 'react';
import {NativeModules} from 'react-native';
import {InitialURLContext} from '@components/InitialURLContextProvider';
import Navigation from '@libs/Navigation/Navigation';

const AuthScreens = lazy(() => import('./AuthScreens'));
const PublicScreens = lazy(() => import('./PublicScreens'));

type AppNavigatorProps = {
/** If we have an authToken this is true */
authenticated: boolean;
Expand All @@ -25,21 +22,14 @@ function AppNavigator({authenticated}: AppNavigatorProps) {
}, [initUrl]);

if (authenticated) {
const AuthScreens = require('./AuthScreens').default;

// These are the protected screens and only accessible when an authToken is present
return (
<Suspense fallback={null}>
<AuthScreens />
</Suspense>
);
return <AuthScreens />;
}

return (
<Suspense fallback={null}>
<PublicScreens />
</Suspense>
);
const PublicScreens = require('./PublicScreens').default;
return <PublicScreens />;
}

AppNavigator.displayName = 'AppNavigator';

export default memo(AppNavigator);
export default AppNavigator;

0 comments on commit ed1d5c3

Please sign in to comment.