Fix login when changing servers

This commit is contained in:
Rodrigo Nascimento 2017-08-14 11:25:17 -03:00
parent 6181c6986e
commit 195a795394
3 changed files with 7 additions and 1 deletions

View File

@ -388,6 +388,10 @@ const RocketChat = {
return resolve(result); return resolve(result);
}); });
}); });
},
logout() {
return AsyncStorage.clear();
} }
}; };

View File

@ -118,7 +118,7 @@ export default class LoginView extends React.Component {
render() { render() {
return ( return (
<KeyboardView style={styles.view}> <KeyboardView style={styles.view} keyboardVerticalOffset={64}>
<TextInput <TextInput
style={styles.input} style={styles.input}
onChangeText={username => this.setState({ username })} onChangeText={username => this.setState({ username })}

View File

@ -8,6 +8,7 @@ import { connect } from 'react-redux';
import * as actions from '../actions'; import * as actions from '../actions';
import realm from '../lib/realm'; import realm from '../lib/realm';
import RocketChat from '../lib/rocketchat';
const styles = StyleSheet.create({ const styles = StyleSheet.create({
view: { view: {
@ -130,6 +131,7 @@ export default class ListServerView extends React.Component {
} }
onPressItem = (item) => { onPressItem = (item) => {
RocketChat.logout();
Navigation.dismissModal({ Navigation.dismissModal({
animationType: 'slide-down' animationType: 'slide-down'
}); });