Last active
June 16, 2016 14:21
-
-
Save fakenickels/637d7575fd970759e4f9c2538475719c to your computer and use it in GitHub Desktop.
Testing article
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from 'react'; | |
import { | |
View, | |
Text, | |
TextInput, | |
TouchableHighlight, | |
} from 'react-native'; | |
import Meteor from 'react-native-meteor'; | |
import { Actions } from 'react-native-router-flux'; | |
export default class Login extends React.Component { | |
constructor(props){ | |
super(props); | |
this.state = { | |
email: null, | |
password: null, | |
}; | |
} | |
render(){ | |
return ( | |
<View> | |
<TextInput | |
secureTextEntry={true} | |
onChangeText={val => this.setState({email: val})} | |
/> | |
<TextInput | |
keyboardType="secure" | |
onChangeText={val => this.setState({password: val})} | |
/> | |
<TouchableHighlight | |
onPress={this._login.bind(this)} | |
/> | |
</View> | |
); | |
}, | |
_login(){ | |
const { email, password } = this.state; | |
Meteor.loginWithPassword(email, password, error => { | |
if(error) return; | |
Actions.dashboard(); | |
}); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment