@aks-dev/easyui 1.0.195 → 1.0.197
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of @aks-dev/easyui might be problematic. Click here for more details.
- package/dist/components/AnimationModal/AnimationModal.js +41 -23
- package/dist/components/Badge/Badge.js +16 -7
- package/dist/components/DottedLine/DottedLine.js +20 -15
- package/dist/components/Echarts/EchartsView.js +77 -40
- package/dist/components/Echarts/helper.js +16 -1
- package/dist/components/Hud/AlertBottomView/AlertBottomView.js +64 -49
- package/dist/components/Hud/AlertSheetView/AlertSheetView.js +34 -30
- package/dist/components/Hud/AlertView/AlertView.js +66 -52
- package/dist/components/Hud/Hud.js +19 -8
- package/dist/components/Hud/Loading/Loading.js +25 -7
- package/dist/components/Hud/PopoverView/PopoverView.js +20 -5
- package/dist/components/Hud/Scanner/Scanner.js +99 -71
- package/dist/components/Hud/Toast/Toast.js +16 -6
- package/dist/components/MenuView/MenuView.js +73 -32
- package/dist/components/Modal/Modal.js +7 -0
- package/dist/components/MutiPictureView/MutiPictureView.js +88 -78
- package/dist/components/PictureViewer/PictureViewer.js +32 -11
- package/dist/components/RefreshList/RefreshList.js +52 -43
- package/dist/components/RichText/RichText.js +23 -23
- package/dist/components/StickHeaderView/StickHeaderView.js +12 -2
- package/dist/components/TableCell/TableCell.js +53 -37
- package/dist/components/TextInputArea/TextInputArea.js +31 -22
- package/dist/components/WithLoadingContainer/WithLoadingContainer.js +31 -14
- package/dist/index.js +11 -0
- package/dist/jsbridge/RNEasyui.js +26 -1
- package/dist/jsbridge/UpgradeModule.js +21 -12
- package/dist/jsbridge/index.js +7 -0
- package/dist/screen/index.js +8 -0
- package/dist/screen/px2dp.js +25 -2
- package/dist/screen/px2sp.js +35 -5
- package/dist/screen/text-fit.js +21 -5
- package/dist/utils/index.js +7 -0
- package/dist/utils/lazy.js +71 -19
- package/dist/utils/mode.js +21 -0
- package/package.json +2 -3
- package/types/components/AnimationModal/AnimationModal.d.ts +8 -0
- package/types/components/AnimationModal/AnimationModal.d.ts.map +1 -1
- package/types/components/Echarts/helper.d.ts +5 -0
- package/types/components/Echarts/helper.d.ts.map +1 -1
- package/types/components/MutiPictureView/MutiPictureView.d.ts +9 -0
- package/types/components/MutiPictureView/MutiPictureView.d.ts.map +1 -1
- package/types/components/StickHeaderView/StickHeaderView.d.ts +6 -0
- package/types/components/StickHeaderView/StickHeaderView.d.ts.map +1 -1
- package/types/components/TextInputArea/TextInputArea.d.ts +1 -0
- package/types/components/TextInputArea/TextInputArea.d.ts.map +1 -1
- package/types/jsbridge/RNEasyui.d.ts +18 -0
- package/types/jsbridge/RNEasyui.d.ts.map +1 -1
- package/types/jsbridge/UpgradeModule.d.ts +15 -0
- package/types/jsbridge/UpgradeModule.d.ts.map +1 -1
- package/types/screen/px2dp.d.ts +11 -0
- package/types/screen/px2dp.d.ts.map +1 -1
- package/types/screen/text-fit.d.ts +3 -0
- package/types/screen/text-fit.d.ts.map +1 -1
- package/types/utils/lazy.d.ts +33 -0
- package/types/utils/lazy.d.ts.map +1 -1
- package/types/utils/mode.d.ts +14 -0
- package/types/utils/mode.d.ts.map +1 -1
- package/dist/components/Echarts/demo.js +0 -201
- package/dist/components/RefreshList/demo.js +0 -9
- package/dist/components/RefreshList/demo1.js +0 -27
- package/dist/components/RefreshList/demo2.js +0 -9
- package/dist/components/StickHeaderView/demo.js +0 -37
- package/types/components/Echarts/demo.d.ts +0 -4
- package/types/components/Echarts/demo.d.ts.map +0 -1
- package/types/components/RefreshList/demo.d.ts +0 -2
- package/types/components/RefreshList/demo.d.ts.map +0 -1
- package/types/components/RefreshList/demo1.d.ts +0 -2
- package/types/components/RefreshList/demo1.d.ts.map +0 -1
- package/types/components/RefreshList/demo2.d.ts +0 -2
- package/types/components/RefreshList/demo2.d.ts.map +0 -1
- package/types/components/StickHeaderView/demo.d.ts +0 -4
- package/types/components/StickHeaderView/demo.d.ts.map +0 -1
|
@@ -1,33 +1,23 @@
|
|
|
1
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
-
});
|
|
9
|
-
};
|
|
10
1
|
import * as React from "react";
|
|
11
2
|
import { Dimensions, Platform, StatusBar, StyleSheet, Text, TouchableOpacity, View, } from "react-native";
|
|
12
3
|
import Modal from "react-native-modal";
|
|
13
4
|
import { px2dp } from "../../../screen/px2dp";
|
|
14
5
|
import { px2sp } from "../../../screen/px2sp";
|
|
15
6
|
export default React.forwardRef((_, ref) => {
|
|
16
|
-
var _a;
|
|
17
7
|
const defaultState = {
|
|
18
8
|
visible: false,
|
|
19
9
|
actions: [],
|
|
20
10
|
};
|
|
21
11
|
const [state, setState] = React.useState(defaultState);
|
|
22
12
|
React.useImperativeHandle(ref, () => ({
|
|
23
|
-
show: (options) =>
|
|
13
|
+
show: async (options) => {
|
|
24
14
|
setState(Object.assign({}, defaultState, { visible: true }, options));
|
|
25
|
-
}
|
|
15
|
+
},
|
|
26
16
|
hide,
|
|
27
17
|
}), []);
|
|
28
|
-
const hide = () =>
|
|
18
|
+
const hide = async () => {
|
|
29
19
|
setState(defaultState);
|
|
30
|
-
}
|
|
20
|
+
};
|
|
31
21
|
React.useEffect(() => {
|
|
32
22
|
if (Platform.OS == "android") {
|
|
33
23
|
if (state.visible) {
|
|
@@ -40,27 +30,40 @@ export default React.forwardRef((_, ref) => {
|
|
|
40
30
|
}
|
|
41
31
|
}
|
|
42
32
|
}, [state.visible]);
|
|
43
|
-
return (
|
|
33
|
+
return (<Modal hideModalContentWhileAnimating={true} //通过隐藏模态内容直到动画完成来增强性能
|
|
34
|
+
useNativeDriver={true} //定义动画是否应使用本机驱动程序
|
|
35
|
+
animationIn="slideInUp" animationOut="slideOutDown" onBackButtonPress={() => {
|
|
36
|
+
//按下Android后退按钮时调用
|
|
37
|
+
hide();
|
|
38
|
+
}} onBackdropPress={() => {
|
|
39
|
+
//按下背景时调用
|
|
44
40
|
hide();
|
|
45
|
-
}
|
|
41
|
+
}} isVisible={state.visible} deviceHeight={Dimensions.get("screen").height} style={{ margin: 0 }}>
|
|
42
|
+
<View style={styles.container}>
|
|
43
|
+
<View style={[styles.wrapper]}>
|
|
44
|
+
<View style={styles.itemContainer}>
|
|
45
|
+
{state.actions?.map((i, idx) => (<TouchableOpacity key={`sg-action-${idx}`} style={[styles.item]} activeOpacity={1} onPress={() => {
|
|
46
|
+
hide();
|
|
47
|
+
i.onClick && i.onClick();
|
|
48
|
+
}}>
|
|
49
|
+
<Text style={[styles.itemText, { color: i.color }]} numberOfLines={2}>
|
|
50
|
+
{i.text}
|
|
51
|
+
</Text>
|
|
52
|
+
</TouchableOpacity>))}
|
|
53
|
+
</View>
|
|
54
|
+
|
|
55
|
+
<TouchableOpacity style={[styles.cancel]} activeOpacity={1} onPress={() => {
|
|
46
56
|
hide();
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
} },
|
|
54
|
-
React.createElement(Text, { style: [styles.itemText, { color: i.color }], numberOfLines: 2 }, i.text))))),
|
|
55
|
-
React.createElement(TouchableOpacity, { style: [styles.cancel], activeOpacity: 1, onPress: () => {
|
|
56
|
-
hide();
|
|
57
|
-
} },
|
|
58
|
-
React.createElement(Text, { style: [styles.cancelText] }, "\u53D6\u6D88"))))));
|
|
57
|
+
}}>
|
|
58
|
+
<Text style={[styles.cancelText]}>取消</Text>
|
|
59
|
+
</TouchableOpacity>
|
|
60
|
+
</View>
|
|
61
|
+
</View>
|
|
62
|
+
</Modal>);
|
|
59
63
|
});
|
|
60
64
|
export const alertSheetViewRef = React.createRef();
|
|
61
65
|
export const showAlertSheetModal = (props) => {
|
|
62
|
-
|
|
63
|
-
(_a = alertSheetViewRef.current) === null || _a === void 0 ? void 0 : _a.show(props);
|
|
66
|
+
alertSheetViewRef.current?.show(props);
|
|
64
67
|
};
|
|
65
68
|
const styles = StyleSheet.create({
|
|
66
69
|
container: {
|
|
@@ -73,6 +76,7 @@ const styles = StyleSheet.create({
|
|
|
73
76
|
flexGrow: 0,
|
|
74
77
|
flexShrink: 0,
|
|
75
78
|
width: "100%",
|
|
79
|
+
// backgroundColor: 'pink',
|
|
76
80
|
overflow: "hidden",
|
|
77
81
|
borderTopLeftRadius: px2dp(10),
|
|
78
82
|
borderTopRightRadius: px2dp(10),
|
|
@@ -1,12 +1,3 @@
|
|
|
1
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
-
});
|
|
9
|
-
};
|
|
10
1
|
import * as React from "react";
|
|
11
2
|
import { View, Text, StyleSheet, Platform, Modal, StatusBar, TouchableOpacity, Animated, Easing, } from "react-native";
|
|
12
3
|
import { px2dp, deviceWidth } from "../../../screen/px2dp";
|
|
@@ -21,18 +12,20 @@ export default React.forwardRef((_, ref) => {
|
|
|
21
12
|
const cancelCallbackRef = React.useRef(undefined);
|
|
22
13
|
const confirmCallbackRef = React.useRef(undefined);
|
|
23
14
|
React.useImperativeHandle(ref, () => ({
|
|
24
|
-
show: (options) =>
|
|
15
|
+
show: async (options) => {
|
|
25
16
|
setState(Object.assign({}, defaultState, { visible: true }, options));
|
|
26
17
|
cancelCallbackRef.current = options.cancel;
|
|
27
18
|
confirmCallbackRef.current = options.confirm;
|
|
19
|
+
// await sleep(50)
|
|
28
20
|
startAnimate(1);
|
|
29
|
-
}
|
|
21
|
+
},
|
|
30
22
|
hide,
|
|
31
23
|
}), []);
|
|
32
|
-
const hide = () =>
|
|
24
|
+
const hide = async () => {
|
|
33
25
|
startAnimate(0.3);
|
|
26
|
+
// await sleep(50)
|
|
34
27
|
setState(defaultState);
|
|
35
|
-
}
|
|
28
|
+
};
|
|
36
29
|
let scale_anim = React.useRef(new Animated.Value(0.3)).current;
|
|
37
30
|
const startAnimate = (x) => {
|
|
38
31
|
Animated.timing(scale_anim, {
|
|
@@ -54,49 +47,66 @@ export default React.forwardRef((_, ref) => {
|
|
|
54
47
|
}
|
|
55
48
|
}
|
|
56
49
|
}, [state.visible]);
|
|
57
|
-
return (
|
|
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
|
-
|
|
50
|
+
return (<Modal visible={state.visible} transparent animationType="fade" onRequestClose={() => {
|
|
51
|
+
// hide()
|
|
52
|
+
}}>
|
|
53
|
+
<View style={styles.container}>
|
|
54
|
+
<Animated.View style={[
|
|
55
|
+
styles.wrapper,
|
|
56
|
+
state.wrapperStyle,
|
|
57
|
+
{ transform: [{ scale: scale_anim }] },
|
|
58
|
+
]}>
|
|
59
|
+
{state.title && <Text style={styles.titleText}>{state.title}</Text>}
|
|
60
|
+
{(() => {
|
|
61
|
+
if (typeof state.content == "string")
|
|
62
|
+
return <Text style={styles.contentText}>{state.content}</Text>;
|
|
63
|
+
if (React.isValidElement(state.content))
|
|
64
|
+
return state.content;
|
|
65
|
+
return <View />;
|
|
66
|
+
})()}
|
|
67
|
+
|
|
68
|
+
{(state.cancelText || state.confirmText) && (<View style={styles.action}>
|
|
69
|
+
{state.cancelText && (<TouchableOpacity style={[
|
|
70
|
+
styles.cancel,
|
|
71
|
+
{ marginRight: state.confirmText ? px2dp(15) : 0 },
|
|
72
|
+
state.cancelContainerStyle,
|
|
73
|
+
]} activeOpacity={0.8} disabled={state.cancelDisabled} onPress={() => {
|
|
74
|
+
hide();
|
|
75
|
+
cancelCallbackRef.current && cancelCallbackRef.current();
|
|
76
|
+
cancelCallbackRef.current = undefined;
|
|
77
|
+
}}>
|
|
78
|
+
<Text style={[styles.cancelText, state.cancelTextStyle]}>
|
|
79
|
+
{state.cancelText}
|
|
80
|
+
</Text>
|
|
81
|
+
</TouchableOpacity>)}
|
|
82
|
+
|
|
83
|
+
{state.confirmText && (<TouchableOpacity style={[
|
|
84
|
+
styles.confirm,
|
|
85
|
+
{ marginLeft: state.cancelText ? px2dp(15) : 0 },
|
|
86
|
+
state.confirmContainerStyle,
|
|
87
|
+
]} activeOpacity={0.8} onPress={() => {
|
|
88
|
+
hide();
|
|
89
|
+
confirmCallbackRef.current && confirmCallbackRef.current();
|
|
90
|
+
confirmCallbackRef.current = undefined;
|
|
91
|
+
}}>
|
|
92
|
+
<Text style={[styles.confirmText, state.confirmTextStyle]}>
|
|
93
|
+
{state.confirmText}
|
|
94
|
+
</Text>
|
|
95
|
+
</TouchableOpacity>)}
|
|
96
|
+
</View>)}
|
|
97
|
+
</Animated.View>
|
|
98
|
+
</View>
|
|
99
|
+
</Modal>);
|
|
94
100
|
});
|
|
95
101
|
export const alertViewRef = React.createRef();
|
|
96
102
|
export const showAlertModal = (props) => {
|
|
97
|
-
|
|
98
|
-
(_a = alertViewRef.current) === null || _a === void 0 ? void 0 : _a.show(props);
|
|
103
|
+
alertViewRef.current?.show(props);
|
|
99
104
|
};
|
|
105
|
+
// const sleep = (msec?: number) => {
|
|
106
|
+
// return new Promise(resolve => {
|
|
107
|
+
// setTimeout(resolve, msec || 350);
|
|
108
|
+
// });
|
|
109
|
+
// }
|
|
100
110
|
const styles = StyleSheet.create({
|
|
101
111
|
container: {
|
|
102
112
|
display: "flex",
|
|
@@ -108,6 +118,7 @@ const styles = StyleSheet.create({
|
|
|
108
118
|
wrapper: {
|
|
109
119
|
flexGrow: 0,
|
|
110
120
|
flexShrink: 0,
|
|
121
|
+
// minWidth: '70%',
|
|
111
122
|
minWidth: deviceWidth - px2dp(60),
|
|
112
123
|
backgroundColor: "white",
|
|
113
124
|
overflow: "hidden",
|
|
@@ -119,6 +130,7 @@ const styles = StyleSheet.create({
|
|
|
119
130
|
maxWidth: deviceWidth - px2dp(90),
|
|
120
131
|
fontSize: px2sp(18),
|
|
121
132
|
marginBottom: px2dp(20),
|
|
133
|
+
// backgroundColor: 'red',
|
|
122
134
|
textAlign: "center",
|
|
123
135
|
fontWeight: "bold",
|
|
124
136
|
color: "#1A1A1A",
|
|
@@ -131,6 +143,7 @@ const styles = StyleSheet.create({
|
|
|
131
143
|
flexShrink: 1,
|
|
132
144
|
width: undefined,
|
|
133
145
|
fontSize: px2sp(15),
|
|
146
|
+
// backgroundColor: 'red',
|
|
134
147
|
color: "#1A1A1A",
|
|
135
148
|
textAlign: "center",
|
|
136
149
|
},
|
|
@@ -139,6 +152,7 @@ const styles = StyleSheet.create({
|
|
|
139
152
|
flexDirection: "row",
|
|
140
153
|
justifyContent: "space-between",
|
|
141
154
|
alignItems: "center",
|
|
155
|
+
// backgroundColor:"red"
|
|
142
156
|
},
|
|
143
157
|
cancel: {
|
|
144
158
|
width: "40%",
|
|
@@ -1,4 +1,12 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* @Author: shiguo
|
|
3
|
+
* @Date: 2022-04-24 14:10:04
|
|
4
|
+
* @LastEditors: shiguo
|
|
5
|
+
* @LastEditTime: 2023-03-23 11:13:55
|
|
6
|
+
* @FilePath: /aks-fire-app/node_modules/@aks-dev/easyui/lib/Hud/Hud.tsx
|
|
7
|
+
*/
|
|
1
8
|
import * as React from 'react';
|
|
9
|
+
// import { StyleSheet } from 'react-native'
|
|
2
10
|
import { alertViewRef, default as AlertView, showAlertModal } from './AlertView/AlertView';
|
|
3
11
|
import { alertBottomViewRef, default as AlertBottomView, showAlertBottomModal } from './AlertBottomView/AlertBottomView';
|
|
4
12
|
import { alertSheetViewRef, default as AlertSheetView, showAlertSheetModal } from './AlertSheetView/AlertSheetView';
|
|
@@ -6,13 +14,16 @@ import { hideLoading, Loading, loadingRef, showLoading } from './Loading/Loading
|
|
|
6
14
|
import { showToast, Toast, toastRef } from './Toast/Toast';
|
|
7
15
|
import { showPopoverView, hidePopoverView, popoverViewRef, PopoverView } from './PopoverView/PopoverView';
|
|
8
16
|
import { showScanner, hideScanner, scannerRef, Scanner } from './Scanner/Scanner';
|
|
9
|
-
export const Hud = () => React.cloneElement(
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
+
export const Hud = () => React.cloneElement(<></>, {
|
|
18
|
+
// ...StyleSheet.absoluteFillObject,
|
|
19
|
+
// display: 'flex',
|
|
20
|
+
}, [
|
|
21
|
+
<Loading key="hud-0" ref={loadingRef}/>,
|
|
22
|
+
<Toast key="hud-1" ref={toastRef}/>,
|
|
23
|
+
<AlertView key="hud-2" ref={alertViewRef}/>,
|
|
24
|
+
<AlertBottomView key="hud-3-0" ref={alertBottomViewRef}/>,
|
|
25
|
+
<AlertSheetView key="hud-3-1" ref={alertSheetViewRef}/>,
|
|
26
|
+
<PopoverView key="hud-4" ref={popoverViewRef}/>,
|
|
27
|
+
<Scanner key="hud-5" ref={scannerRef}/>,
|
|
17
28
|
]);
|
|
18
29
|
export { showAlertModal, showToast, showLoading, hideLoading, showAlertBottomModal, showAlertSheetModal, showPopoverView, hidePopoverView, showScanner, hideScanner, };
|
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* @Author: shiguo
|
|
3
|
+
* @Date: 2022-04-24 14:27:02
|
|
4
|
+
* @LastEditors: shiguo
|
|
5
|
+
* @LastEditTime: 2022-09-09 10:55:48
|
|
6
|
+
* @FilePath: /@aks-dev/easyui/lib/Hud/Loading/Loading.tsx
|
|
7
|
+
*/
|
|
1
8
|
import React, { useImperativeHandle, useState } from "react";
|
|
2
9
|
import { View, ActivityIndicator, StyleSheet, Text, Dimensions, TouchableOpacity, BackHandler, } from "react-native";
|
|
3
10
|
export const Loading = React.forwardRef((_, ref) => {
|
|
@@ -6,6 +13,7 @@ export const Loading = React.forwardRef((_, ref) => {
|
|
|
6
13
|
React.useEffect(() => {
|
|
7
14
|
const onBackPress = () => show;
|
|
8
15
|
BackHandler.addEventListener("hardwareBackPress", onBackPress);
|
|
16
|
+
// return () => BackHandler.removeEventListener('hardwareBackPress', onBackPress);
|
|
9
17
|
}, [show]);
|
|
10
18
|
useImperativeHandle(ref, () => ({
|
|
11
19
|
showLoading: (content) => {
|
|
@@ -18,17 +26,27 @@ export const Loading = React.forwardRef((_, ref) => {
|
|
|
18
26
|
}), [show]);
|
|
19
27
|
if (!show)
|
|
20
28
|
return null;
|
|
21
|
-
return (
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
29
|
+
return (<TouchableOpacity disabled style={styles.container}>
|
|
30
|
+
<View style={styles.warpper}>
|
|
31
|
+
<ActivityIndicator color="white" size="large"/>
|
|
32
|
+
<Text numberOfLines={5} style={styles.title}>
|
|
33
|
+
{tipText}
|
|
34
|
+
</Text>
|
|
35
|
+
</View>
|
|
36
|
+
</TouchableOpacity>);
|
|
25
37
|
});
|
|
26
38
|
export const loadingRef = React.createRef();
|
|
27
|
-
export const showLoading = (content) =>
|
|
28
|
-
export const hideLoading = () =>
|
|
39
|
+
export const showLoading = (content) => loadingRef.current?.showLoading(content);
|
|
40
|
+
export const hideLoading = () => loadingRef.current?.hideLoading();
|
|
29
41
|
const SCREEN_WIDTH = Dimensions.get("window").width;
|
|
30
42
|
const styles = StyleSheet.create({
|
|
31
|
-
container:
|
|
43
|
+
container: {
|
|
44
|
+
...StyleSheet.absoluteFill,
|
|
45
|
+
display: "flex",
|
|
46
|
+
justifyContent: "center",
|
|
47
|
+
alignItems: "center",
|
|
48
|
+
// backgroundColor:'red'
|
|
49
|
+
},
|
|
32
50
|
warpper: {
|
|
33
51
|
backgroundColor: "#00000088",
|
|
34
52
|
padding: 40,
|
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* @Author: shiguo
|
|
3
|
+
* @Date: 2022-04-24 14:27:02
|
|
4
|
+
* @LastEditors: shiguo
|
|
5
|
+
* @LastEditTime: 2022-12-21 15:36:06
|
|
6
|
+
* @FilePath: /@aks-dev/easyui/lib/Hud/PopoverView/PopoverView.tsx
|
|
7
|
+
*/
|
|
1
8
|
import React, { useImperativeHandle, useState } from "react";
|
|
2
9
|
import { StyleSheet, TouchableOpacity, BackHandler, } from "react-native";
|
|
3
10
|
export const PopoverView = React.forwardRef((_, ref) => {
|
|
@@ -6,6 +13,7 @@ export const PopoverView = React.forwardRef((_, ref) => {
|
|
|
6
13
|
React.useEffect(() => {
|
|
7
14
|
const onBackPress = () => visible;
|
|
8
15
|
BackHandler.addEventListener("hardwareBackPress", onBackPress);
|
|
16
|
+
// return () => BackHandler.removeEventListener('hardwareBackPress', onBackPress);
|
|
9
17
|
}, [visible]);
|
|
10
18
|
useImperativeHandle(ref, () => ({
|
|
11
19
|
showPopoverView: (options) => {
|
|
@@ -19,14 +27,21 @@ export const PopoverView = React.forwardRef((_, ref) => {
|
|
|
19
27
|
}), [visible]);
|
|
20
28
|
if (!visible)
|
|
21
29
|
return null;
|
|
22
|
-
return (
|
|
30
|
+
return (<TouchableOpacity activeOpacity={1} style={[styles.container, options?.style]} disabled={options?.disabled} onPress={(e) => {
|
|
23
31
|
setVisible(false);
|
|
24
32
|
setOptions(undefined);
|
|
25
|
-
|
|
33
|
+
// e.stopPropagation()
|
|
34
|
+
}}>
|
|
35
|
+
{React.isValidElement(options?.content) && options?.content}
|
|
36
|
+
</TouchableOpacity>);
|
|
26
37
|
});
|
|
27
38
|
export const popoverViewRef = React.createRef();
|
|
28
|
-
export const showPopoverView = (options) =>
|
|
29
|
-
export const hidePopoverView = () =>
|
|
39
|
+
export const showPopoverView = (options) => popoverViewRef.current?.showPopoverView(options);
|
|
40
|
+
export const hidePopoverView = () => popoverViewRef.current?.hidePopoverView();
|
|
30
41
|
const styles = StyleSheet.create({
|
|
31
|
-
container:
|
|
42
|
+
container: {
|
|
43
|
+
...StyleSheet.absoluteFill,
|
|
44
|
+
display: "flex",
|
|
45
|
+
// backgroundColor:'red'
|
|
46
|
+
},
|
|
32
47
|
});
|