From 470103fa89461b569199f93bebf968304d1be0b4 Mon Sep 17 00:00:00 2001 From: daraksha Date: Tue, 24 Jan 2023 19:21:34 +0530 Subject: [PATCH 1/2] Enable autoFocus by default & add shouldDelayFocus for Android --- src/components/PDFView/PDFPasswordForm.js | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/components/PDFView/PDFPasswordForm.js b/src/components/PDFView/PDFPasswordForm.js index 5661d5d49b0b..31bf8edb1544 100644 --- a/src/components/PDFView/PDFPasswordForm.js +++ b/src/components/PDFView/PDFPasswordForm.js @@ -10,14 +10,12 @@ import PDFInfoMessage from './PDFInfoMessage'; import compose from '../../libs/compose'; import withLocalize, {withLocalizePropTypes} from '../withLocalize'; import withWindowDimensions, {windowDimensionsPropTypes} from '../withWindowDimensions'; +import shouldDelayFocus from '../../libs/shouldDelayFocus'; const propTypes = { /** If the submitted password is invalid (show an error message) */ isPasswordInvalid: PropTypes.bool, - /** If the password field should be auto-focused */ - shouldAutofocusPasswordField: PropTypes.bool, - /** If loading indicator should be shown */ shouldShowLoadingIndicator: PropTypes.bool, @@ -36,7 +34,6 @@ const propTypes = { const defaultProps = { isPasswordInvalid: false, - shouldAutofocusPasswordField: false, shouldShowLoadingIndicator: false, onSubmit: () => {}, onPasswordUpdated: () => {}, @@ -120,7 +117,8 @@ class PDFPasswordForm extends Component { errorText={this.props.isPasswordInvalid ? this.props.translate('attachmentView.passwordIncorrect') : this.state.validationErrorText} onFocus={() => this.props.onPasswordFieldFocused(true)} onBlur={this.validateAndNotifyPasswordBlur} - autoFocus={this.props.shouldAutofocusPasswordField} + autoFocus + shouldDelayFocus={shouldDelayFocus} secureTextEntry />