From 869289e4ce989c5752a414bc5b115f0c41ad8443 Mon Sep 17 00:00:00 2001
From: Joe Gambino <joe@expensify.com>
Date: Thu, 26 Aug 2021 13:11:44 -0400
Subject: [PATCH 1/4] Use password when new-password autoComplete is set on
 Android

---
 src/components/ExpensiTextInput/index.android.js | 1 +
 src/pages/ReimbursementAccount/CompanyStep.js    | 2 +-
 2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/components/ExpensiTextInput/index.android.js b/src/components/ExpensiTextInput/index.android.js
index 35b9a15cfd89..c8c013977ce2 100644
--- a/src/components/ExpensiTextInput/index.android.js
+++ b/src/components/ExpensiTextInput/index.android.js
@@ -7,6 +7,7 @@ const ExpensiTextInput = forwardRef((props, ref) => (
     <BaseExpensiTextInput
         // eslint-disable-next-line react/jsx-props-no-spreading
         {...props}
+        autoCompleteType={props.autoCompleteType === 'new-password' ? 'password' : props.autoCompleteType}
         innerRef={ref}
         inputStyle={[
             styles.expensiTextInput,
diff --git a/src/pages/ReimbursementAccount/CompanyStep.js b/src/pages/ReimbursementAccount/CompanyStep.js
index b9e98ea38d5a..e4c28d8805df 100644
--- a/src/pages/ReimbursementAccount/CompanyStep.js
+++ b/src/pages/ReimbursementAccount/CompanyStep.js
@@ -303,7 +303,7 @@ class CompanyStep extends React.Component {
                                 : ''}
                         />
                         <ExpensiTextInput
-                            autoCompleteType="password"
+                            autoCompleteType="new-password"
                             label={`Expensify ${this.props.translate('common.password')}`}
                             containerStyles={[styles.mt4]}
                             secureTextEntry

From 18ad92f67055536479fededc4f589651677a6a64 Mon Sep 17 00:00:00 2001
From: Joe Gambino <joe@expensify.com>
Date: Thu, 26 Aug 2021 13:31:54 -0400
Subject: [PATCH 2/4] add some comments to explain new-password value

---
 src/components/ExpensiTextInput/index.android.js | 3 +++
 src/pages/ReimbursementAccount/CompanyStep.js    | 5 ++++-
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/src/components/ExpensiTextInput/index.android.js b/src/components/ExpensiTextInput/index.android.js
index c8c013977ce2..51f25f127fe1 100644
--- a/src/components/ExpensiTextInput/index.android.js
+++ b/src/components/ExpensiTextInput/index.android.js
@@ -7,6 +7,9 @@ const ExpensiTextInput = forwardRef((props, ref) => (
     <BaseExpensiTextInput
         // eslint-disable-next-line react/jsx-props-no-spreading
         {...props}
+
+        // Setting autoCompleteType to new-password throws an error on Android, so fall back to password in that case
+        // eslint-disable-next-line react/jsx-props-no-multi-spaces
         autoCompleteType={props.autoCompleteType === 'new-password' ? 'password' : props.autoCompleteType}
         innerRef={ref}
         inputStyle={[
diff --git a/src/pages/ReimbursementAccount/CompanyStep.js b/src/pages/ReimbursementAccount/CompanyStep.js
index e4c28d8805df..cea2c7e71ab2 100644
--- a/src/pages/ReimbursementAccount/CompanyStep.js
+++ b/src/pages/ReimbursementAccount/CompanyStep.js
@@ -303,7 +303,6 @@ class CompanyStep extends React.Component {
                                 : ''}
                         />
                         <ExpensiTextInput
-                            autoCompleteType="new-password"
                             label={`Expensify ${this.props.translate('common.password')}`}
                             containerStyles={[styles.mt4]}
                             secureTextEntry
@@ -319,6 +318,10 @@ class CompanyStep extends React.Component {
                             errorText={error === this.props.translate('common.passwordCannotBeBlank')
                                 ? this.props.translate('common.passwordCannotBeBlank')
                                 : ''}
+
+                            // Use new-password to prevent an autoComplete bug https://github.com/Expensify/Expensify/issues/173177
+                            // eslint-disable-next-line react/jsx-props-no-multi-spaces
+                            autoCompleteType="new-password"
                         />
                         <CheckboxWithLabel
                             isChecked={this.state.hasNoConnectionToCannabis}

From 15c3518815b6d67116f7710b4d562b8f27082cea Mon Sep 17 00:00:00 2001
From: Joe Gambino <joe@expensify.com>
Date: Thu, 26 Aug 2021 14:01:06 -0400
Subject: [PATCH 3/4] prevent warning on iOS

---
 src/components/ExpensiTextInput/index.ios.js | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/src/components/ExpensiTextInput/index.ios.js b/src/components/ExpensiTextInput/index.ios.js
index 9e84b12d1355..fd4a823bfee5 100644
--- a/src/components/ExpensiTextInput/index.ios.js
+++ b/src/components/ExpensiTextInput/index.ios.js
@@ -7,6 +7,10 @@ const ExpensiTextInput = forwardRef((props, ref) => (
     <BaseExpensiTextInput
         // eslint-disable-next-line react/jsx-props-no-spreading
         {...props}
+
+        // Setting autoCompleteType to new-password throws an error on Android, so fall back to password in that case
+        // eslint-disable-next-line react/jsx-props-no-multi-spaces
+        autoCompleteType={props.autoCompleteType === 'new-password' ? 'password' : props.autoCompleteType}
         innerRef={ref}
         inputStyle={[styles.expensiTextInput]}
     />

From db0e12a52233c167e6cd222e071b3820a6f761b6 Mon Sep 17 00:00:00 2001
From: Joe Gambino <joe@expensify.com>
Date: Thu, 26 Aug 2021 15:16:47 -0400
Subject: [PATCH 4/4] update comment

---
 src/components/ExpensiTextInput/index.ios.js | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/components/ExpensiTextInput/index.ios.js b/src/components/ExpensiTextInput/index.ios.js
index fd4a823bfee5..9f4e039fe4bd 100644
--- a/src/components/ExpensiTextInput/index.ios.js
+++ b/src/components/ExpensiTextInput/index.ios.js
@@ -8,7 +8,7 @@ const ExpensiTextInput = forwardRef((props, ref) => (
         // eslint-disable-next-line react/jsx-props-no-spreading
         {...props}
 
-        // Setting autoCompleteType to new-password throws an error on Android, so fall back to password in that case
+        // Setting autoCompleteType to new-password throws an error on iOS, so fall back to password in that case
         // eslint-disable-next-line react/jsx-props-no-multi-spaces
         autoCompleteType={props.autoCompleteType === 'new-password' ? 'password' : props.autoCompleteType}
         innerRef={ref}
