-
Notifications
You must be signed in to change notification settings - Fork 2
/
index.d.ts
86 lines (82 loc) · 2.52 KB
/
index.d.ts
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
import {NativeModules} from "react-native";
type ProgressType = {
None: 1
Clear: 2
Black: 3
}
type ProgressHUD = {
ProgressHUDMaskType: ProgressType
show: (type?: ProgressType) => void
dismiss: () => void
dismissWithDelay: (delay: number) => void
showWithStatus: (status: string, type: ProgressType) => void
showInfoWithStatus: (status: string, type: ProgressType) => void
showSuccessWithStatus: (status: string, type: ProgressType) => void
showErrorWithStatus: (status: string, type: ProgressType) => void
showProgressWithStatus: (progress: number, status: string, type: ProgressType) => void
}
const ProgressHUDMaskType: ProgressType = {
None: 1,
Clear: 2,
Black: 3
};
const {RNProgressHud} = NativeModules;
const progressHUD: ProgressHUD = {
ProgressHUDMaskType,
show(progressHUDMaskType: ProgressType) {
if (!progressHUDMaskType) {
return RNProgressHud.show();
}
return RNProgressHud.showWithMaskType(progressHUDMaskType);
},
showWithStatus(status: string, progressHUDMaskType: ProgressType) {
if (!progressHUDMaskType) {
return RNProgressHud.showWithStatus(status);
}
return RNProgressHud.showWithStatusAndMaskType(status, progressHUDMaskType);
},
showInfoWithStatus(status: string, progressHUDMaskType: ProgressType) {
if (!progressHUDMaskType) {
return RNProgressHud.showInfoWithStatus(status);
}
return RNProgressHud.showInfoWithStatusAndMaskType(
status,
progressHUDMaskType
);
},
showSuccessWithStatus(status: string, progressHUDMaskType: ProgressType) {
if (!progressHUDMaskType) {
return RNProgressHud.showSuccessWithStatus(status);
}
return RNProgressHud.showSuccessWithStatusAndMaskType(
status,
progressHUDMaskType
);
},
showErrorWithStatus(status: string, progressHUDMaskType: ProgressType) {
if (!progressHUDMaskType) {
return RNProgressHud.showErrorWithStatus(status);
}
return RNProgressHud.showErrorWithStatusAndMaskType(
status,
progressHUDMaskType
);
},
showProgressWithStatus(progress: number, status: string, progressHUDMaskType: ProgressType) {
if (!progressHUDMaskType) {
return RNProgressHud.showProgressWithStatus(progress, status);
}
return RNProgressHud.showProgressWithStatusAndMaskType(
progress,
status,
progressHUDMaskType
);
},
dismiss() {
RNProgressHud.dismiss();
},
dismissWithDelay(delayInSeconds: number) {
RNProgressHud.dismissWithDelay(delayInSeconds);
}
};
export default progressHUD;