【发布时间】:2017-07-07 04:21:01
【问题描述】:
在我的渲染函数中,我提出了一个请求,所以加载时会显示“正在加载”。收到数据后,我调用“setState”来重新渲染DOM。我想显示模态,但模态不存在。我怎么了?
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>
);
}
【问题讨论】:
标签: reactjs react-native modal-dialog