求助,reactnative modal 显示问题

#1

有个需求需要加载网络数据的时候显示加载中,然后请求结束后显示modal,伪代码如下,为什么在数据请求回来之后setstate重新render无法显示modal呢?

render: function() {
    if (!this.props.data) {
           return (<View style={{flex:1}}>
                    <Text>loading</Text>
                </View>);
    }
    return (
        <View style={{flex:1, width:screenWidth}}>
         <Modal
                visible={true}
                transparent={true}
                onRequestClose={()=>{
                }}
                onShow={()=>{
                }}>
                <View
                    style={{flex:1,justifyContent:'center',alignItems:'center',backgroundColor:'rgba(0, 0, 0, 0.3)'}}>
                    <View style={{height:200,width:275,backgroundColor:'white'}}>
                        <Button title='confirm' onPress={()=>{}}/>
                        <Button title='cancel' onPress={()=>{}}/>
                    </View>
                </View>
            </Modal>
        </View>
    );
}
#2

先仔细检查一下语法或逻辑上有没有问题,
还有代码块最好用 md 来标记,或者直接贴图

代码

你这样,大家都搞不明白你的问题,自然无法和你一起解决:sweat_smile:

#3

把远程调试关闭了就好了,结贴。

#4

第一次发帖,已改。