Skip to content

Commit

Permalink
Merge pull request Expensify#50371 from c3024/remove-unnecessary-dism…
Browse files Browse the repository at this point in the history
…issModal

Fix blinking on Accounting Centre Pane when clicking of modal asking for setting up of 2FA when connecting to Xero
  • Loading branch information
MonilBhavsar authored Oct 8, 2024
2 parents 016822b + e475488 commit 867bbb4
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 17 deletions.
20 changes: 4 additions & 16 deletions src/components/ConnectToXeroFlow/index.native.tsx
Original file line number Diff line number Diff line change
@@ -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';
Expand All @@ -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<Session>;
};

function ConnectToXeroFlow({policyID, session}: ConnectToXeroFlowProps & ConnectToXeroFlowOnyxProps) {
function ConnectToXeroFlow({policyID}: ConnectToXeroFlowProps) {
const {translate} = useLocalize();
const webViewRef = useRef<WebView>(null);
const [isWebViewOpen, setWebViewOpen] = useState(false);

const [session] = useOnyx(ONYXKEYS.SESSION);
const authToken = session?.authToken ?? null;

const [account] = useOnyx(ONYXKEYS.ACCOUNT);
Expand All @@ -51,7 +44,6 @@ function ConnectToXeroFlow({policyID, session}: ConnectToXeroFlowProps & Connect
<RequireTwoFactorAuthenticationModal
onSubmit={() => {
setIsRequire2FAModalOpen(false);
Navigation.dismissModal();
Navigation.navigate(ROUTES.SETTINGS_2FA.getRoute(ROUTES.POLICY_ACCOUNTING.getRoute(policyID), getXeroSetupLink(policyID)));
}}
onCancel={() => setIsRequire2FAModalOpen(false)}
Expand Down Expand Up @@ -91,8 +83,4 @@ function ConnectToXeroFlow({policyID, session}: ConnectToXeroFlowProps & Connect

ConnectToXeroFlow.displayName = 'ConnectToXeroFlow';

export default withOnyx<ConnectToXeroFlowProps & ConnectToXeroFlowOnyxProps, ConnectToXeroFlowOnyxProps>({
session: {
key: ONYXKEYS.SESSION,
},
})(ConnectToXeroFlow);
export default ConnectToXeroFlow;
1 change: 0 additions & 1 deletion src/components/ConnectToXeroFlow/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ function ConnectToXeroFlow({policyID}: ConnectToXeroFlowProps) {
<RequireTwoFactorAuthenticationModal
onSubmit={() => {
setIsRequire2FAModalOpen(false);
Navigation.dismissModal();
Navigation.navigate(ROUTES.SETTINGS_2FA.getRoute(ROUTES.POLICY_ACCOUNTING.getRoute(policyID), getXeroSetupLink(policyID)));
}}
onCancel={() => {
Expand Down

0 comments on commit 867bbb4

Please sign in to comment.