Fix login state
This commit is contained in:
parent
298e551f61
commit
c4c306653d
2 changed files with 23 additions and 16 deletions
|
@ -1,6 +1,4 @@
|
|||
import React from 'react-native';
|
||||
import Immutable from 'immutable';
|
||||
|
||||
import GlobalStyles from '../../settings/styles';
|
||||
|
||||
const {
|
||||
|
@ -47,13 +45,20 @@ const styles = StyleSheet.create({
|
|||
export default class Login extends React.Component {
|
||||
constructor() {
|
||||
super();
|
||||
this.state = Immutable.Map({
|
||||
password: '',
|
||||
});
|
||||
this.state = {
|
||||
|
||||
};
|
||||
this.validate = this.validate.bind(this);
|
||||
this.updateState = this.updateState.bind(this);
|
||||
}
|
||||
|
||||
updateState(key, value) {
|
||||
let state = this.state;
|
||||
state[key] = value;
|
||||
this.setState(state);
|
||||
}
|
||||
|
||||
validate() {
|
||||
|
||||
}
|
||||
|
||||
componentWillMount() {
|
||||
|
@ -69,8 +74,8 @@ export default class Login extends React.Component {
|
|||
</Text>
|
||||
<TextInput
|
||||
style={styles.input}
|
||||
onChangeText={(password) => this.state.set('password', password)}
|
||||
value={this.state.get('password')}
|
||||
onChangeText={(password) => this.updateState('password', password)}
|
||||
value={this.state.password}
|
||||
onSubmitEditing={this.validate}
|
||||
placeholder="Password"
|
||||
/>
|
||||
|
|
|
@ -8,8 +8,10 @@
|
|||
"test": "npm run lint"
|
||||
},
|
||||
"dependencies": {
|
||||
"circleci": "=0.3.0",
|
||||
"immutable": "=3.7.6",
|
||||
"react-native": "=0.19.0",
|
||||
"react-native-side-menu": "=0.18.0",
|
||||
"react-native-vector-icons": "=1.0.4",
|
||||
"underscore": "=1.8.3"
|
||||
},
|
||||
|
|
Reference in a new issue