组件名称:警惕,AlertIOS,具体代码如下,,
/*弹出层测试*/import 反应,{组件},得到的反应; import { 样式表,才能 看来,才能 形象,才能 文本,才能 TouchableOpacity才能, 滚动视图,才能 导航器,才能 警惕,才能,//引入警戒组件 TouchableHighlight才能, ,,AlertIOS //引入AlertIOS组件 },得到“react-native”;//创建一个组件 class CustomButton  extends Component  { 渲染才能(),{ ,,,return ( ,,,,,& lt; TouchableHighlight ,,, ,,,,,,,风格={styles.button} ,,,,,,,underlayColor=昂焐?,,//触摸的时候颜色改变 ,,,,,,,onPress={this.props.onPress}祝辞,,//当前触发时间 ,,,,,,,& lt; Text 风格={styles.buttonText}在{this.props.text} & lt;/Text> ,,,,,& lt;/TouchableHighlight> ,,,); ,,} }//默认输出组件 export default  class AlertDemo extends  Component { 渲染才能(),{ ,,,return ( ,,,,,& lt; View 风格={styles.container}比; ,,,,,,,& lt; Text 风格={{高度:30,颜色:黑色的,保证金:8}}祝辞 ,,,,,,,,,弹出框实例 ,,,,,,,& lt;/Text> ,,,,,,,//触发事件 ,,,,,,,& lt; CustomButton 文本=暗慊鞯瞿暇ā? ,,,,,,,,,onPress={()=祝辞Alert.alert(“温馨提醒”,“确定退出吗? ")} ,,,,,,,,,/比; ,,,,,,,& lt; CustomButton 文本=暗慊鞯隽礁霭磁サ木ā? ,,,,,,,,,onPress={()=祝辞Alert.alert(“温馨提醒”,“确定退出吗?”,( ,,,,,,,,,,,{文本:“取消"}, ,,,,,,,,,,,{文本:“确定的,} ,,,,,,,,,,,)} ,,,,,,,,,/比; ,,,,,,,& lt; CustomButton 文本=暗慊鞯鋈霭磁サ木ā? ,,,,,,,,,onPress={()=祝辞AlertIOS.alert(“温馨提醒”,“确定退出吗?”,( ,,,,,,,,,,,{文本:“一个”}, ,,,,,,,,,,,{文本:“两个“}, ,,,,,,,,,,,{文本:“两个“}, ,,,,,,,,,,,{文本:“两个“}, ,,,,,,,,,,,{文本:“两个“}, ,,,,,,,,,,,{文本:“两个“}, ,,,,,,,,,,,{文本:“两个“}, ,,,,,,,,,,,{文本:“两个“}, ,,,,,,,,,,,{文本:“两个“}, ,,,,,,,,,,,{文本:“两个“}, ,,,,,,,,,,,{文本:“两个“}, ,,,,,,,,,,,{文本:“两个“}, ,,,,,,,,,,,)} ,,,,,,,,,/比; ,,,,,,,,,& lt; CustomButton 文本=暗慊鞒鱿质淙肟颉? ,,,,,,,,,,,onPress={()=祝辞AlertIOS.prompt(“温馨提醒”,“确定退出吗?”,( ,,,,,,,,,,,,,{文本:“取消"}, ,,,,,,,,,,,,,{文本:“确定的,} ,,,,,,,,,,,,,)} ,,,,,,,,,,,/比; ,,,,,& lt;/View> ,,,); ,,} } var styles =, StyleSheet.create ({ 容器:{才能 ,,,写成backgroundColor:“# fff”, ,,,flex: 1, ,,,marginTop: 65年, }, 按钮:{ 保证金:5,才能 写成backgroundColor才能:,“白色”, ,,填充:15日 ,,borderBottomWidth: StyleSheet.hairlineWidth, borderBottomColor才能:“# cdcdcd”, } })