【发布时间】:2019-07-10 22:46:46
【问题描述】:
import React from 'react';
import { View, Text, Modal, Image, Button, StyleSheet } from 'react-native';
const ModalBox = props => {
let ModalContent = null;
if (props.selectedPlace) {
ModalContent = (
<View>
<Image source={props.selectedPlace.image} style={styles.image} ></Image>
<Text style= {styles.text}>{props.selectedPlace.value}</Text>
</View>
)
}
return (
<Modal onRequestClose={props.close} visible={props.selectedPlace !== null} animationType="slide">
<View style={styles.ModalContainer}>
{ModalContent}
<Button title="Delete" color="red" onPress={props.itemDelete}></Button>
<Button title="Close" onPress={props.close}></Button>
</View>
</Modal>
)
}
const styles = StyleSheet.create({
ModalContainer: {
marginTop: 10
},
image: {
height:200,
width: "100%"
},
text:{
textAlign:"center",
fontWeight:"bold",
fontSize: 28
}
})
export default ModalBox;
我有上面的模态代码。 当我打开我的模态然后对我的代码进行一些更改然后重新加载它时。 Modal 挂断了,甚至无法单击我的按钮并重新加载应用程序。我必须关闭我的应用程序然后重新开始。
【问题讨论】:
-
我也有同样的问题
标签: react-native react-native-android