1
- import React , { useEffect , useMemo , useRef , useState } from 'react' ;
1
+ import React , { useEffect , useMemo , useRef } from 'react' ;
2
2
import { useOnyx } from 'react-native-onyx' ;
3
3
import { WebView } from 'react-native-webview' ;
4
4
import type { ValueOf } from 'type-fest' ;
5
5
import FullPageOfflineBlockingView from '@components/BlockingViews/FullPageOfflineBlockingView' ;
6
6
import FullScreenLoadingIndicator from '@components/FullscreenLoadingIndicator' ;
7
7
import HeaderWithBackButton from '@components/HeaderWithBackButton' ;
8
- import Modal from '@components/Modal ' ;
8
+ import ScreenWrapper from '@components/ScreenWrapper ' ;
9
9
import useLocalize from '@hooks/useLocalize' ;
10
10
import usePrevious from '@hooks/usePrevious' ;
11
11
import * as CardUtils from '@libs/CardUtils' ;
@@ -26,7 +26,6 @@ type BankConnectionStepProps = {
26
26
function BankConnection ( { policyID} : BankConnectionStepProps ) {
27
27
const { translate} = useLocalize ( ) ;
28
28
const webViewRef = useRef < WebView > ( null ) ;
29
- const [ isWebViewOpen , setWebViewOpen ] = useState ( false ) ;
30
29
const [ session ] = useOnyx ( ONYXKEYS . SESSION ) ;
31
30
const authToken = session ?. authToken ?? null ;
32
31
const [ addNewCard ] = useOnyx ( ONYXKEYS . ADD_NEW_COMPANY_CARD ) ;
@@ -40,7 +39,6 @@ function BankConnection({policyID}: BankConnectionStepProps) {
40
39
const renderLoading = ( ) => < FullScreenLoadingIndicator /> ;
41
40
42
41
const handleBackButtonPress = ( ) => {
43
- setWebViewOpen ( false ) ;
44
42
if ( bankName === CONST . COMPANY_CARDS . BANKS . BREX ) {
45
43
CompanyCards . setAddNewCompanyCardStepAndData ( { step : CONST . COMPANY_CARDS . STEP . SELECT_BANK } ) ;
46
44
return ;
@@ -52,10 +50,6 @@ function BankConnection({policyID}: BankConnectionStepProps) {
52
50
CompanyCards . setAddNewCompanyCardStepAndData ( { step : CONST . COMPANY_CARDS . STEP . SELECT_FEED_TYPE } ) ;
53
51
} ;
54
52
55
- useEffect ( ( ) => {
56
- setWebViewOpen ( true ) ;
57
- } , [ ] ) ;
58
-
59
53
useEffect ( ( ) => {
60
54
if ( ! url ) {
61
55
return ;
@@ -69,11 +63,12 @@ function BankConnection({policyID}: BankConnectionStepProps) {
69
63
} , [ isNewFeedConnected , newFeed , policyID , url ] ) ;
70
64
71
65
return (
72
- < Modal
73
- onClose = { handleBackButtonPress }
74
- fullscreen
75
- isVisible = { isWebViewOpen }
76
- type = { CONST . MODAL . MODAL_TYPE . CENTERED_UNSWIPEABLE }
66
+ < ScreenWrapper
67
+ testID = { BankConnection . displayName }
68
+ shouldShowOfflineIndicator = { false }
69
+ includeSafeAreaPaddingBottom = { false }
70
+ shouldEnablePickerAvoiding = { false }
71
+ shouldEnableMaxHeight
77
72
>
78
73
< HeaderWithBackButton
79
74
title = { translate ( 'workspace.companyCards.addCards' ) }
@@ -96,7 +91,7 @@ function BankConnection({policyID}: BankConnectionStepProps) {
96
91
/>
97
92
) }
98
93
</ FullPageOfflineBlockingView >
99
- </ Modal >
94
+ </ ScreenWrapper >
100
95
) ;
101
96
}
102
97
0 commit comments