新聞中心
這里有您想知道的互聯(lián)網(wǎng)營銷解決方案
創(chuàng)新互聯(lián)React教程:iOS警告
利用一個特定的標題和消息來啟動一個警告對話框。

創(chuàng)新互聯(lián)專注為客戶提供全方位的互聯(lián)網(wǎng)綜合服務,包含不限于成都網(wǎng)站制作、網(wǎng)站建設、外貿(mào)網(wǎng)站建設、天心網(wǎng)絡推廣、微信小程序開發(fā)、天心網(wǎng)絡營銷、天心企業(yè)策劃、天心品牌公關、搜索引擎seo、人物專訪、企業(yè)宣傳片、企業(yè)代運營等,從售前售中售后,我們都將竭誠為您服務,您的肯定,是我們最大的嘉獎;創(chuàng)新互聯(lián)為所有大學生創(chuàng)業(yè)者提供天心建站搭建服務,24小時服務熱線:13518219792,官方網(wǎng)址:www.cdcxhl.com
提供一個可選按鈕的列表。點擊任何按鈕觸發(fā)各自的按下回調(diào)動作,并且忽略警告。在默認情況下,只有一個按鈕是“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,
},
}); 網(wǎng)站名稱:創(chuàng)新互聯(lián)React教程:iOS警告
網(wǎng)頁路徑:http://m.5511xx.com/article/djcegcj.html


咨詢
建站咨詢
