forked from meituan/beeshell
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.tsx
81 lines (71 loc) · 2.03 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
import React, { Component } from 'react'
import {
View,
Text,
StyleSheet,
ScrollView,
TouchableHighlight
} from 'react-native'
import { Progress, Button } from '../../src'
import styles from '../common/styles'
import variables from '../customTheme'
export default class ProgressScreen extends Component<{}, any> {
constructor (props) {
super(props)
this.state = {
percentA: 30,
percent: 40
}
}
componentDidMount() {
setTimeout(() => {
this.setState({
percentA: 90
})
}, 2000)
}
onAdd = () => {
let p = this.state.percent + 10
if (this.state.percent >= 100) {
p = 0
}
this.setState({
percent: p
})
}
render () {
return (
<ScrollView style={styles.body}>
<Text style={styles.header}>基础</Text>
<View style={styles.panel}>
<Text style={{ fontSize: 14, color: variables.mtdGrayBase, marginBottom: 4 }}>{this.state.percentA}%</Text>
<Progress
easing={true}
percent={this.state.percentA}
/>
</View>
<Text style={styles.header}>自定义样式、无动画</Text>
<View style={styles.panel}>
<Text style={{ fontSize: 14, color: variables.mtdGrayBase, marginBottom: 4 }}>{this.state.percentA}%</Text>
<Progress
style={{ backgroundColor: '#ccc' }}
barStyle={{ height: 8, backgroundColor: variables.mtdBrandDanger }}
easing={false}
percent={this.state.percentA}
/>
</View>
<Text style={styles.header}>其他</Text>
<View style={styles.panel}>
<Text style={{ fontSize: 14, color: variables.mtdGrayBase, marginBottom: 4 }}>{this.state.percent}%</Text>
<Progress
easing={true}
percent={this.state.percent}
/>
<View style={{ flexDirection: 'row', marginTop: 10 }}>
<Button size='sm' onPress={this.onAdd}>点击</Button>
</View>
</View>
</ScrollView>
)
}
}