@@ -36,8 +36,8 @@ const propTypes = {
36
36
/** Error set when handling the API response */
37
37
error : PropTypes . string ,
38
38
39
- /** A list of existing owners, set if the bank account being added is already owned */
40
- existingOwnersList : PropTypes . string ,
39
+ /** The existing owners for if the bank account is already owned */
40
+ existingOwners : PropTypes . arrayOf ( PropTypes . string ) ,
41
41
} ) . isRequired ,
42
42
43
43
...withLocalizePropTypes ,
@@ -129,8 +129,9 @@ class BankAccountStep extends React.Component {
129
129
// Disable bank account fields once they've been added in db so they can't be changed
130
130
const isFromPlaid = this . props . achData . setupType === CONST . BANK_ACCOUNT . SETUP_TYPE . PLAID ;
131
131
const shouldDisableInputs = Boolean ( this . props . achData . bankAccountID ) || isFromPlaid ;
132
+ const existingOwners = this . props . reimbursementAccount . existingOwners ;
132
133
const isExistingOwnersErrorVisible = Boolean ( this . props . reimbursementAccount . error
133
- && this . props . reimbursementAccount . existingOwnersList ) ;
134
+ && existingOwners ) ;
134
135
return (
135
136
< View style = { [ styles . flex1 , styles . justifyContentBetween ] } >
136
137
< HeaderWithCloseButton
@@ -252,14 +253,26 @@ class BankAccountStep extends React.Component {
252
253
onConfirm = { hideExistingOwnersError }
253
254
shouldShowCancelButton = { false }
254
255
prompt = { (
255
- < View style = { [ styles . flex1 ] } >
256
+ < View >
256
257
< Text style = { [ styles . mb4 ] } >
257
258
< Text >
258
259
{ this . props . translate ( 'bankAccount.error.existingOwners.alreadyInUse' ) }
259
260
</ Text >
260
- < Text style = { styles . textStrong } >
261
- { this . props . reimbursementAccount . existingOwnersList }
262
- </ Text >
261
+ { existingOwners && existingOwners . map ( ( existingOwner , i ) => {
262
+ let separator = ', ' ;
263
+ if ( i === 0 ) {
264
+ separator = '' ;
265
+ } else if ( i === existingOwners . length - 1 ) {
266
+ separator = ` ${ this . props . translate ( 'common.and' ) } ` ;
267
+ }
268
+ return (
269
+ < >
270
+ < Text > { separator } </ Text >
271
+ < Text style = { styles . textStrong } > { existingOwner } </ Text >
272
+ { i === existingOwners . length - 1 && < Text > .</ Text > }
273
+ </ >
274
+ ) ;
275
+ } ) }
263
276
</ Text >
264
277
< Text style = { [ styles . mb4 ] } >
265
278
{ this . props . translate ( 'bankAccount.error.existingOwners.pleaseAskThemToShare' ) }
0 commit comments