From 6d0ecd5fac0ea0514ab7af263d7aa67d478aeb19 Mon Sep 17 00:00:00 2001 From: c3024 Date: Tue, 8 Oct 2024 11:44:49 +0530 Subject: [PATCH 1/2] remove unnecessary dismissModal --- src/components/ConnectToXeroFlow/index.native.tsx | 1 - src/components/ConnectToXeroFlow/index.tsx | 1 - 2 files changed, 2 deletions(-) diff --git a/src/components/ConnectToXeroFlow/index.native.tsx b/src/components/ConnectToXeroFlow/index.native.tsx index 735c4bf131a3..5bffa97b55de 100644 --- a/src/components/ConnectToXeroFlow/index.native.tsx +++ b/src/components/ConnectToXeroFlow/index.native.tsx @@ -51,7 +51,6 @@ function ConnectToXeroFlow({policyID, session}: ConnectToXeroFlowProps & Connect { setIsRequire2FAModalOpen(false); - Navigation.dismissModal(); Navigation.navigate(ROUTES.SETTINGS_2FA.getRoute(ROUTES.POLICY_ACCOUNTING.getRoute(policyID), getXeroSetupLink(policyID))); }} onCancel={() => setIsRequire2FAModalOpen(false)} diff --git a/src/components/ConnectToXeroFlow/index.tsx b/src/components/ConnectToXeroFlow/index.tsx index 0a3403be78ec..5d0e88e1512b 100644 --- a/src/components/ConnectToXeroFlow/index.tsx +++ b/src/components/ConnectToXeroFlow/index.tsx @@ -34,7 +34,6 @@ function ConnectToXeroFlow({policyID}: ConnectToXeroFlowProps) { { setIsRequire2FAModalOpen(false); - Navigation.dismissModal(); Navigation.navigate(ROUTES.SETTINGS_2FA.getRoute(ROUTES.POLICY_ACCOUNTING.getRoute(policyID), getXeroSetupLink(policyID))); }} onCancel={() => { From e4754880ad1f2cc9f24d471c30899da965ec7c24 Mon Sep 17 00:00:00 2001 From: c3024 Date: Tue, 8 Oct 2024 14:30:39 +0530 Subject: [PATCH 2/2] migrate to useOnyx --- .../ConnectToXeroFlow/index.native.tsx | 19 ++++--------------- 1 file changed, 4 insertions(+), 15 deletions(-) diff --git a/src/components/ConnectToXeroFlow/index.native.tsx b/src/components/ConnectToXeroFlow/index.native.tsx index 5bffa97b55de..ab9fa3054261 100644 --- a/src/components/ConnectToXeroFlow/index.native.tsx +++ b/src/components/ConnectToXeroFlow/index.native.tsx @@ -1,6 +1,5 @@ import React, {useEffect, useRef, useState} from 'react'; -import type {OnyxEntry} from 'react-native-onyx'; -import {useOnyx, withOnyx} from 'react-native-onyx'; +import {useOnyx} from 'react-native-onyx'; import {WebView} from 'react-native-webview'; import FullPageOfflineBlockingView from '@components/BlockingViews/FullPageOfflineBlockingView'; import FullScreenLoadingIndicator from '@components/FullscreenLoadingIndicator'; @@ -14,19 +13,13 @@ import Navigation from '@libs/Navigation/Navigation'; import CONST from '@src/CONST'; import ONYXKEYS from '@src/ONYXKEYS'; import ROUTES from '@src/ROUTES'; -import type {Session} from '@src/types/onyx'; import type {ConnectToXeroFlowProps} from './types'; -type ConnectToXeroFlowOnyxProps = { - /** Session info for the currently logged in user. */ - session: OnyxEntry; -}; - -function ConnectToXeroFlow({policyID, session}: ConnectToXeroFlowProps & ConnectToXeroFlowOnyxProps) { +function ConnectToXeroFlow({policyID}: ConnectToXeroFlowProps) { const {translate} = useLocalize(); const webViewRef = useRef(null); const [isWebViewOpen, setWebViewOpen] = useState(false); - + const [session] = useOnyx(ONYXKEYS.SESSION); const authToken = session?.authToken ?? null; const [account] = useOnyx(ONYXKEYS.ACCOUNT); @@ -90,8 +83,4 @@ function ConnectToXeroFlow({policyID, session}: ConnectToXeroFlowProps & Connect ConnectToXeroFlow.displayName = 'ConnectToXeroFlow'; -export default withOnyx({ - session: { - key: ONYXKEYS.SESSION, - }, -})(ConnectToXeroFlow); +export default ConnectToXeroFlow;