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"
|
||||
/>
|
||||
|
|
18
package.json
18
package.json
|
@ -8,18 +8,20 @@
|
|||
"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"
|
||||
},
|
||||
"devDependencies": {
|
||||
"babel-eslint": "=4.1.6",
|
||||
"eslint": "=1.10.3",
|
||||
"eslint-config": "git://github.com/oleous/eslint-config.git",
|
||||
"eslint-plugin-react": "=3.14.0",
|
||||
"eslint-plugin-react-native": "=0.5.0",
|
||||
"react": "=0.14.6",
|
||||
"react-addons-test-utils": "=0.14.6"
|
||||
}
|
||||
"babel-eslint": "=4.1.6",
|
||||
"eslint": "=1.10.3",
|
||||
"eslint-config": "git://github.com/oleous/eslint-config.git",
|
||||
"eslint-plugin-react": "=3.14.0",
|
||||
"eslint-plugin-react-native": "=0.5.0",
|
||||
"react": "=0.14.6",
|
||||
"react-addons-test-utils": "=0.14.6"
|
||||
}
|
||||
}
|
||||
|
|
Reference in a new issue