Newer
Older
import { TextInput, StyleSheet } from 'react-native';
import RocketChat from '../lib/rocketchat';
import KeyboardView from '../components/KeyboardView';
const styles = StyleSheet.create({
view: {
flex: 1,
flexDirection: 'column',
justifyContent: 'center',
alignItems: 'stretch',
backgroundColor: '#fff'
},
input: {
height: 40,
borderColor: '#aaa',
marginLeft: 20,
marginRight: 20,
marginTop: 10,
padding: 5,
borderWidth: 0,
backgroundColor: '#f6f6f6'
}
});
export default class LoginView extends React.Component {
static propTypes = {
navigator: PropTypes.object.isRequired
});
constructor(props) {
super(props);
this.state = {
this.props.navigator.setTitle({
title: 'Login'
});
this.props.navigator.setSubTitle({
subtitle: RocketChat.currentServer
});
}
submit = () => {
RocketChat.loginWithPassword({ username: this.state.username }, this.state.password, () => {
this.props.navigator.dismissModal();
});
onChangeText={username => this.setState({ username })}
keyboardType='email-address'
autoCorrect={false}
returnKeyType='done'
autoCapitalize='none'
onChangeText={password => this.setState({ password })}
secureTextEntry
autoCorrect={false}
returnKeyType='done'
autoCapitalize='none'
onSubmitEditing={this.submit}