Browse Source

feat: show a toast when login fails

pull/1/head
kdxcxs 4 years ago
parent
commit
c43d86b55a
  1. 1
      README.md
  2. 9
      src/ui/YooLoginUI.js

1
README.md

@ -11,3 +11,4 @@
- [ ] 弹出键盘不遮挡输入框
- [ ] 根据像素比例设置登录背景图片大小
- [ ] 添加应用图标
- [ ] 适配 iOS 登录失败 toast

9
src/ui/YooLoginUI.js

@ -7,6 +7,7 @@ import {
TouchableOpacity,
Text,
ActivityIndicator,
ToastAndroid,
} from 'react-native';
const styles = StyleSheet.create({
@ -52,15 +53,21 @@ export default class YooLoginUI extends Component {
loading: false,
};
this.onButtonPress = this.onButtonPress.bind(this);
this.onLoginFailed = this.onLoginFailed.bind(this);
}
onButtonPress() {
if (!this.state.loading) {
this.setState({loading: true});
this.props.loginCallback();
this.props.loginCallback(this.onLoginFailed);
}
}
onLoginFailed() {
this.setState({loading: false});
ToastAndroid.show('登录失败', ToastAndroid.SHORT);
}
render() {
return (
<View style={styles.container}>

Loading…
Cancel
Save