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 React from 'react-native';
|
||||||
import Immutable from 'immutable';
|
|
||||||
|
|
||||||
import GlobalStyles from '../../settings/styles';
|
import GlobalStyles from '../../settings/styles';
|
||||||
|
|
||||||
const {
|
const {
|
||||||
|
@ -47,13 +45,20 @@ const styles = StyleSheet.create({
|
||||||
export default class Login extends React.Component {
|
export default class Login extends React.Component {
|
||||||
constructor() {
|
constructor() {
|
||||||
super();
|
super();
|
||||||
this.state = Immutable.Map({
|
this.state = {
|
||||||
password: '',
|
|
||||||
});
|
};
|
||||||
|
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() {
|
validate() {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
componentWillMount() {
|
componentWillMount() {
|
||||||
|
@ -69,8 +74,8 @@ export default class Login extends React.Component {
|
||||||
</Text>
|
</Text>
|
||||||
<TextInput
|
<TextInput
|
||||||
style={styles.input}
|
style={styles.input}
|
||||||
onChangeText={(password) => this.state.set('password', password)}
|
onChangeText={(password) => this.updateState('password', password)}
|
||||||
value={this.state.get('password')}
|
value={this.state.password}
|
||||||
onSubmitEditing={this.validate}
|
onSubmitEditing={this.validate}
|
||||||
placeholder="Password"
|
placeholder="Password"
|
||||||
/>
|
/>
|
||||||
|
|
18
package.json
18
package.json
|
@ -8,18 +8,20 @@
|
||||||
"test": "npm run lint"
|
"test": "npm run lint"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
"circleci": "=0.3.0",
|
||||||
"immutable": "=3.7.6",
|
"immutable": "=3.7.6",
|
||||||
"react-native": "=0.19.0",
|
"react-native": "=0.19.0",
|
||||||
|
"react-native-side-menu": "=0.18.0",
|
||||||
"react-native-vector-icons": "=1.0.4",
|
"react-native-vector-icons": "=1.0.4",
|
||||||
"underscore": "=1.8.3"
|
"underscore": "=1.8.3"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"babel-eslint": "=4.1.6",
|
"babel-eslint": "=4.1.6",
|
||||||
"eslint": "=1.10.3",
|
"eslint": "=1.10.3",
|
||||||
"eslint-config": "git://github.com/oleous/eslint-config.git",
|
"eslint-config": "git://github.com/oleous/eslint-config.git",
|
||||||
"eslint-plugin-react": "=3.14.0",
|
"eslint-plugin-react": "=3.14.0",
|
||||||
"eslint-plugin-react-native": "=0.5.0",
|
"eslint-plugin-react-native": "=0.5.0",
|
||||||
"react": "=0.14.6",
|
"react": "=0.14.6",
|
||||||
"react-addons-test-utils": "=0.14.6"
|
"react-addons-test-utils": "=0.14.6"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Reference in a new issue