Skip to content

Commit 999c901

Browse files
committed
remove inline functions in loginCredentials
1 parent f2a26e8 commit 999c901

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

source/views/settings/sections/login-credentials.js

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,12 @@ class CredentialsLoginSection extends React.Component {
5050
this.props.logOut()
5151
}
5252

53+
getUsernameRef = ref => (this._usernameInput = ref)
54+
getPasswordRef = ref => (this._passwordInput = ref)
55+
56+
onChangeUsername = (text = '') => this.setState(() => ({username: text}))
57+
onChangePassword = (text = '') => this.setState(() => ({password: text}))
58+
5359
render() {
5460
let {loggedIn, message} = this.props
5561
let {loading, username, password} = this.state
@@ -61,9 +67,9 @@ class CredentialsLoginSection extends React.Component {
6167
>
6268
<CellTextField
6369
label="Username"
64-
_ref={ref => (this._usernameInput = ref)}
70+
_ref={this.getUsernameRef}
6571
disabled={loading}
66-
onChangeText={(text = '') => this.setState({username: text})}
72+
onChangeText={this.onChangeUsername}
6773
onSubmitEditing={this.focusPassword}
6874
placeholder="username"
6975
returnKeyType="next"
@@ -73,9 +79,9 @@ class CredentialsLoginSection extends React.Component {
7379

7480
<CellTextField
7581
label="Password"
76-
_ref={ref => (this._passwordInput = ref)}
82+
_ref={this.getPasswordRef}
7783
disabled={loading}
78-
onChangeText={(text = '') => this.setState({password: text})}
84+
onChangeText={this.onChangePassword}
7985
onSubmitEditing={loggedIn ? noop : this.logIn}
8086
placeholder="password"
8187
returnKeyType="done"

0 commit comments

Comments
 (0)