diff --git a/README.md b/README.md index 92e42f2..2beff79 100644 --- a/README.md +++ b/README.md @@ -10,4 +10,5 @@ - [ ] 弹出键盘不遮挡输入框 - [ ] 根据像素比例设置登录背景图片大小 -- [ ] 添加应用图标 \ No newline at end of file +- [ ] 添加应用图标 +- [ ] 适配 iOS 登录失败 toast \ No newline at end of file diff --git a/src/ui/YooLoginUI.js b/src/ui/YooLoginUI.js index 65dc767..d4fba19 100644 --- a/src/ui/YooLoginUI.js +++ b/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 (