-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathui_util.js
More file actions
executable file
·61 lines (53 loc) · 1.81 KB
/
Copy pathui_util.js
File metadata and controls
executable file
·61 lines (53 loc) · 1.81 KB
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
import DataUtil from './data_util';
import { Platform, StatusBar, Dimensions } from 'react-native';
import Toast from '@remobile/react-native-toast';
import SVProgressHUD from './SVProgressHUD';
import Global from './../global';
const { height, width } = Dimensions.get('window');
//Guideline sizes are based on standard ~5" screen mobile device
const guidelineBaseWidth = 375;
const guidelineBaseHeight = 667;
var UIUtil = module.exports = {
scale: size => width / guidelineBaseWidth * size,
verticalScale: size => height / guidelineBaseHeight * size,
moderateScale: (size, factor = 0.5) => size + ( UIUtil.scale(size) - size ) * factor,
showAlertDialog: function (msg) {
setTimeout(() => {
alert(msg);
}, 100);
},
showErrorDialog: function (error) {
if (DataUtil.isStringEmpty(error)) {
return;
}
//InteractionManager.runAfterInteractions(() => {
Toast.showLongCenter(error);
//});
},
dismissErrorDialog: function () {
//InteractionManager.runAfterInteractions(() => {
Toast.hide();
//});
},
showSpinner: function () {
SVProgressHUD.showWithMaskType(SVProgressHUD.MaskType.Clear);
},
hideSpinner: function () {
SVProgressHUD.dismiss();
},
setStatusBarStyle: function (statusBarStyle) {
if (Global.getEnvironment() !== Global.APP_ENV_TYPE.production) {
StatusBar.setBarStyle('dark-content', true);
if (Platform.OS === 'android') {
StatusBar.setTranslucent(true);
StatusBar.setBackgroundColor('rgb(255, 51, 51)', true);
}
return;
}
StatusBar.setBarStyle(statusBarStyle?statusBarStyle:'default', true);
if (Platform.OS === 'android') {
StatusBar.setTranslucent(true);
StatusBar.setBackgroundColor('rgba(0, 0, 0, 0.1)', true);
}
}
};