Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Auto open keyboard on Password and Payment pages #3839

Merged
merged 1 commit into from
Jul 1, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion src/pages/settings/PasswordPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ class PasswordPage extends Component {
};

this.handleChangePassword = this.handleChangePassword.bind(this);
this.currentPasswordInputRef = null;
}

componentWillUnmount() {
Expand All @@ -69,7 +70,12 @@ class PasswordPage extends Component {

render() {
return (
<ScreenWrapper>
<ScreenWrapper onTransitionEnd={() => {
if (this.currentPasswordInputRef) {
this.currentPasswordInputRef.focus();
}
}}
>
<KeyboardAvoidingView>
<HeaderWithCloseButton
title={this.props.translate('passwordPage.changePassword')}
Expand All @@ -86,12 +92,14 @@ class PasswordPage extends Component {
{`${this.props.translate('passwordPage.currentPassword')}*`}
</Text>
<TextInput
ref={el => this.currentPasswordInputRef = el}
secureTextEntry
autoCompleteType="password"
textContentType="password"
style={styles.textInput}
value={this.state.currentPassword}
onChangeText={currentPassword => this.setState({currentPassword})}
returnKeyType="done"
/>
</View>
<View style={styles.mb6}>
Expand Down
10 changes: 9 additions & 1 deletion src/pages/settings/PaymentsPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ class PaymentsPage extends React.Component {
payPalMeUsername: props.payPalMeUsername,
};
this.setPayPalMeUsername = this.setPayPalMeUsername.bind(this);
this.paypalUsernameInputRef = null;
}

componentDidMount() {
Expand All @@ -62,7 +63,12 @@ class PaymentsPage extends React.Component {

render() {
return (
<ScreenWrapper>
<ScreenWrapper onTransitionEnd={() => {
if (this.paypalUsernameInputRef) {
this.paypalUsernameInputRef.focus();
}
}}
>
<KeyboardAvoidingView>
<HeaderWithCloseButton
title={this.props.translate('common.payments')}
Expand All @@ -79,13 +85,15 @@ class PaymentsPage extends React.Component {
{this.props.translate('paymentsPage.payPalMe')}
</Text>
<TextInput
ref={el => this.paypalUsernameInputRef = el}
autoCompleteType="off"
autoCorrect={false}
style={[styles.textInput]}
value={this.state.payPalMeUsername}
placeholder={this.props.translate('paymentsPage.yourPayPalUsername')}
onChangeText={text => this.setState({payPalMeUsername: text})}
editable={!this.props.payPalMeUsername}
returnKeyType="done"
/>
</View>
</View>
Expand Down