@aks-dev/easyui 1.0.163 → 1.1.2
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.
- package/dist/components/AnimationModal/AnimationModal.js +151 -0
- package/dist/components/DottedLine/DottedLine.js +50 -0
- package/{lib/Echarts/EchartsView.tsx → dist/components/EchartsView/EchartsView.js} +74 -113
- package/{lib/Echarts/helper.tsx → dist/components/EchartsView/helper.js} +17 -24
- package/dist/components/Hud/AlertBottomView/AlertBottomView.js +174 -0
- package/dist/components/Hud/AlertSheetView/AlertSheetView.js +117 -0
- package/dist/components/Hud/AlertView/AlertView.js +184 -0
- package/dist/components/Hud/Hud.js +29 -0
- package/dist/components/Hud/Loading/Loading.js +66 -0
- package/dist/components/Hud/PopoverView/PopoverView.js +47 -0
- package/dist/components/Hud/Scanner/Scanner.js +301 -0
- package/dist/components/Hud/Toast/Toast.js +71 -0
- package/dist/components/MenuView/MenuView.js +184 -0
- package/{lib/Modal/Modal.tsx → dist/components/Modal/Modal.js} +1 -4
- package/dist/components/MutiPictureView/MutiPictureView.js +239 -0
- package/dist/components/PictureViewer/PictureViewer.js +54 -0
- package/dist/components/RefreshList/RefreshList.js +155 -0
- package/dist/components/RichText/RichText.js +56 -0
- package/dist/components/StickHeaderView/StickHeaderView.js +37 -0
- package/dist/components/TableCell/TableCell.js +97 -0
- package/dist/components/TextInputArea/TextInputArea.js +65 -0
- package/dist/components/WithLoadingContainer/WithLoadingContainer.js +77 -0
- package/dist/index.js +31 -0
- package/dist/jsbridge/RNEasyui.js +46 -0
- package/{jsbridge/UpgradeModule.ts → dist/jsbridge/UpgradeModule.js} +25 -23
- package/{jsbridge/index.ts → dist/jsbridge/index.js} +2 -2
- package/{screen/index.ts → dist/screen/index.js} +2 -2
- package/dist/screen/px2dp.js +45 -0
- package/{screen/px2sp.ts → dist/screen/px2sp.js} +13 -20
- package/{screen/text-fit.ts → dist/screen/text-fit.js} +10 -20
- package/{utils/index.ts → dist/utils/index.js} +2 -2
- package/{utils/lazy.ts → dist/utils/lazy.js} +164 -165
- package/dist/utils/mode.js +50 -0
- package/package.json +31 -19
- package/readme.md +3 -3
- package/types/components/AnimationModal/AnimationModal.d.ts +27 -0
- package/types/components/AnimationModal/AnimationModal.d.ts.map +1 -0
- package/types/components/DottedLine/DottedLine.d.ts +10 -0
- package/types/components/DottedLine/DottedLine.d.ts.map +1 -0
- package/types/components/EchartsView/EchartsView.d.ts +10 -0
- package/types/components/EchartsView/EchartsView.d.ts.map +1 -0
- package/types/components/EchartsView/helper.d.ts +10 -0
- package/types/components/EchartsView/helper.d.ts.map +1 -0
- package/types/components/Hud/AlertBottomView/AlertBottomView.d.ts +25 -0
- package/types/components/Hud/AlertBottomView/AlertBottomView.d.ts.map +1 -0
- package/types/components/Hud/AlertSheetView/AlertSheetView.d.ts +19 -0
- package/types/components/Hud/AlertSheetView/AlertSheetView.d.ts.map +1 -0
- package/types/components/Hud/AlertView/AlertView.d.ts +25 -0
- package/types/components/Hud/AlertView/AlertView.d.ts.map +1 -0
- package/types/components/Hud/Hud.d.ts +11 -0
- package/types/components/Hud/Hud.d.ts.map +1 -0
- package/types/components/Hud/Loading/Loading.d.ts +11 -0
- package/types/components/Hud/Loading/Loading.d.ts.map +1 -0
- package/types/components/Hud/PopoverView/PopoverView.d.ts +17 -0
- package/types/components/Hud/PopoverView/PopoverView.d.ts.map +1 -0
- package/types/components/Hud/Scanner/Scanner.d.ts +12 -0
- package/types/components/Hud/Scanner/Scanner.d.ts.map +1 -0
- package/types/components/Hud/Toast/Toast.d.ts +9 -0
- package/types/components/Hud/Toast/Toast.d.ts.map +1 -0
- package/types/components/MenuView/MenuView.d.ts +21 -0
- package/types/components/MenuView/MenuView.d.ts.map +1 -0
- package/types/components/Modal/Modal.d.ts +2 -0
- package/types/components/Modal/Modal.d.ts.map +1 -0
- package/{lib/MutiPictureView/index.ts → types/components/MutiPictureView/MutiPictureView.d.ts} +18 -31
- package/types/components/MutiPictureView/MutiPictureView.d.ts.map +1 -0
- package/types/components/PictureViewer/PictureViewer.d.ts +17 -0
- package/types/components/PictureViewer/PictureViewer.d.ts.map +1 -0
- package/types/components/RefreshList/RefreshList.d.ts +45 -0
- package/types/components/RefreshList/RefreshList.d.ts.map +1 -0
- package/types/components/RichText/RichText.d.ts +12 -0
- package/types/components/RichText/RichText.d.ts.map +1 -0
- package/types/components/StickHeaderView/StickHeaderView.d.ts +15 -0
- package/types/components/StickHeaderView/StickHeaderView.d.ts.map +1 -0
- package/{lib/TableCell/index.ts → types/components/TableCell/TableCell.d.ts} +8 -30
- package/types/components/TableCell/TableCell.d.ts.map +1 -0
- package/types/components/TextInputArea/TextInputArea.d.ts +17 -0
- package/types/components/TextInputArea/TextInputArea.d.ts.map +1 -0
- package/types/components/WithLoadingContainer/WithLoadingContainer.d.ts +23 -0
- package/types/components/WithLoadingContainer/WithLoadingContainer.d.ts.map +1 -0
- package/types/index.d.ts +22 -0
- package/types/index.d.ts.map +1 -0
- package/types/jsbridge/RNEasyui.d.ts +23 -0
- package/types/jsbridge/RNEasyui.d.ts.map +1 -0
- package/types/jsbridge/UpgradeModule.d.ts +26 -0
- package/types/jsbridge/UpgradeModule.d.ts.map +1 -0
- package/types/jsbridge/index.d.ts +3 -0
- package/types/jsbridge/index.d.ts.map +1 -0
- package/types/screen/index.d.ts +3 -0
- package/types/screen/index.d.ts.map +1 -0
- package/{screen/index.d.ts → types/screen/px2dp.d.ts} +6 -12
- package/types/screen/px2dp.d.ts.map +1 -0
- package/types/screen/px2sp.d.ts +2 -0
- package/types/screen/px2sp.d.ts.map +1 -0
- package/types/screen/text-fit.d.ts +5 -0
- package/types/screen/text-fit.d.ts.map +1 -0
- package/types/utils/index.d.ts +3 -0
- package/types/utils/index.d.ts.map +1 -0
- package/{utils/index.d.ts → types/utils/lazy.d.ts} +15 -53
- package/types/utils/lazy.d.ts.map +1 -0
- package/types/utils/mode.d.ts +24 -0
- package/types/utils/mode.d.ts.map +1 -0
- package/android/.DS_Store +0 -0
- package/android/src/.DS_Store +0 -0
- package/android/src/main/.DS_Store +0 -0
- package/android/src/main/java/.DS_Store +0 -0
- package/android/src/main/java/com/.DS_Store +0 -0
- package/android/src/main/java/com/easyui/.DS_Store +0 -0
- package/i.sh +0 -23
- package/ios/.DS_Store +0 -0
- package/ios/assets/.DS_Store +0 -0
- package/ios/views/.DS_Store +0 -0
- package/jsbridge/RNEasyui.ts +0 -42
- package/jsbridge/index.d.ts +0 -67
- package/lib/.DS_Store +0 -0
- package/lib/AnimationModal/AnimationModal.tsx +0 -201
- package/lib/AnimationModal/index.d.ts +0 -41
- package/lib/Badge/Badge.tsx +0 -40
- package/lib/Badge/index.ts +0 -21
- package/lib/DottedLine/DottedLine.tsx +0 -66
- package/lib/DottedLine/index.ts +0 -18
- package/lib/Echarts/demo.tsx +0 -235
- package/lib/Echarts/index.ts +0 -29
- package/lib/Hud/.DS_Store +0 -0
- package/lib/Hud/AlertBottomView/AlertBottomView.tsx +0 -228
- package/lib/Hud/AlertBottomView/index.d.ts +0 -42
- package/lib/Hud/AlertSheetView/AlertSheetView.tsx +0 -179
- package/lib/Hud/AlertSheetView/index.d.ts +0 -35
- package/lib/Hud/AlertView/AlertView.tsx +0 -234
- package/lib/Hud/AlertView/index.d.ts +0 -46
- package/lib/Hud/Hud.tsx +0 -67
- package/lib/Hud/Loading/Loading.tsx +0 -87
- package/lib/Hud/Loading/index.d.ts +0 -38
- package/lib/Hud/PopoverView/PopoverView.tsx +0 -66
- package/lib/Hud/PopoverView/index.d.ts +0 -39
- package/lib/Hud/Scanner/Scanner.tsx +0 -250
- package/lib/Hud/Scanner/index.d.ts +0 -42
- package/lib/Hud/Toast/Toast.tsx +0 -86
- package/lib/Hud/Toast/index.d.ts +0 -22
- package/lib/Hud/index.ts +0 -20
- package/lib/MenuView/MenuView.tsx +0 -252
- package/lib/MenuView/index.ts +0 -31
- package/lib/Modal/index.ts +0 -10
- package/lib/MutiPictureView/MutiPictureView.tsx +0 -259
- package/lib/PictureViewer/PictureViewer.tsx +0 -80
- package/lib/PictureViewer/index.ts +0 -26
- package/lib/RefreshList/RefreshList.tsx +0 -235
- package/lib/RefreshList/demo.tsx +0 -30
- package/lib/RefreshList/demo1.tsx +0 -60
- package/lib/RefreshList/demo2.tsx +0 -46
- package/lib/RefreshList/index.ts +0 -84
- package/lib/RichText/RichText.tsx +0 -82
- package/lib/RichText/index.ts +0 -21
- package/lib/StickHeaderView/StickHeaderView.tsx +0 -65
- package/lib/StickHeaderView/demo.tsx +0 -104
- package/lib/StickHeaderView/index.ts +0 -26
- package/lib/TableCell/TableCell.tsx +0 -118
- package/lib/TextInputArea/TextInputArea.tsx +0 -89
- package/lib/TextInputArea/index.d.ts +0 -33
- package/lib/WithLoadingContainer/WithLoadingContainer.tsx +0 -93
- package/lib/WithLoadingContainer/index.ts +0 -36
- package/screen/px2dp.ts +0 -51
- package/src/index.d.ts +0 -42
- package/src/index.ts +0 -54
- package/utils/mode.ts +0 -48
- /package/{lib/Hud/Scanner → dist/components/Hud/Scanner/assets}/flashlight-blue.png +0 -0
- /package/{lib/Hud/Scanner → dist/components/Hud/Scanner/assets}/flashlight-white.png +0 -0
- /package/{lib/Hud/Scanner → dist/components/Hud/Scanner/assets}/icon_back_white.png +0 -0
- /package/{lib/MutiPictureView → dist/components/MutiPictureView/assets}/icon_add_image.png +0 -0
- /package/{lib/MutiPictureView → dist/components/MutiPictureView/assets}/icon_del_image.png +0 -0
- /package/{lib/TableCell → dist/components/TableCell/assets}/back.png +0 -0
- /package/{lib/WithLoadingContainer → dist/components/WithLoadingContainer/assets}/loading.gif +0 -0
- /package/{lib/WithLoadingContainer → dist/components/WithLoadingContainer/assets}/loading3.gif +0 -0
- /package/{lib → dist/components}/index.md +0 -0
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { Dimensions, Platform, StatusBar, StyleSheet, Text, TouchableOpacity, View, } from "react-native";
|
|
3
|
+
import Modal from "react-native-modal";
|
|
4
|
+
import { px2dp } from "../../../screen/px2dp";
|
|
5
|
+
import { px2sp } from "../../../screen/px2sp";
|
|
6
|
+
export default React.forwardRef((_, ref) => {
|
|
7
|
+
const defaultState = {
|
|
8
|
+
visible: false,
|
|
9
|
+
actions: [],
|
|
10
|
+
};
|
|
11
|
+
const [state, setState] = React.useState(defaultState);
|
|
12
|
+
React.useImperativeHandle(ref, () => ({
|
|
13
|
+
show: async (options) => {
|
|
14
|
+
setState(Object.assign({}, defaultState, { visible: true }, options));
|
|
15
|
+
},
|
|
16
|
+
hide,
|
|
17
|
+
}), []);
|
|
18
|
+
const hide = async () => {
|
|
19
|
+
setState(defaultState);
|
|
20
|
+
};
|
|
21
|
+
React.useEffect(() => {
|
|
22
|
+
if (Platform.OS == "android") {
|
|
23
|
+
if (state.visible) {
|
|
24
|
+
StatusBar.setBackgroundColor("black");
|
|
25
|
+
StatusBar.setBarStyle("light-content");
|
|
26
|
+
}
|
|
27
|
+
else {
|
|
28
|
+
StatusBar.setBackgroundColor("transparent");
|
|
29
|
+
StatusBar.setBarStyle("dark-content");
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
}, [state.visible]);
|
|
33
|
+
return (<Modal hideModalContentWhileAnimating={true} //通过隐藏模态内容直到动画完成来增强性能
|
|
34
|
+
useNativeDriver={true} //定义动画是否应使用本机驱动程序
|
|
35
|
+
animationIn="slideInUp" animationOut="slideOutDown" onBackButtonPress={() => {
|
|
36
|
+
//按下Android后退按钮时调用
|
|
37
|
+
hide();
|
|
38
|
+
}} onBackdropPress={() => {
|
|
39
|
+
//按下背景时调用
|
|
40
|
+
hide();
|
|
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={() => {
|
|
56
|
+
hide();
|
|
57
|
+
}}>
|
|
58
|
+
<Text style={[styles.cancelText]}>取消</Text>
|
|
59
|
+
</TouchableOpacity>
|
|
60
|
+
</View>
|
|
61
|
+
</View>
|
|
62
|
+
</Modal>);
|
|
63
|
+
});
|
|
64
|
+
export const alertSheetViewRef = React.createRef();
|
|
65
|
+
export const showAlertSheetModal = (props) => {
|
|
66
|
+
alertSheetViewRef.current?.show(props);
|
|
67
|
+
};
|
|
68
|
+
const styles = StyleSheet.create({
|
|
69
|
+
container: {
|
|
70
|
+
display: "flex",
|
|
71
|
+
flexGrow: 1,
|
|
72
|
+
justifyContent: "flex-end",
|
|
73
|
+
alignItems: "center",
|
|
74
|
+
},
|
|
75
|
+
wrapper: {
|
|
76
|
+
flexGrow: 0,
|
|
77
|
+
flexShrink: 0,
|
|
78
|
+
width: "100%",
|
|
79
|
+
// backgroundColor: 'pink',
|
|
80
|
+
overflow: "hidden",
|
|
81
|
+
borderTopLeftRadius: px2dp(10),
|
|
82
|
+
borderTopRightRadius: px2dp(10),
|
|
83
|
+
display: "flex",
|
|
84
|
+
padding: px2dp(15),
|
|
85
|
+
},
|
|
86
|
+
cancel: {
|
|
87
|
+
height: px2dp(50),
|
|
88
|
+
display: "flex",
|
|
89
|
+
justifyContent: "center",
|
|
90
|
+
alignItems: "center",
|
|
91
|
+
borderRadius: px2dp(10),
|
|
92
|
+
backgroundColor: "white",
|
|
93
|
+
marginTop: px2dp(15),
|
|
94
|
+
},
|
|
95
|
+
cancelText: {
|
|
96
|
+
fontSize: px2sp(15),
|
|
97
|
+
color: "#2763FF",
|
|
98
|
+
},
|
|
99
|
+
itemContainer: {
|
|
100
|
+
display: "flex",
|
|
101
|
+
borderRadius: px2dp(10),
|
|
102
|
+
overflow: "hidden",
|
|
103
|
+
backgroundColor: "#f1f1f1",
|
|
104
|
+
},
|
|
105
|
+
item: {
|
|
106
|
+
height: px2dp(50),
|
|
107
|
+
display: "flex",
|
|
108
|
+
justifyContent: "center",
|
|
109
|
+
alignItems: "center",
|
|
110
|
+
backgroundColor: "white",
|
|
111
|
+
marginTop: px2dp(0.75),
|
|
112
|
+
},
|
|
113
|
+
itemText: {
|
|
114
|
+
fontSize: px2sp(12),
|
|
115
|
+
color: "#666666",
|
|
116
|
+
},
|
|
117
|
+
});
|
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { View, Text, StyleSheet, Platform, Modal, StatusBar, TouchableOpacity, Animated, Easing, } from "react-native";
|
|
3
|
+
import { px2dp, deviceWidth } from "../../../screen/px2dp";
|
|
4
|
+
import { px2sp } from "../../../screen/px2sp";
|
|
5
|
+
export default React.forwardRef((_, ref) => {
|
|
6
|
+
const defaultState = {
|
|
7
|
+
visible: false,
|
|
8
|
+
cancelText: "取消",
|
|
9
|
+
confirmText: "确定",
|
|
10
|
+
};
|
|
11
|
+
const [state, setState] = React.useState(defaultState);
|
|
12
|
+
const cancelCallbackRef = React.useRef(undefined);
|
|
13
|
+
const confirmCallbackRef = React.useRef(undefined);
|
|
14
|
+
React.useImperativeHandle(ref, () => ({
|
|
15
|
+
show: async (options) => {
|
|
16
|
+
setState(Object.assign({}, defaultState, { visible: true }, options));
|
|
17
|
+
cancelCallbackRef.current = options.cancel;
|
|
18
|
+
confirmCallbackRef.current = options.confirm;
|
|
19
|
+
// await sleep(50)
|
|
20
|
+
startAnimate(1);
|
|
21
|
+
},
|
|
22
|
+
hide,
|
|
23
|
+
}), []);
|
|
24
|
+
const hide = async () => {
|
|
25
|
+
startAnimate(0.3);
|
|
26
|
+
// await sleep(50)
|
|
27
|
+
setState(defaultState);
|
|
28
|
+
};
|
|
29
|
+
let scale_anim = React.useRef(new Animated.Value(0.3)).current;
|
|
30
|
+
const startAnimate = (x) => {
|
|
31
|
+
Animated.timing(scale_anim, {
|
|
32
|
+
toValue: x,
|
|
33
|
+
useNativeDriver: true,
|
|
34
|
+
duration: 150,
|
|
35
|
+
easing: Easing.ease,
|
|
36
|
+
}).start();
|
|
37
|
+
};
|
|
38
|
+
React.useEffect(() => {
|
|
39
|
+
if (Platform.OS == "android") {
|
|
40
|
+
if (state.visible) {
|
|
41
|
+
StatusBar.setBackgroundColor("black");
|
|
42
|
+
StatusBar.setBarStyle("light-content");
|
|
43
|
+
}
|
|
44
|
+
else {
|
|
45
|
+
StatusBar.setBackgroundColor("transparent");
|
|
46
|
+
StatusBar.setBarStyle("dark-content");
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
}, [state.visible]);
|
|
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>);
|
|
100
|
+
});
|
|
101
|
+
export const alertViewRef = React.createRef();
|
|
102
|
+
export const showAlertModal = (props) => {
|
|
103
|
+
alertViewRef.current?.show(props);
|
|
104
|
+
};
|
|
105
|
+
// const sleep = (msec?: number) => {
|
|
106
|
+
// return new Promise(resolve => {
|
|
107
|
+
// setTimeout(resolve, msec || 350);
|
|
108
|
+
// });
|
|
109
|
+
// }
|
|
110
|
+
const styles = StyleSheet.create({
|
|
111
|
+
container: {
|
|
112
|
+
display: "flex",
|
|
113
|
+
flexGrow: 1,
|
|
114
|
+
backgroundColor: "#00000088",
|
|
115
|
+
justifyContent: "center",
|
|
116
|
+
alignItems: "center",
|
|
117
|
+
},
|
|
118
|
+
wrapper: {
|
|
119
|
+
flexGrow: 0,
|
|
120
|
+
flexShrink: 0,
|
|
121
|
+
// minWidth: '70%',
|
|
122
|
+
minWidth: deviceWidth - px2dp(60),
|
|
123
|
+
backgroundColor: "white",
|
|
124
|
+
overflow: "hidden",
|
|
125
|
+
borderRadius: px2dp(10),
|
|
126
|
+
display: "flex",
|
|
127
|
+
padding: px2dp(15),
|
|
128
|
+
},
|
|
129
|
+
titleText: {
|
|
130
|
+
maxWidth: deviceWidth - px2dp(90),
|
|
131
|
+
fontSize: px2sp(18),
|
|
132
|
+
marginBottom: px2dp(20),
|
|
133
|
+
// backgroundColor: 'red',
|
|
134
|
+
textAlign: "center",
|
|
135
|
+
fontWeight: "bold",
|
|
136
|
+
color: "#1A1A1A",
|
|
137
|
+
},
|
|
138
|
+
contentText: {
|
|
139
|
+
maxWidth: deviceWidth - px2dp(90),
|
|
140
|
+
marginBottom: px2dp(20),
|
|
141
|
+
minHeight: px2dp(40),
|
|
142
|
+
flexGrow: 0,
|
|
143
|
+
flexShrink: 1,
|
|
144
|
+
width: undefined,
|
|
145
|
+
fontSize: px2sp(15),
|
|
146
|
+
// backgroundColor: 'red',
|
|
147
|
+
color: "#1A1A1A",
|
|
148
|
+
textAlign: "center",
|
|
149
|
+
},
|
|
150
|
+
action: {
|
|
151
|
+
display: "flex",
|
|
152
|
+
flexDirection: "row",
|
|
153
|
+
justifyContent: "space-between",
|
|
154
|
+
alignItems: "center",
|
|
155
|
+
// backgroundColor:"red"
|
|
156
|
+
},
|
|
157
|
+
cancel: {
|
|
158
|
+
width: "40%",
|
|
159
|
+
height: px2dp(44),
|
|
160
|
+
display: "flex",
|
|
161
|
+
justifyContent: "center",
|
|
162
|
+
alignItems: "center",
|
|
163
|
+
borderRadius: px2dp(10),
|
|
164
|
+
borderWidth: px2dp(1),
|
|
165
|
+
borderColor: "#A3A9CC",
|
|
166
|
+
},
|
|
167
|
+
confirm: {
|
|
168
|
+
width: "40%",
|
|
169
|
+
height: px2dp(44),
|
|
170
|
+
display: "flex",
|
|
171
|
+
justifyContent: "center",
|
|
172
|
+
alignItems: "center",
|
|
173
|
+
backgroundColor: "#2763FF",
|
|
174
|
+
borderRadius: px2dp(10),
|
|
175
|
+
},
|
|
176
|
+
cancelText: {
|
|
177
|
+
fontSize: px2sp(15),
|
|
178
|
+
color: "#A3A9CC",
|
|
179
|
+
},
|
|
180
|
+
confirmText: {
|
|
181
|
+
fontSize: px2sp(15),
|
|
182
|
+
color: "white",
|
|
183
|
+
},
|
|
184
|
+
});
|
|
@@ -0,0 +1,29 @@
|
|
|
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
|
+
*/
|
|
8
|
+
import * as React from 'react';
|
|
9
|
+
// import { StyleSheet } from 'react-native'
|
|
10
|
+
import { alertViewRef, default as AlertView, showAlertModal } from './AlertView/AlertView';
|
|
11
|
+
import { alertBottomViewRef, default as AlertBottomView, showAlertBottomModal } from './AlertBottomView/AlertBottomView';
|
|
12
|
+
import { alertSheetViewRef, default as AlertSheetView, showAlertSheetModal } from './AlertSheetView/AlertSheetView';
|
|
13
|
+
import { hideLoading, Loading, loadingRef, showLoading } from './Loading/Loading';
|
|
14
|
+
import { showToast, Toast, toastRef } from './Toast/Toast';
|
|
15
|
+
import { showPopoverView, hidePopoverView, popoverViewRef, PopoverView } from './PopoverView/PopoverView';
|
|
16
|
+
import { showScanner, hideScanner, scannerRef, Scanner } from './Scanner/Scanner';
|
|
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}/>,
|
|
28
|
+
]);
|
|
29
|
+
export { showAlertModal, showToast, showLoading, hideLoading, showAlertBottomModal, showAlertSheetModal, showPopoverView, hidePopoverView, showScanner, hideScanner, };
|
|
@@ -0,0 +1,66 @@
|
|
|
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
|
+
*/
|
|
8
|
+
import React, { useImperativeHandle, useState } from "react";
|
|
9
|
+
import { View, ActivityIndicator, StyleSheet, Text, Dimensions, TouchableOpacity, BackHandler, } from "react-native";
|
|
10
|
+
export const Loading = React.forwardRef((_, ref) => {
|
|
11
|
+
const [show, setShow] = useState(false);
|
|
12
|
+
const [tipText, setTipText] = useState("加载中");
|
|
13
|
+
React.useEffect(() => {
|
|
14
|
+
const onBackPress = () => show;
|
|
15
|
+
BackHandler.addEventListener("hardwareBackPress", onBackPress);
|
|
16
|
+
// return () => BackHandler.removeEventListener('hardwareBackPress', onBackPress);
|
|
17
|
+
}, [show]);
|
|
18
|
+
useImperativeHandle(ref, () => ({
|
|
19
|
+
showLoading: (content) => {
|
|
20
|
+
setShow(true);
|
|
21
|
+
setTipText(content || "加载中");
|
|
22
|
+
},
|
|
23
|
+
hideLoading: () => {
|
|
24
|
+
setShow(false);
|
|
25
|
+
},
|
|
26
|
+
}), [show]);
|
|
27
|
+
if (!show)
|
|
28
|
+
return null;
|
|
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>);
|
|
37
|
+
});
|
|
38
|
+
export const loadingRef = React.createRef();
|
|
39
|
+
export const showLoading = (content) => loadingRef.current?.showLoading(content);
|
|
40
|
+
export const hideLoading = () => loadingRef.current?.hideLoading();
|
|
41
|
+
const SCREEN_WIDTH = Dimensions.get("window").width;
|
|
42
|
+
const styles = StyleSheet.create({
|
|
43
|
+
container: {
|
|
44
|
+
...StyleSheet.absoluteFill,
|
|
45
|
+
display: "flex",
|
|
46
|
+
justifyContent: "center",
|
|
47
|
+
alignItems: "center",
|
|
48
|
+
// backgroundColor:'red'
|
|
49
|
+
},
|
|
50
|
+
warpper: {
|
|
51
|
+
backgroundColor: "#00000088",
|
|
52
|
+
padding: 40,
|
|
53
|
+
paddingVertical: 20,
|
|
54
|
+
borderRadius: 10,
|
|
55
|
+
justifyContent: "center",
|
|
56
|
+
alignItems: "center",
|
|
57
|
+
minWidth: 90,
|
|
58
|
+
},
|
|
59
|
+
title: {
|
|
60
|
+
marginTop: 5,
|
|
61
|
+
fontSize: 13,
|
|
62
|
+
lineHeight: 16,
|
|
63
|
+
color: "white",
|
|
64
|
+
maxWidth: SCREEN_WIDTH * 0.5,
|
|
65
|
+
},
|
|
66
|
+
});
|
|
@@ -0,0 +1,47 @@
|
|
|
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
|
+
*/
|
|
8
|
+
import React, { useImperativeHandle, useState } from "react";
|
|
9
|
+
import { StyleSheet, TouchableOpacity, BackHandler, } from "react-native";
|
|
10
|
+
export const PopoverView = React.forwardRef((_, ref) => {
|
|
11
|
+
const [visible, setVisible] = useState(false);
|
|
12
|
+
const [options, setOptions] = useState();
|
|
13
|
+
React.useEffect(() => {
|
|
14
|
+
const onBackPress = () => visible;
|
|
15
|
+
BackHandler.addEventListener("hardwareBackPress", onBackPress);
|
|
16
|
+
// return () => BackHandler.removeEventListener('hardwareBackPress', onBackPress);
|
|
17
|
+
}, [visible]);
|
|
18
|
+
useImperativeHandle(ref, () => ({
|
|
19
|
+
showPopoverView: (options) => {
|
|
20
|
+
setVisible(true);
|
|
21
|
+
setOptions(options);
|
|
22
|
+
},
|
|
23
|
+
hidePopoverView: () => {
|
|
24
|
+
setVisible(false);
|
|
25
|
+
setOptions(undefined);
|
|
26
|
+
},
|
|
27
|
+
}), [visible]);
|
|
28
|
+
if (!visible)
|
|
29
|
+
return null;
|
|
30
|
+
return (<TouchableOpacity activeOpacity={1} style={[styles.container, options?.style]} disabled={options?.disabled} onPress={(e) => {
|
|
31
|
+
setVisible(false);
|
|
32
|
+
setOptions(undefined);
|
|
33
|
+
// e.stopPropagation()
|
|
34
|
+
}}>
|
|
35
|
+
{React.isValidElement(options?.content) && options?.content}
|
|
36
|
+
</TouchableOpacity>);
|
|
37
|
+
});
|
|
38
|
+
export const popoverViewRef = React.createRef();
|
|
39
|
+
export const showPopoverView = (options) => popoverViewRef.current?.showPopoverView(options);
|
|
40
|
+
export const hidePopoverView = () => popoverViewRef.current?.hidePopoverView();
|
|
41
|
+
const styles = StyleSheet.create({
|
|
42
|
+
container: {
|
|
43
|
+
...StyleSheet.absoluteFill,
|
|
44
|
+
display: "flex",
|
|
45
|
+
// backgroundColor:'red'
|
|
46
|
+
},
|
|
47
|
+
});
|