MCPcopy Create free account
hub / github.com/Meituan-Dianping/beeshell / ButtonScreen

Class ButtonScreen

examples/Button/index.tsx:23–124  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

21})
22
23export default class ButtonScreen extends Component<{}, any> {
24 constructor (p) {
25 super(p)
26 this.state = {
27 count: 0
28 }
29 }
30
31 render () {
32 return (
33 <ScrollView
34 style={styles.body}>
35 <Text style={styles.header}>预定义样式</Text>
36 <View style={styles.panel}>
37 <View style={componentStyles.row}>
38 <Button
39 testID='btn1'
40 style={[componentStyles.spacingH, componentStyles.spacingV]}
41 type='default'
42 size='sm'
43 onPress={() => {
44 this.setState({
45 count: this.state.count + 1
46 })
47 }}>
48 默认 default
49 </Button>
50 <Button style={[componentStyles.spacingH, componentStyles.spacingV]} type='primary' size='sm' textColorInverse>首选项 primary</Button>
51 <Button style={[componentStyles.spacingH, componentStyles.spacingV]} type='success' size='sm'>成功 success</Button>
52 <Button style={[componentStyles.spacingH, componentStyles.spacingV]} type='info' size='sm'>一般信息 info</Button>
53 <Button style={[componentStyles.spacingH, componentStyles.spacingV]} type='warning' size='sm'>警告 warning</Button>
54 <Button style={[componentStyles.spacingH, componentStyles.spacingV]} type='danger' size='sm'>危险 danger</Button>
55 <Button type='text' size='sm'>纯文本 text</Button>
56 </View>
57 {this.state.count ? <Text testID='text'>点击了按钮 {this.state.count}</Text> : null}
58 </View>
59
60 <Text style={styles.header}>尺寸</Text>
61 <View style={styles.panel}>
62 <View style={componentStyles.row}>
63 <Button style={[componentStyles.spacingH, componentStyles.spacingV]} type='primary' size='lg' textColorInverse>大按钮</Button>
64 <Button style={[componentStyles.spacingH, componentStyles.spacingV]} type='default' size='lg'>大按钮</Button>
65 </View>
66 <View style={componentStyles.row}>
67 <Button style={[componentStyles.spacingH, componentStyles.spacingV]} type='primary' size='md' textColorInverse>默认尺寸</Button>
68 <Button style={[componentStyles.spacingV]} type='default' size='md'>默认尺寸</Button>
69 </View>
70
71 <View style={componentStyles.row}>
72 <Button style={[componentStyles.spacingH, componentStyles.spacingV]} type='primary' size='sm' textColorInverse>小按钮</Button>
73 <Button style={[componentStyles.spacingH, componentStyles.spacingV]} type='default' size='sm'>小按钮</Button>
74 </View>
75
76 <Button type='primary' size='md' textColorInverse>默认尺寸拉伸</Button>
77 </View>
78
79 <Text style={styles.header}>禁用/激活状态</Text>
80

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected