This repository was archived by the owner on May 6, 2019. It is now read-only.
forked from Meituan-Dianping/beeshell
-
Notifications
You must be signed in to change notification settings - Fork 32
/
Copy pathindex.tsx
158 lines (149 loc) · 4.54 KB
/
index.tsx
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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
import React, { Component } from 'react'
import { ScrollView, View, StyleSheet, Text, Dimensions, TouchableOpacity } from 'react-native'
import { Button, Actionsheet, Icon } from '../../src/'
import variables from '../customTheme'
import styles from '../common/styles'
const screen = Dimensions.get('window')
export default class ActionsheetScreen extends Component<any, any> {
private actionsheet = null;
[propName: string]: any
constructor (p) {
super(p)
this.state = {
count: 0
}
}
clickHandle (e) {
this.setState({
count: this.state.count + 1
})
console.warn('clickHandle', Object.keys(e))
}
render () {
return (
<ScrollView
style={styles.body}>
<View style={styles.container}>
<Button
style={{ marginTop: 12 }}
size='sm'
type='primary'
textColorInverse
onPress={() => {
this.actionsheet.open()
}}>
基础
</Button>
<Actionsheet
ref={(c) => {
this.actionsheet = c
}}
header='标题'
data={[
{ label: '选项一', value: '1' },
'选项二',
{ label: '选项三', value: '3' },
{ label: '选项四', value: '4' },
{ label: '选项五', value: '5' },
{ label: '选项六', value: '6' },
]}
cancelable={true}
onPressConfirm={item => {
console.log(item)
}}
onPressCancel={() => {
console.log('cancel')
}}
/>
<Button
style={{ marginTop: 12 }}
size='sm'
onPress={() => {
this.actionsheet2.open()
}}>
自定义头部、选项、footer
</Button>
<Actionsheet
ref={(c) => {
this.actionsheet2 = c
}}
header={
<View
style={{
flexDirection: 'row',
justifyContent: 'center',
alignItems: 'center',
borderBottomWidth: StyleSheet.hairlineWidth,
borderBottomColor: variables.mtdBorderColor,
backgroundColor: '#fff',
paddingVertical: 12
}}>
<Text
style={{
fontSize: 14,
marginRight: 5,
color: variables.mtdGray
}}>
自定义头部
</Text>
<Icon type='question-circle'></Icon>
</View>
}
data={[
{
text: '自定义选项一',
value: '1'
},
{
text: '自定义选项二',
value: '2'
},
{
text: '自定义选项三',
value: '3'
}
]}
cancelable={true}
renderItem={(item, index) => {
return (
<View style={{ flexDirection: 'row', paddingVertical: 13, alignItems: 'center', justifyContent: 'center', borderBottomColor: variables.mtdBorderColorDark, borderBottomWidth: StyleSheet.hairlineWidth, backgroundColor: '#fff' }}>
<Icon type='star-o' tintColor='#111' size={16} />
<Text style={{ marginLeft: 5, fontSize: 16 }}>{item.text}</Text>
</View>
)
}}
footer={
<TouchableOpacity>
<View
style={{
flexDirection: 'row',
justifyContent: 'center',
alignItems: 'center',
backgroundColor: '#fff',
paddingVertical: 12
}}>
<Text
style={{
textAlign: 'center',
fontSize: 14,
color: variables.mtdGray,
marginRight: 5
}}>
自定义底部
</Text>
<Icon type='times' size={14}></Icon>
</View>
</TouchableOpacity>
}
onPressConfirm={item => {
console.log(item)
}}
onPressCancel={() => {
console.log('cancel')
}}
/>
</View>
</ScrollView>
)
}
}