组件名称:Alert、AlertIOS 具体代码如下

成都创新互联公司长期为数千家客户提供的网站建设服务,团队从业经验10年,关注不同地域、不同群体,并针对不同对象提供差异化的产品和服务;打造开放共赢平台,与合作伙伴共同营造健康的互联网生态环境。为香格里拉企业提供专业的网站设计、成都网站制作,香格里拉网站改版等技术服务。拥有十年丰富建站经验和众多成功案例,为您定制开发。
/*弹出层测试*/
import React,{Component} from 'react';
import {
StyleSheet,
View,
Image,
Text,
TouchableOpacity,
ScrollView,
Navigator,
Alert, //引入Alert组件
TouchableHighlight,
AlertIOS //引入AlertIOS组件
} from 'react-native';
//创建一个组件
class CustomButton extends Component {
render() {
return (
//当前触发时间
{this.props.text}
);
}
}
//默认输出组件
export default class AlertDemo extends Component {
render() {
return (
弹出框实例
//触发事件
Alert.alert('温馨提醒','确定退出吗?')}
/>
Alert.alert('温馨提醒','确定退出吗?',[
{text:'取消'},
{text:'确定',}
])}
/>
AlertIOS.alert('温馨提醒','确定退出吗?',[
{text:'One'},
{text:'Two'},
{text:'Two'},
{text:'Two'},
{text:'Two'},
{text:'Two'},
{text:'Two'},
{text:'Two'},
{text:'Two'},
{text:'Two'},
{text:'Two'},
{text:'Two'},
])}
/>
AlertIOS.prompt('温馨提醒','确定退出吗?',[
{text:'取消'},
{text:'确定',}
])}
/>
);
}
}
var styles = StyleSheet.create({
container:{
backgroundColor:"#fff",
flex:1,
marginTop:65,
},
button: {
margin:5,
backgroundColor: 'white',
padding: 15,
borderBottomWidth: StyleSheet.hairlineWidth,
borderBottomColor: '#cdcdcd',
}
})