十年网站开发经验 + 多家企业客户 + 靠谱的建站团队
量身定制 + 运营维护+专业推广+无忧售后,网站问题一站解决
利用一个特定的标题和消息来启动一个警告对话框。

创新互联专注为客户提供全方位的互联网综合服务,包含不限于成都网站制作、网站建设、外贸网站建设、天心网络推广、微信小程序开发、天心网络营销、天心企业策划、天心品牌公关、搜索引擎seo、人物专访、企业宣传片、企业代运营等,从售前售中售后,我们都将竭诚为您服务,您的肯定,是我们最大的嘉奖;创新互联为所有大学生创业者提供天心建站搭建服务,24小时服务热线:13518219792,官方网址:www.cdcxhl.com
提供一个可选按钮的列表。点击任何按钮触发各自的按下回调动作,并且忽略警告。在默认情况下,只有一个按钮是“OK”按钮。列表中最后一个按钮被视为“主”按钮,它被用粗体显示出来了。
AlertIOS.alert( 'Foo Title', 'My Alert Msg',
[
{text: 'Foo', onPress: () => console.log('Foo Pressed!')},
{text: 'Bar', onPress: () => console.log('Bar Pressed!')},
]
)}
static alert(title: string, message?: string, buttons?: Array<{ text: ?string; onPress: ?Function; }>)
Edit on GitHub
'use strict'; var React = require('react-native'); var {
StyleSheet,
View,
Text,
TouchableHighlight,
AlertIOS,
} = React;
exports.framework = 'React';
exports.title = 'AlertIOS';
exports.description = 'iOS alerts and action sheets';
exports.examples = [{ title: 'Alerts',
render() { return (
AlertIOS.alert( 'Foo Title', 'My Alert Msg'
)}>
Alert with message and default button
AlertIOS.alert( null, null,
[
{text: 'Button', onPress: () => console.log('Button Pressed!')},
]
)}>
Alert with only one button
AlertIOS.alert( 'Foo Title', 'My Alert Msg',
[
{text: 'Foo', onPress: () => console.log('Foo Pressed!')},
{text: 'Bar', onPress: () => console.log('Bar Pressed!')},
]
)}>
Alert with two buttons
AlertIOS.alert( 'Foo Title', null,
[
{text: 'Foo', onPress: () => console.log('Foo Pressed!')},
{text: 'Bar', onPress: () => console.log('Bar Pressed!')},
{text: 'Baz', onPress: () => console.log('Baz Pressed!')},
]
)}>
Alert with 3 buttons
AlertIOS.alert( 'Foo Title', 'My Alert Msg', '..............'.split('').map((dot, index) => ({ text: 'Button ' + index, onPress: () => console.log('Pressed ' + index)
}))
)}>
Alert with too many buttons
);
},
}]; var styles = StyleSheet.create({ wrapper: { borderRadius: 5, marginBottom: 5,
}, button: { backgroundColor: '#eeeeee', padding: 10,
},
});