-
Notifications
You must be signed in to change notification settings - Fork 0
/
AlertIOS组件-index.ios.js
74 lines (67 loc) · 1.18 KB
/
AlertIOS组件-index.ios.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
//AlertIOS组件
var React = require('react-native');
var {
AppRegistry,
StyleSheet,
Text,
View,
AlertIOS
} = React;
var app = React.createClass({
render: function(){
return (
<View style={styles.container}>
<Text style={styles.item} onPress={this.tip}>提示对话框</Text>
<Text style={styles.item} onPress={this.input}>输入对话框</Text>
</View>
);
},
tip: function(){
AlertIOS.alert('提示','选择学习React Native',[
{
text: '取消',
onPress: function(){
alert('你点击了取消按钮');
}
},
{
text: '确认',
onPress: function(){
alert('你点击了确认按钮');
}
}
]);
},
input: function(){
AlertIOS.prompt('提示','使用React Native开发App',[
{
text: '取消',
onPress: function(){
alert('你点击了取消按钮');
}
},
{
text: '确认',
onPress: function(e){
alert(e);
}
}
]);
}
});
var styles = StyleSheet.create({
container: {
flex: 1,
marginTop: 25
},
item: {
marginTop: 10,
marginLeft: 5,
marginRight: 5,
height: 30,
borderWidth: 1,
padding: 6,
borderColor: '#ddd'
}
});
AppRegistry.registerComponent('app', ()=> app);