diff --git a/src/libs/Navigation/AppNavigator/index.native.tsx b/src/libs/Navigation/AppNavigator/index.native.tsx
new file mode 100644
index 000000000000..f740f9eb5b94
--- /dev/null
+++ b/src/libs/Navigation/AppNavigator/index.native.tsx
@@ -0,0 +1,38 @@
+import React, {memo, useContext, useEffect} from 'react';
+import {NativeModules} from 'react-native';
+import {InitialURLContext} from '@components/InitialURLContextProvider';
+import Navigation from '@libs/Navigation/Navigation';
+
+type AppNavigatorProps = {
+ /** If we have an authToken this is true */
+ authenticated: boolean;
+};
+
+function AppNavigator({authenticated}: AppNavigatorProps) {
+ const initUrl = useContext(InitialURLContext);
+
+ useEffect(() => {
+ if (!NativeModules.HybridAppModule || !initUrl) {
+ return;
+ }
+
+ Navigation.isNavigationReady().then(() => {
+ Navigation.navigate(initUrl);
+ });
+ }, [initUrl]);
+
+ if (authenticated) {
+ const AuthScreens = require('./AuthScreens').default;
+
+ // These are the protected screens and only accessible when an authToken is present
+ return ;
+ }
+
+ const PublicScreens = require('./PublicScreens').default;
+
+ return ;
+}
+
+AppNavigator.displayName = 'AppNavigator';
+
+export default memo(AppNavigator);
diff --git a/src/libs/Navigation/AppNavigator/index.tsx b/src/libs/Navigation/AppNavigator/index.tsx
index 9729a2f812ce..f8b14781a5ec 100644
--- a/src/libs/Navigation/AppNavigator/index.tsx
+++ b/src/libs/Navigation/AppNavigator/index.tsx
@@ -1,8 +1,11 @@
-import React, {useContext, useEffect} from 'react';
+import React, {lazy, memo, Suspense, 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;
@@ -22,14 +25,21 @@ 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 ;
+ return (
+
+
+
+ );
}
- const PublicScreens = require('./PublicScreens').default;
- return ;
+
+ return (
+
+
+
+ );
}
AppNavigator.displayName = 'AppNavigator';
-export default AppNavigator;
+
+export default memo(AppNavigator);