-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathExamples.js
97 lines (92 loc) · 2.52 KB
/
Examples.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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
import React, {Component} from 'react'
import {
View,
Text,
StyleSheet
} from 'react-native'
import Hud,
{
HUD_TYPE_DEFAULT,
HUD_TYPE_TEXT,
HUD_TYPE_INFO,
HUD_TYPE_ERROR,
HUD_TYPE_SUCCESS
} from 'xxf_hud';
const styles = StyleSheet.create({
container: {
flex: 1,
flexDirection: 'column',
paddingTop: 50,
alignItems: 'center'
},
text: {
padding: 8
}
});
export default class Examples extends Component {
// 构造
constructor(props) {
super(props);
// 初始状态
this.state = {
hudType: HUD_TYPE_DEFAULT,
}
}
// componentDidUpdate() {
// console.log('update');
// this.hud.show('custom hud');
// this.hud.close(2000);
// }
render() {
return (
<View style={styles.container}>
<Text
onPress={() => {
this.hud.show(HUD_TYPE_INFO, 'info hud', 2000)
}}
style={styles.text}
>
info hud
</Text>
<Text
onPress={() => {
this.hud.show(HUD_TYPE_SUCCESS, 'success hud', 2000);
}}
style={styles.text}>
success hud
</Text>
<Text
onPress={() => {
this.hud.show(HUD_TYPE_ERROR, 'error hud', 2000);
}}
style={styles.text}>
error hud
</Text>
<Text
onPress={() => {
this.hud.show(HUD_TYPE_DEFAULT, 'default hud', 2000)
}}
style={styles.text}>
default hud
</Text>
<Text
style={styles.text}
onPress={() => {
this.hud.show(HUD_TYPE_TEXT, 'text toast', 2000);
}}
>
text toast
</Text>
<Text onPress={() => {
this.hud.close()
}}
style={styles.text}>
close
</Text>
<Hud source={this.state.source} ref={r => {
this.hud = r
}} hudType={this.state.hudType} textOnly={this.state.textOnly}/>
</View>
)
}
}