[英]Native Base spinner not working
I am trying to show a spinner on press of button in react-native, native-base after username is entered. 输入用户名后,我试图显示在react-native,native-base中按下按钮时的微调器。 It is not working.
它不起作用。 Here are my steps and code:
这是我的步骤和代码:
Steps: 脚步:
if loading true render spinner else load other screen. 如果加载true渲染微调器,则加载其他屏幕。
constructor(props) { super(props); this.state = { loading: true, } handleLoginPressed = async () => { //some code let resp = await tryAsk(this.state.sampleQuestion, this.state.username); this.setState({ loading: false }); } render() { if (this.state.fontsAreLoaded == true) { if (this.state.isLoggedIn === true) { if (this.state.loading === true){ <View><Spinner /></View> }else{ return ( <Somescreen/> ); } }
you forget return
你忘记了
return
constructor(props) {
super(props);
this.state = {
loading: true,
}
handleLoginPressed = async () => {
//some code
let resp = await tryAsk(this.state.sampleQuestion, this.state.username);
this.setState({
loading: false
});
}
render() {
if (this.state.fontsAreLoaded == true) {
if (this.state.isLoggedIn === true) {
if (this.state.loading === true){
return <Spinner />
}else{
return (
<Somescreen/>
);
}
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.