From 09cb9c1e0634953b09aafe966b7c12389dc8d2e7 Mon Sep 17 00:00:00 2001 From: Mykhailo Kravchenko Date: Wed, 22 May 2024 15:28:02 +0200 Subject: [PATCH 1/7] create a stable default props for ReportFooter --- src/pages/home/report/ReportFooter.tsx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/pages/home/report/ReportFooter.tsx b/src/pages/home/report/ReportFooter.tsx index b3bddb9ba499..98f0f1e7998a 100644 --- a/src/pages/home/report/ReportFooter.tsx +++ b/src/pages/home/report/ReportFooter.tsx @@ -63,11 +63,13 @@ type ReportFooterProps = ReportFooterOnyxProps & { onComposerBlur: () => void; }; +const defaultReport = {reportID: '0'}; + function ReportFooter({ lastReportAction, pendingAction, session, - report = {reportID: '0'}, + report = defaultReport, reportNameValuePairs, shouldShowComposeInput = false, isEmptyChat = true, From ecb40876cb1c5eb8464f976043e05ba76c345323 Mon Sep 17 00:00:00 2001 From: Mykhailo Kravchenko Date: Thu, 23 May 2024 11:34:38 +0200 Subject: [PATCH 2/7] Revert "create a stable default props for ReportFooter" This reverts commit 09cb9c1e0634953b09aafe966b7c12389dc8d2e7. --- src/pages/home/report/ReportFooter.tsx | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/pages/home/report/ReportFooter.tsx b/src/pages/home/report/ReportFooter.tsx index 98f0f1e7998a..b3bddb9ba499 100644 --- a/src/pages/home/report/ReportFooter.tsx +++ b/src/pages/home/report/ReportFooter.tsx @@ -63,13 +63,11 @@ type ReportFooterProps = ReportFooterOnyxProps & { onComposerBlur: () => void; }; -const defaultReport = {reportID: '0'}; - function ReportFooter({ lastReportAction, pendingAction, session, - report = defaultReport, + report = {reportID: '0'}, reportNameValuePairs, shouldShowComposeInput = false, isEmptyChat = true, From 00bc3407017f8cbdd8d6a2fc14a7f118560810dd Mon Sep 17 00:00:00 2001 From: Mykhailo Kravchenko Date: Thu, 23 May 2024 17:39:30 +0200 Subject: [PATCH 3/7] optimize AppNavigator --- src/libs/Navigation/AppNavigator/index.tsx | 24 +++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) 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); From ed1d5c39bebc97b59b7c2343c88694ffb2405f1d Mon Sep 17 00:00:00 2001 From: Mykhailo Kravchenko Date: Fri, 24 May 2024 12:22:17 +0200 Subject: [PATCH 4/7] Revert "optimize AppNavigator" This reverts commit 00bc3407017f8cbdd8d6a2fc14a7f118560810dd. --- src/libs/Navigation/AppNavigator/index.tsx | 24 +++++++--------------- 1 file changed, 7 insertions(+), 17 deletions(-) diff --git a/src/libs/Navigation/AppNavigator/index.tsx b/src/libs/Navigation/AppNavigator/index.tsx index f8b14781a5ec..9729a2f812ce 100644 --- a/src/libs/Navigation/AppNavigator/index.tsx +++ b/src/libs/Navigation/AppNavigator/index.tsx @@ -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; @@ -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 ( - - - - ); + return ; } - - return ( - - - - ); + const PublicScreens = require('./PublicScreens').default; + return ; } AppNavigator.displayName = 'AppNavigator'; - -export default memo(AppNavigator); +export default AppNavigator; From 0eaa3728d19c5d918e79734f72eaff432a30d233 Mon Sep 17 00:00:00 2001 From: Mykhailo Kravchenko Date: Mon, 27 May 2024 15:25:24 +0200 Subject: [PATCH 5/7] Reapply "optimize AppNavigator" This reverts commit ed1d5c39bebc97b59b7c2343c88694ffb2405f1d. --- src/libs/Navigation/AppNavigator/index.tsx | 24 +++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) 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); From 4da2c03d7a045261f696bded634ba43d82be410d Mon Sep 17 00:00:00 2001 From: Mykhailo Kravchenko Date: Wed, 29 May 2024 18:04:09 +0200 Subject: [PATCH 6/7] create a native AppNavigator --- .../Navigation/AppNavigator/index.native.tsx | 35 +++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 src/libs/Navigation/AppNavigator/index.native.tsx diff --git a/src/libs/Navigation/AppNavigator/index.native.tsx b/src/libs/Navigation/AppNavigator/index.native.tsx new file mode 100644 index 000000000000..c0d56eaec663 --- /dev/null +++ b/src/libs/Navigation/AppNavigator/index.native.tsx @@ -0,0 +1,35 @@ +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); From 7d334e0f0e1e35ed80ed9a34841e0a001b05ffe5 Mon Sep 17 00:00:00 2001 From: Mykhailo Kravchenko Date: Mon, 3 Jun 2024 13:49:38 +0200 Subject: [PATCH 7/7] add empty-lines --- src/libs/Navigation/AppNavigator/index.native.tsx | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/libs/Navigation/AppNavigator/index.native.tsx b/src/libs/Navigation/AppNavigator/index.native.tsx index c0d56eaec663..f740f9eb5b94 100644 --- a/src/libs/Navigation/AppNavigator/index.native.tsx +++ b/src/libs/Navigation/AppNavigator/index.native.tsx @@ -27,9 +27,12 @@ function AppNavigator({authenticated}: AppNavigatorProps) { // 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);