From f342ea0c876f12bc512c4156242a1d6dd8a7a468 Mon Sep 17 00:00:00 2001 From: Yauheni Date: Mon, 16 Oct 2023 20:13:22 +0200 Subject: [PATCH 1/7] Fix bug with keyboard is not consistent in safari --- src/pages/signin/LoginForm/BaseLoginForm.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pages/signin/LoginForm/BaseLoginForm.js b/src/pages/signin/LoginForm/BaseLoginForm.js index 3576f92be31f..12e09d16c7a1 100644 --- a/src/pages/signin/LoginForm/BaseLoginForm.js +++ b/src/pages/signin/LoginForm/BaseLoginForm.js @@ -213,6 +213,7 @@ function LoginForm(props) { accessibilityLabel={translate('loginForm.phoneOrEmail')} accessibilityRole={CONST.ACCESSIBILITY_ROLE.TEXT} value={login} + returnKeyType="done" autoCompleteType="username" textContentType="username" nativeID="username" @@ -221,7 +222,6 @@ function LoginForm(props) { onSubmitEditing={validateAndSubmitForm} autoCapitalize="none" autoCorrect={false} - keyboardType={CONST.KEYBOARD_TYPE.EMAIL_ADDRESS} errorText={formErrorText} hasError={hasError} maxLength={CONST.LOGIN_CHARACTER_LIMIT} From fe63fc9ed84dc0118946c6456d5302bba8e2bb8f Mon Sep 17 00:00:00 2001 From: Yauheni Date: Mon, 16 Oct 2023 20:26:24 +0200 Subject: [PATCH 2/7] Update login file using formatter --- src/pages/signin/LoginForm/BaseLoginForm.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pages/signin/LoginForm/BaseLoginForm.js b/src/pages/signin/LoginForm/BaseLoginForm.js index 12e09d16c7a1..0c14555c45b3 100644 --- a/src/pages/signin/LoginForm/BaseLoginForm.js +++ b/src/pages/signin/LoginForm/BaseLoginForm.js @@ -213,7 +213,7 @@ function LoginForm(props) { accessibilityLabel={translate('loginForm.phoneOrEmail')} accessibilityRole={CONST.ACCESSIBILITY_ROLE.TEXT} value={login} - returnKeyType="done" + returnKeyType="done" autoCompleteType="username" textContentType="username" nativeID="username" From 0abf5f53808033939fb635cec5a8be3216fbd4d4 Mon Sep 17 00:00:00 2001 From: Yauheni Date: Mon, 16 Oct 2023 20:56:00 +0200 Subject: [PATCH 3/7] Update text button --- src/pages/signin/LoginForm/BaseLoginForm.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/pages/signin/LoginForm/BaseLoginForm.js b/src/pages/signin/LoginForm/BaseLoginForm.js index 0c14555c45b3..8adedde6d546 100644 --- a/src/pages/signin/LoginForm/BaseLoginForm.js +++ b/src/pages/signin/LoginForm/BaseLoginForm.js @@ -213,7 +213,7 @@ function LoginForm(props) { accessibilityLabel={translate('loginForm.phoneOrEmail')} accessibilityRole={CONST.ACCESSIBILITY_ROLE.TEXT} value={login} - returnKeyType="done" + returnKeyType="go" autoCompleteType="username" textContentType="username" nativeID="username" @@ -222,6 +222,7 @@ function LoginForm(props) { onSubmitEditing={validateAndSubmitForm} autoCapitalize="none" autoCorrect={false} + keyboardType={CONST.KEYBOARD_TYPE.EMAIL_ADDRESS} errorText={formErrorText} hasError={hasError} maxLength={CONST.LOGIN_CHARACTER_LIMIT} From bd3e4f4688c4aa73e14ee41221c526cc19403dd5 Mon Sep 17 00:00:00 2001 From: Yauheni Date: Wed, 18 Oct 2023 08:30:29 +0200 Subject: [PATCH 4/7] Add condition for returnKeyType --- src/pages/signin/LoginForm/BaseLoginForm.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/pages/signin/LoginForm/BaseLoginForm.js b/src/pages/signin/LoginForm/BaseLoginForm.js index 8adedde6d546..bf58300c2b9c 100644 --- a/src/pages/signin/LoginForm/BaseLoginForm.js +++ b/src/pages/signin/LoginForm/BaseLoginForm.js @@ -33,6 +33,7 @@ import Log from '../../../libs/Log'; import withNavigationFocus, {withNavigationFocusPropTypes} from '../../../components/withNavigationFocus'; import usePrevious from '../../../hooks/usePrevious'; import * as MemoryOnlyKeys from '../../../libs/actions/MemoryOnlyKeys/MemoryOnlyKeys'; +import getPlatform from '../../../libs/getPlatform'; const propTypes = { /** Should we dismiss the keyboard when transitioning away from the page? */ @@ -200,6 +201,7 @@ function LoginForm(props) { const formErrorText = useMemo(() => (formError ? translate(formError) : ''), [formError, translate]); const serverErrorText = useMemo(() => ErrorUtils.getLatestErrorMessage(props.account), [props.account]); const hasError = !_.isEmpty(serverErrorText); + const returnKeyType = getPlatform() === CONST.PLATFORM.ANDROID ? 'go' : 'done'; return ( <> @@ -213,7 +215,7 @@ function LoginForm(props) { accessibilityLabel={translate('loginForm.phoneOrEmail')} accessibilityRole={CONST.ACCESSIBILITY_ROLE.TEXT} value={login} - returnKeyType="go" + returnKeyType={returnKeyType} autoCompleteType="username" textContentType="username" nativeID="username" From 43eb00d91cae6478d325e007547ff43976295ef3 Mon Sep 17 00:00:00 2001 From: Yauheni Date: Wed, 18 Oct 2023 09:53:26 +0200 Subject: [PATCH 5/7] Add getReturnKeyType function --- src/components/TextInput/BaseTextInput.js | 2 ++ src/libs/getReturnKeyType/index.android.ts | 16 ++++++++++++++++ src/libs/getReturnKeyType/index.ts | 8 ++++++++ src/libs/getReturnKeyType/types.ts | 3 +++ src/pages/signin/LoginForm/BaseLoginForm.js | 4 +--- 5 files changed, 30 insertions(+), 3 deletions(-) create mode 100644 src/libs/getReturnKeyType/index.android.ts create mode 100644 src/libs/getReturnKeyType/index.ts create mode 100644 src/libs/getReturnKeyType/types.ts diff --git a/src/components/TextInput/BaseTextInput.js b/src/components/TextInput/BaseTextInput.js index 9bfdc79fad68..65b8afd2fb1b 100644 --- a/src/components/TextInput/BaseTextInput.js +++ b/src/components/TextInput/BaseTextInput.js @@ -15,6 +15,7 @@ import * as StyleUtils from '../../styles/StyleUtils'; import variables from '../../styles/variables'; import Checkbox from '../Checkbox'; import getSecureEntryKeyboardType from '../../libs/getSecureEntryKeyboardType'; +import getReturnKeyType from '../../libs/getReturnKeyType'; import CONST from '../../CONST'; import FormHelpMessage from '../FormHelpMessage'; import isInputAutoFilled from '../../libs/isInputAutoFilled'; @@ -355,6 +356,7 @@ function BaseTextInput(props) { secureTextEntry={passwordHidden} onPressOut={props.onPress} showSoftInputOnFocus={!props.disableKeyboard} + returnKeyType={getReturnKeyType(props.returnKeyType, props.keyboardType)} keyboardType={getSecureEntryKeyboardType(props.keyboardType, props.secureTextEntry, passwordHidden)} value={props.value} selection={props.selection} diff --git a/src/libs/getReturnKeyType/index.android.ts b/src/libs/getReturnKeyType/index.android.ts new file mode 100644 index 000000000000..29822d087a27 --- /dev/null +++ b/src/libs/getReturnKeyType/index.android.ts @@ -0,0 +1,16 @@ +import CONST from '../../CONST'; +import GetReturnKeyType from './types'; + +/** + * Return returnKeyType passed as function parameter on Android + * Due to the fact that in the Android browser some keyboardTypes change the confirmation icon and ignore keyboardType, the ability to change the confirmation icon in the Android app to the one used in the browser has been added + */ +const getReturnKeyType: GetReturnKeyType = (returnKeyType, keyboardType) => { + if (keyboardType === CONST.KEYBOARD_TYPE.URL || keyboardType === CONST.KEYBOARD_TYPE.EMAIL_ADDRESS) { + return 'go'; + } + + return returnKeyType; +}; + +export default getReturnKeyType; diff --git a/src/libs/getReturnKeyType/index.ts b/src/libs/getReturnKeyType/index.ts new file mode 100644 index 000000000000..f08caef044a8 --- /dev/null +++ b/src/libs/getReturnKeyType/index.ts @@ -0,0 +1,8 @@ +import GetReturnKeyType from './types'; + +/** + * Return returnKeyType passed as function parameter on Web/Desktop/iOS + */ +const getReturnKeyType: GetReturnKeyType = (returnKeyType) => returnKeyType; + +export default getReturnKeyType; diff --git a/src/libs/getReturnKeyType/types.ts b/src/libs/getReturnKeyType/types.ts new file mode 100644 index 000000000000..4fc780b143a6 --- /dev/null +++ b/src/libs/getReturnKeyType/types.ts @@ -0,0 +1,3 @@ +type GetReturnKeyType = (returnKeyType: string, keyboardType: string) => string; + +export default GetReturnKeyType; diff --git a/src/pages/signin/LoginForm/BaseLoginForm.js b/src/pages/signin/LoginForm/BaseLoginForm.js index bf58300c2b9c..2ff0f2466762 100644 --- a/src/pages/signin/LoginForm/BaseLoginForm.js +++ b/src/pages/signin/LoginForm/BaseLoginForm.js @@ -33,7 +33,6 @@ import Log from '../../../libs/Log'; import withNavigationFocus, {withNavigationFocusPropTypes} from '../../../components/withNavigationFocus'; import usePrevious from '../../../hooks/usePrevious'; import * as MemoryOnlyKeys from '../../../libs/actions/MemoryOnlyKeys/MemoryOnlyKeys'; -import getPlatform from '../../../libs/getPlatform'; const propTypes = { /** Should we dismiss the keyboard when transitioning away from the page? */ @@ -201,7 +200,6 @@ function LoginForm(props) { const formErrorText = useMemo(() => (formError ? translate(formError) : ''), [formError, translate]); const serverErrorText = useMemo(() => ErrorUtils.getLatestErrorMessage(props.account), [props.account]); const hasError = !_.isEmpty(serverErrorText); - const returnKeyType = getPlatform() === CONST.PLATFORM.ANDROID ? 'go' : 'done'; return ( <> @@ -215,7 +213,7 @@ function LoginForm(props) { accessibilityLabel={translate('loginForm.phoneOrEmail')} accessibilityRole={CONST.ACCESSIBILITY_ROLE.TEXT} value={login} - returnKeyType={returnKeyType} + returnKeyType="done" autoCompleteType="username" textContentType="username" nativeID="username" From 585e890b796652c8aa7bffc80f597d1e8541395c Mon Sep 17 00:00:00 2001 From: Yauheni Date: Thu, 19 Oct 2023 18:32:28 +0200 Subject: [PATCH 6/7] Revert changes --- src/components/TextInput/BaseTextInput.js | 2 -- src/libs/getReturnKeyType/index.android.ts | 16 ---------------- src/libs/getReturnKeyType/index.ts | 8 -------- src/libs/getReturnKeyType/types.ts | 3 --- .../Profile/Contacts/NewContactMethodPage.js | 2 +- src/pages/signin/LoginForm/BaseLoginForm.js | 2 +- 6 files changed, 2 insertions(+), 31 deletions(-) delete mode 100644 src/libs/getReturnKeyType/index.android.ts delete mode 100644 src/libs/getReturnKeyType/index.ts delete mode 100644 src/libs/getReturnKeyType/types.ts diff --git a/src/components/TextInput/BaseTextInput.js b/src/components/TextInput/BaseTextInput.js index 65b8afd2fb1b..9bfdc79fad68 100644 --- a/src/components/TextInput/BaseTextInput.js +++ b/src/components/TextInput/BaseTextInput.js @@ -15,7 +15,6 @@ import * as StyleUtils from '../../styles/StyleUtils'; import variables from '../../styles/variables'; import Checkbox from '../Checkbox'; import getSecureEntryKeyboardType from '../../libs/getSecureEntryKeyboardType'; -import getReturnKeyType from '../../libs/getReturnKeyType'; import CONST from '../../CONST'; import FormHelpMessage from '../FormHelpMessage'; import isInputAutoFilled from '../../libs/isInputAutoFilled'; @@ -356,7 +355,6 @@ function BaseTextInput(props) { secureTextEntry={passwordHidden} onPressOut={props.onPress} showSoftInputOnFocus={!props.disableKeyboard} - returnKeyType={getReturnKeyType(props.returnKeyType, props.keyboardType)} keyboardType={getSecureEntryKeyboardType(props.keyboardType, props.secureTextEntry, passwordHidden)} value={props.value} selection={props.selection} diff --git a/src/libs/getReturnKeyType/index.android.ts b/src/libs/getReturnKeyType/index.android.ts deleted file mode 100644 index 29822d087a27..000000000000 --- a/src/libs/getReturnKeyType/index.android.ts +++ /dev/null @@ -1,16 +0,0 @@ -import CONST from '../../CONST'; -import GetReturnKeyType from './types'; - -/** - * Return returnKeyType passed as function parameter on Android - * Due to the fact that in the Android browser some keyboardTypes change the confirmation icon and ignore keyboardType, the ability to change the confirmation icon in the Android app to the one used in the browser has been added - */ -const getReturnKeyType: GetReturnKeyType = (returnKeyType, keyboardType) => { - if (keyboardType === CONST.KEYBOARD_TYPE.URL || keyboardType === CONST.KEYBOARD_TYPE.EMAIL_ADDRESS) { - return 'go'; - } - - return returnKeyType; -}; - -export default getReturnKeyType; diff --git a/src/libs/getReturnKeyType/index.ts b/src/libs/getReturnKeyType/index.ts deleted file mode 100644 index f08caef044a8..000000000000 --- a/src/libs/getReturnKeyType/index.ts +++ /dev/null @@ -1,8 +0,0 @@ -import GetReturnKeyType from './types'; - -/** - * Return returnKeyType passed as function parameter on Web/Desktop/iOS - */ -const getReturnKeyType: GetReturnKeyType = (returnKeyType) => returnKeyType; - -export default getReturnKeyType; diff --git a/src/libs/getReturnKeyType/types.ts b/src/libs/getReturnKeyType/types.ts deleted file mode 100644 index 4fc780b143a6..000000000000 --- a/src/libs/getReturnKeyType/types.ts +++ /dev/null @@ -1,3 +0,0 @@ -type GetReturnKeyType = (returnKeyType: string, keyboardType: string) => string; - -export default GetReturnKeyType; diff --git a/src/pages/settings/Profile/Contacts/NewContactMethodPage.js b/src/pages/settings/Profile/Contacts/NewContactMethodPage.js index cce43117d4f2..480c425a9094 100644 --- a/src/pages/settings/Profile/Contacts/NewContactMethodPage.js +++ b/src/pages/settings/Profile/Contacts/NewContactMethodPage.js @@ -122,7 +122,7 @@ function NewContactMethodPage(props) { ref={(el) => (loginInputRef.current = el)} inputID="phoneOrEmail" autoCapitalize="none" - returnKeyType="done" + returnKeyType="go" maxLength={CONST.LOGIN_CHARACTER_LIMIT} /> diff --git a/src/pages/signin/LoginForm/BaseLoginForm.js b/src/pages/signin/LoginForm/BaseLoginForm.js index 2ff0f2466762..8adedde6d546 100644 --- a/src/pages/signin/LoginForm/BaseLoginForm.js +++ b/src/pages/signin/LoginForm/BaseLoginForm.js @@ -213,7 +213,7 @@ function LoginForm(props) { accessibilityLabel={translate('loginForm.phoneOrEmail')} accessibilityRole={CONST.ACCESSIBILITY_ROLE.TEXT} value={login} - returnKeyType="done" + returnKeyType="go" autoCompleteType="username" textContentType="username" nativeID="username" From 63218c967fe5eccdf523c014200f0fa529c78e49 Mon Sep 17 00:00:00 2001 From: Yauheni Date: Fri, 20 Oct 2023 11:31:00 +0200 Subject: [PATCH 7/7] Update returnKeyType for PDFPasswordForm --- src/components/PDFView/PDFPasswordForm.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/PDFView/PDFPasswordForm.js b/src/components/PDFView/PDFPasswordForm.js index 58a4e64a28a5..6b6163992589 100644 --- a/src/components/PDFView/PDFPasswordForm.js +++ b/src/components/PDFView/PDFPasswordForm.js @@ -131,7 +131,7 @@ function PDFPasswordForm({isFocused, isPasswordInvalid, shouldShowLoadingIndicat autoCorrect={false} textContentType="password" onChangeText={updatePassword} - returnKeyType="done" + returnKeyType="go" onSubmitEditing={submitPassword} errorText={errorText} onFocus={() => onPasswordFieldFocused(true)}