Skip to content

Commit e4f4ed7

Browse files
authored
Merge pull request #4402 from aman-atg/aman-atg-autoFocusWorkspacePage
add autofocus
2 parents 585a906 + 18494fa commit e4f4ed7

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

src/pages/workspace/WorkspaceInvitePage.js

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,9 @@ class WorkspaceInvitePage extends React.Component {
5555
welcomeNote: '',
5656
};
5757

58+
this.focusEmailOrPhoneInput = this.focusEmailOrPhoneInput.bind(this);
5859
this.inviteUser = this.inviteUser.bind(this);
60+
this.emailOrPhoneInputRef = null;
5961
}
6062

6163
/**
@@ -69,6 +71,13 @@ class WorkspaceInvitePage extends React.Component {
6971
});
7072
}
7173

74+
focusEmailOrPhoneInput() {
75+
if (!this.emailOrPhoneInputRef) {
76+
return;
77+
}
78+
this.emailOrPhoneInputRef.focus();
79+
}
80+
7281
/**
7382
* Handle the invite button click
7483
*/
@@ -93,7 +102,7 @@ class WorkspaceInvitePage extends React.Component {
93102

94103
render() {
95104
return (
96-
<ScreenWrapper>
105+
<ScreenWrapper onTransitionEnd={this.focusEmailOrPhoneInput}>
97106
<KeyboardAvoidingView>
98107
<HeaderWithCloseButton
99108
title={this.props.translate('workspace.invite.invitePeople')}
@@ -105,6 +114,7 @@ class WorkspaceInvitePage extends React.Component {
105114
</Text>
106115
<View style={styles.mb6}>
107116
<ExpensiTextInput
117+
ref={el => this.emailOrPhoneInputRef = el}
108118
label={this.props.translate('workspace.invite.enterEmailOrPhone')}
109119
autoCompleteType="email"
110120
autoCorrect={false}

0 commit comments

Comments
 (0)