1
1
import React , { useCallback , useMemo } from 'react' ;
2
2
import { ActivityIndicator , View } from 'react-native' ;
3
3
import { useOnyx } from 'react-native-onyx' ;
4
+ import AddressSearch from '@components/AddressSearch' ;
4
5
import FormProvider from '@components/Form/FormProvider' ;
5
6
import InputWrapper from '@components/Form/InputWrapper' ;
6
7
import type { FormInputErrors , FormOnyxKeys , FormOnyxValues } from '@components/Form/types' ;
@@ -16,6 +17,14 @@ import getInputForValueSet from '@pages/ReimbursementAccount/NonUSD/utils/getInp
16
17
import CONST from '@src/CONST' ;
17
18
import ONYXKEYS from '@src/ONYXKEYS' ;
18
19
import type { ReimbursementAccountForm } from '@src/types/form' ;
20
+ import type { CorpayFormField } from '@src/types/onyx' ;
21
+
22
+ function getInputComponent ( field : CorpayFormField ) {
23
+ if ( CONST . CORPAY_FIELDS . SPECIAL_LIST_ADDRESS_KEYS . includes ( field . id ) ) {
24
+ return AddressSearch ;
25
+ }
26
+ return TextInput ;
27
+ }
19
28
20
29
function BankAccountDetails ( { onNext, isEditing, corpayFields} : BankInfoSubStepProps ) {
21
30
const { translate} = useLocalize ( ) ;
@@ -87,18 +96,24 @@ function BankAccountDetails({onNext, isEditing, corpayFields}: BankInfoSubStepPr
87
96
key = { field . id }
88
97
>
89
98
< InputWrapper
90
- InputComponent = { TextInput }
99
+ InputComponent = { getInputComponent ( field ) }
91
100
inputID = { field . id }
92
101
label = { field . label }
93
102
aria-label = { field . label }
94
103
role = { CONST . ROLE . PRESENTATION }
95
104
shouldSaveDraft = { ! isEditing }
96
105
defaultValue = { String ( defaultValues [ field . id as keyof typeof defaultValues ] ) ?? '' }
106
+ limitSearchesToCountry = { reimbursementAccountDraft ?. country }
107
+ renamedInputKeys = { {
108
+ street : 'bankAddressLine1' ,
109
+ city : 'bankCity' ,
110
+ country : '' ,
111
+ } }
97
112
/>
98
113
</ View >
99
114
) ;
100
115
} ) ;
101
- } , [ bankAccountDetailsFields , styles , isEditing , defaultValues ] ) ;
116
+ } , [ bankAccountDetailsFields , styles , isEditing , defaultValues , reimbursementAccountDraft ?. country ] ) ;
102
117
103
118
return (
104
119
< FormProvider
0 commit comments