Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix screen briefly flashes Chase feed page after connecting Amex feed and back to expensify #53863

Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import React, {useEffect, useMemo, useRef, useState} from 'react';
import React, {useEffect, useMemo, useRef} from 'react';
import {useOnyx} from 'react-native-onyx';
import {WebView} from 'react-native-webview';
import type {ValueOf} from 'type-fest';
import FullPageOfflineBlockingView from '@components/BlockingViews/FullPageOfflineBlockingView';
import FullScreenLoadingIndicator from '@components/FullscreenLoadingIndicator';
import HeaderWithBackButton from '@components/HeaderWithBackButton';
import Modal from '@components/Modal';
import ScreenWrapper from '@components/ScreenWrapper';
import useLocalize from '@hooks/useLocalize';
import usePrevious from '@hooks/usePrevious';
import * as CardUtils from '@libs/CardUtils';
Expand All @@ -26,7 +26,6 @@ type BankConnectionStepProps = {
function BankConnection({policyID}: BankConnectionStepProps) {
const {translate} = useLocalize();
const webViewRef = useRef<WebView>(null);
const [isWebViewOpen, setWebViewOpen] = useState(false);
const [session] = useOnyx(ONYXKEYS.SESSION);
const authToken = session?.authToken ?? null;
const [addNewCard] = useOnyx(ONYXKEYS.ADD_NEW_COMPANY_CARD);
Expand All @@ -40,7 +39,6 @@ function BankConnection({policyID}: BankConnectionStepProps) {
const renderLoading = () => <FullScreenLoadingIndicator />;

const handleBackButtonPress = () => {
setWebViewOpen(false);
if (bankName === CONST.COMPANY_CARDS.BANKS.BREX) {
CompanyCards.setAddNewCompanyCardStepAndData({step: CONST.COMPANY_CARDS.STEP.SELECT_BANK});
return;
Expand All @@ -52,10 +50,6 @@ function BankConnection({policyID}: BankConnectionStepProps) {
CompanyCards.setAddNewCompanyCardStepAndData({step: CONST.COMPANY_CARDS.STEP.SELECT_FEED_TYPE});
};

useEffect(() => {
setWebViewOpen(true);
}, []);

useEffect(() => {
if (!url) {
return;
Expand All @@ -69,11 +63,11 @@ function BankConnection({policyID}: BankConnectionStepProps) {
}, [isNewFeedConnected, newFeed, policyID, url]);

return (
<Modal
onClose={handleBackButtonPress}
fullscreen
isVisible={isWebViewOpen}
type={CONST.MODAL.MODAL_TYPE.CENTERED_UNSWIPEABLE}
<ScreenWrapper
testID={BankConnection.displayName}
includeSafeAreaPaddingBottom={false}
VickyStash marked this conversation as resolved.
Show resolved Hide resolved
shouldEnablePickerAvoiding={false}
shouldEnableMaxHeight
>
<HeaderWithBackButton
title={translate('workspace.companyCards.addCards')}
Expand All @@ -96,7 +90,7 @@ function BankConnection({policyID}: BankConnectionStepProps) {
/>
)}
</FullPageOfflineBlockingView>
</Modal>
</ScreenWrapper>
);
}

Expand Down
Loading