@aks-dev/easyui 1.0.181 → 1.0.183

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.

Files changed (53) hide show
  1. package/dist/components/AnimationModal/AnimationModal.js +15 -19
  2. package/dist/components/Badge/Badge.js +13 -18
  3. package/dist/components/DottedLine/DottedLine.js +7 -10
  4. package/dist/components/Echarts/EchartsView.js +14 -18
  5. package/dist/components/Echarts/helper.js +2 -7
  6. package/dist/components/Hud/AlertBottomView/AlertBottomView.js +56 -61
  7. package/dist/components/Hud/AlertSheetView/AlertSheetView.js +42 -47
  8. package/dist/components/Hud/AlertView/AlertView.js +55 -60
  9. package/dist/components/Hud/Hud.js +17 -31
  10. package/dist/components/Hud/Loading/Loading.js +21 -27
  11. package/dist/components/Hud/PopoverView/PopoverView.js +16 -22
  12. package/dist/components/Hud/Scanner/Scanner.js +110 -116
  13. package/dist/components/Hud/Toast/Toast.js +22 -27
  14. package/dist/components/MenuView/MenuView.js +31 -34
  15. package/dist/components/Modal/Modal.js +1 -6
  16. package/dist/components/MutiPictureView/MutiPictureView.js +37 -40
  17. package/dist/components/PictureViewer/PictureViewer.js +12 -17
  18. package/dist/components/RefreshList/RefreshList.js +47 -51
  19. package/dist/components/RichText/RichText.js +17 -20
  20. package/dist/components/StickHeaderView/StickHeaderView.js +7 -10
  21. package/dist/components/TableCell/TableCell.js +30 -33
  22. package/dist/components/TextInputArea/TextInputArea.js +25 -28
  23. package/dist/components/WithLoadingContainer/WithLoadingContainer.js +22 -26
  24. package/dist/components/index.md +15 -0
  25. package/dist/index.js +19 -51
  26. package/dist/jsbridge/RNEasyui.js +11 -18
  27. package/dist/jsbridge/UpgradeModule.js +8 -14
  28. package/dist/jsbridge/index.js +2 -5
  29. package/dist/screen/index.js +2 -5
  30. package/dist/screen/px2dp.js +14 -18
  31. package/dist/screen/px2sp.js +5 -9
  32. package/dist/screen/text-fit.js +7 -10
  33. package/dist/utils/index.js +2 -5
  34. package/dist/utils/lazy.js +25 -50
  35. package/dist/utils/mode.js +8 -13
  36. package/package.json +6 -4
  37. package/readme.md +1 -1
  38. package/dist/assets/back.png +0 -0
  39. package/dist/assets/flashlight-blue.png +0 -0
  40. package/dist/assets/flashlight-white.png +0 -0
  41. package/dist/assets/icon_add_image.png +0 -0
  42. package/dist/assets/icon_back_white.png +0 -0
  43. package/dist/assets/icon_del_image.png +0 -0
  44. package/dist/assets/loading.gif +0 -0
  45. package/dist/assets/loading3.gif +0 -0
  46. /package/dist/{assets → components/Hud/Scanner}/assets/flashlight-blue.png +0 -0
  47. /package/dist/{assets → components/Hud/Scanner}/assets/flashlight-white.png +0 -0
  48. /package/dist/{assets → components/Hud/Scanner}/assets/icon_back_white.png +0 -0
  49. /package/dist/{assets → components/MutiPictureView}/assets/icon_add_image.png +0 -0
  50. /package/dist/{assets → components/MutiPictureView}/assets/icon_del_image.png +0 -0
  51. /package/dist/{assets → components/TableCell}/assets/back.png +0 -0
  52. /package/dist/{assets → components/WithLoadingContainer}/assets/loading.gif +0 -0
  53. /package/dist/{assets → components/WithLoadingContainer}/assets/loading3.gif +0 -0
@@ -1,4 +1,3 @@
1
- "use strict";
2
1
  /*
3
2
  * @Author: shiguo
4
3
  * @Date: 2022-05-17 15:22:06
@@ -6,32 +5,29 @@
6
5
  * @LastEditTime: 2023-09-27 15:17:15
7
6
  * @FilePath: /@aks-dev/easyui/lib/AnimationModal/AnimationModal.tsx
8
7
  */
9
- Object.defineProperty(exports, "__esModule", { value: true });
10
- exports.AnimationModal = void 0;
11
- const tslib_1 = require("tslib");
12
- const React = tslib_1.__importStar(require("react"));
13
- const react_native_1 = require("react-native");
14
- const utils = tslib_1.__importStar(require("../../utils/lazy"));
8
+ import * as React from "react";
9
+ import { View, Animated, Easing, PanResponder, StyleSheet, useWindowDimensions, BackHandler, } from "react-native";
10
+ import * as utils from "../../utils/lazy";
15
11
  // type State = {
16
12
  // display: 'flex' | 'none';
17
13
  // }
18
14
  // type StateReducerProps = (state: State, action: Partial<State>) => State
19
- exports.AnimationModal = React.forwardRef((props, ref) => {
15
+ export const AnimationModal = React.forwardRef((props, ref) => {
20
16
  const { animationType = "from-bottom", mask = false } = props || {};
21
- const { height } = (0, react_native_1.useWindowDimensions)();
17
+ const { height } = useWindowDimensions();
22
18
  // const [state, dispatch] = React.useReducer<StateReducerProps>(
23
19
  // (state, action) => ({ ...state, ...action }),
24
20
  // {
25
21
  // display: 'none'
26
22
  // })
27
23
  const [display, setDisplay] = useCallbackState("none");
28
- const animatedValue = React.useRef(new react_native_1.Animated.Value(0)).current;
24
+ const animatedValue = React.useRef(new Animated.Value(0)).current;
29
25
  const timing = (value) => {
30
- react_native_1.Animated.timing(animatedValue, {
26
+ Animated.timing(animatedValue, {
31
27
  toValue: value,
32
28
  duration: 350,
33
29
  useNativeDriver: true,
34
- easing: react_native_1.Easing.ease,
30
+ easing: Easing.ease,
35
31
  }).start(({ finished }) => {
36
32
  /* 动画完成的回调函数 */
37
33
  });
@@ -72,16 +68,16 @@ exports.AnimationModal = React.forwardRef((props, ref) => {
72
68
  return init();
73
69
  };
74
70
  React.useEffect(() => {
75
- let addEventListener = react_native_1.BackHandler.addEventListener("hardwareBackPress", () => {
71
+ let addEventListener = BackHandler.addEventListener("hardwareBackPress", () => {
76
72
  return display == "flex";
77
73
  });
78
74
  return () => {
79
75
  addEventListener.remove();
80
76
  };
81
77
  }, [display]);
82
- return (<react_native_1.View style={Object.assign({
78
+ return (<View style={Object.assign({
83
79
  display: display,
84
- }, styles.container, props.style)} {...react_native_1.PanResponder.create({
80
+ }, styles.container, props.style)} {...PanResponder.create({
85
81
  onStartShouldSetPanResponder: (e, gestureState) => {
86
82
  let pageY = e.nativeEvent.pageY;
87
83
  let topY = height - layoutRef.current.h1;
@@ -100,7 +96,7 @@ exports.AnimationModal = React.forwardRef((props, ref) => {
100
96
  }
101
97
  },
102
98
  }).panHandlers}>
103
- <react_native_1.Animated.View style={Object.assign({}, styles.wrapper, {
99
+ <Animated.View style={Object.assign({}, styles.wrapper, {
104
100
  transform: [{ translateY: animatedValue }],
105
101
  })}
106
102
  // onLayout={e => {
@@ -109,10 +105,10 @@ exports.AnimationModal = React.forwardRef((props, ref) => {
109
105
  // }}
110
106
  ref={viewRef}>
111
107
  {props.children}
112
- </react_native_1.Animated.View>
113
- </react_native_1.View>);
108
+ </Animated.View>
109
+ </View>);
114
110
  });
115
- const styles = react_native_1.StyleSheet.create({
111
+ const styles = StyleSheet.create({
116
112
  container: {
117
113
  position: "absolute",
118
114
  left: 0,
@@ -1,7 +1,3 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Badge = void 0;
4
- const tslib_1 = require("tslib");
5
1
  /*
6
2
  * @Author: shiguo
7
3
  * @Date: 2022-04-21 14:40:29
@@ -9,32 +5,31 @@ const tslib_1 = require("tslib");
9
5
  * @LastEditTime: 2022-07-08 15:40:21
10
6
  * @FilePath: /@aks-dev/easyui/lib/Badge/Badge.tsx
11
7
  */
12
- const react_1 = tslib_1.__importDefault(require("react"));
13
- const react_native_1 = require("react-native");
14
- const px2dp_1 = require("../../screen/px2dp");
15
- const px2sp_1 = require("../../screen/px2sp");
16
- const Badge = (props) => {
8
+ import React from "react";
9
+ import { View, Text } from "react-native";
10
+ import { px2dp } from "../../screen/px2dp";
11
+ import { px2sp } from "../../screen/px2sp";
12
+ export const Badge = (props) => {
17
13
  if (isNaN(+props.count) || Number(props.count) == 0)
18
- return <react_native_1.View />;
19
- return (<react_native_1.View style={[
14
+ return <View />;
15
+ return (<View style={[
20
16
  {
21
17
  flexGrow: 0,
22
18
  flexShrink: 1,
23
19
  zIndex: 1,
24
20
  // paddingHorizontal: px2dp(0),
25
- height: (0, px2dp_1.px2dp)(16),
26
- minWidth: (0, px2dp_1.px2dp)(16),
27
- borderRadius: (0, px2dp_1.px2dp)(8),
21
+ height: px2dp(16),
22
+ minWidth: px2dp(16),
23
+ borderRadius: px2dp(8),
28
24
  justifyContent: "center",
29
25
  alignItems: "center",
30
26
  backgroundColor: "red",
31
27
  },
32
28
  props.style,
33
29
  ]}>
34
- <react_native_1.Text style={{ fontSize: (0, px2sp_1.px2sp)(12), color: "white", textAlign: "center" }}>
30
+ <Text style={{ fontSize: px2sp(12), color: "white", textAlign: "center" }}>
35
31
  {" "}
36
32
  {Number(props.count) > 99 ? "+99" : props.count}{" "}
37
- </react_native_1.Text>
38
- </react_native_1.View>);
33
+ </Text>
34
+ </View>);
39
35
  };
40
- exports.Badge = Badge;
@@ -1,6 +1,3 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const tslib_1 = require("tslib");
4
1
  /*
5
2
  * @Author: shiguo
6
3
  * @Date: 2022-07-12 15:30:19
@@ -8,25 +5,25 @@ const tslib_1 = require("tslib");
8
5
  * @LastEditTime: 2022-07-12 15:33:06
9
6
  * @FilePath: /@aks-dev/easyui/lib/DottedLine/DottedLine.tsx
10
7
  */
11
- const react_1 = tslib_1.__importDefault(require("react"));
12
- const react_native_1 = require("react-native");
13
- exports.default = (props) => {
8
+ import React from "react";
9
+ import { StyleSheet, View } from "react-native";
10
+ export default (props) => {
14
11
  const { vertical = false, dottedColor, dottedCount = 200, ...rest } = props;
15
12
  const arrs = Array.from({ length: dottedCount }, (k, v) => v);
16
- return (<react_native_1.View style={{
13
+ return (<View style={{
17
14
  ...styles.container,
18
15
  flexDirection: vertical ? "column" : "row",
19
16
  ...rest.style,
20
17
  }}>
21
18
  {arrs.map((item, index) => {
22
- return (<react_native_1.View key={`dotted-${index}`} style={{
19
+ return (<View key={`dotted-${index}`} style={{
23
20
  ...(vertical ? styles.dotted_vertical : styles.dotted_horizontal),
24
21
  ...(dottedColor && { backgroundColor: dottedColor }),
25
22
  }}/>);
26
23
  })}
27
- </react_native_1.View>);
24
+ </View>);
28
25
  };
29
- const styles = react_native_1.StyleSheet.create({
26
+ const styles = StyleSheet.create({
30
27
  container: {
31
28
  display: "flex",
32
29
  flexGrow: 1,
@@ -1,7 +1,3 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.echarts = void 0;
4
- const tslib_1 = require("tslib");
5
1
  /*
6
2
  * @Author: shiguo
7
3
  * @Date: 2022-05-05 14:52:53
@@ -9,10 +5,10 @@ const tslib_1 = require("tslib");
9
5
  * @LastEditTime: 2023-01-03 17:50:43
10
6
  * @FilePath: /@aks-dev/easyui/lib/Echarts/EchartsView.tsx
11
7
  */
12
- const React = tslib_1.__importStar(require("react"));
13
- const react_native_1 = require("react-native");
14
- const react_native_webview_1 = require("react-native-webview");
15
- const helper_1 = require("./helper");
8
+ import * as React from "react";
9
+ import { StyleSheet, View, } from "react-native";
10
+ import { WebView } from "react-native-webview";
11
+ import { getHtml, toString } from "./helper";
16
12
  // type Reducer = (prevState: State, action: Partial<State>) => State;
17
13
  const EchartsView = (props) => {
18
14
  const [state, dispatch] = React.useReducer((prevState, ...args) => Object.assign({}, prevState, ...args), {
@@ -58,7 +54,7 @@ const EchartsView = (props) => {
58
54
  instance = echarts.init(document.getElementById('main'));
59
55
  }
60
56
  instance.clear();
61
- instance.setOption(${(0, helper_1.toString)(props.option)});
57
+ instance.setOption(${toString(props.option)});
62
58
  })();
63
59
  `;
64
60
  WebViewRef.current?.injectJavaScript(run);
@@ -110,12 +106,12 @@ const EchartsView = (props) => {
110
106
  // })();
111
107
  // `
112
108
  // }
113
- return (<react_native_1.View style={[styles.container, props.style]} ref={containerRef}>
114
- <react_native_webview_1.WebView ref={WebViewRef} originWhitelist={["*"]} useWebKit={true} // ios使用最新webkit内核渲染
109
+ return (<View style={[styles.container, props.style]} ref={containerRef}>
110
+ <WebView ref={WebViewRef} originWhitelist={["*"]} useWebKit={true} // ios使用最新webkit内核渲染
115
111
  allowUniversalAccessFromFileURLs={true} geolocationEnabled={true} mixedContentMode={"always"} renderLoading={() => {
116
112
  if (props.renderLoading)
117
113
  return props.renderLoading();
118
- return (<react_native_1.View style={{
114
+ return (<View style={{
119
115
  backgroundColor: props.style?.backgroundColor || "transparent",
120
116
  }}/>);
121
117
  }} // 设置空View,修复ioswebview闪白
@@ -136,20 +132,20 @@ const EchartsView = (props) => {
136
132
  console.log("onError", e);
137
133
  }} source={{
138
134
  baseUrl: "",
139
- html: (0, helper_1.getHtml)({
135
+ html: getHtml({
140
136
  backgroundColor: props.style?.backgroundColor || "transparent",
141
137
  }),
142
138
  }}/>
143
- </react_native_1.View>);
139
+ </View>);
144
140
  };
145
- const styles = react_native_1.StyleSheet.create({
141
+ const styles = StyleSheet.create({
146
142
  container: {
147
143
  display: "flex",
148
144
  flexGrow: 0,
149
145
  backgroundColor: "white",
150
146
  },
151
147
  });
152
- exports.default = EchartsView;
148
+ export default EchartsView;
153
149
  // React.memo(EchartsView)
154
- const echarts = tslib_1.__importStar(require("echarts/core"));
155
- exports.echarts = echarts;
150
+ import * as echarts from "echarts/core";
151
+ export { echarts };
@@ -1,4 +1,3 @@
1
- "use strict";
2
1
  /*
3
2
  * @Author: shiguo
4
3
  * @Date: 2022-05-05 15:56:21
@@ -6,9 +5,7 @@
6
5
  * @LastEditTime: 2023-01-03 17:02:57
7
6
  * @FilePath: /@aks-dev/easyui/lib/Echarts/helper.tsx
8
7
  */
9
- Object.defineProperty(exports, "__esModule", { value: true });
10
- exports.toString = exports.getHtml = void 0;
11
- const getHtml = (props) => {
8
+ export const getHtml = (props) => {
12
9
  return `
13
10
  <!DOCTYPE html>
14
11
  <html>
@@ -45,13 +42,12 @@ const getHtml = (props) => {
45
42
  </html>
46
43
  `;
47
44
  };
48
- exports.getHtml = getHtml;
49
45
  /**
50
46
  * https://res.actiiot.com/echarts/5.0.2/echarts.min.js
51
47
  *
52
48
  * https://cdnjs.cloudflare.com/ajax/libs/echarts/5.4.1/echarts.min.js
53
49
  */
54
- const toString = (obj) => {
50
+ export const toString = (obj) => {
55
51
  let result = JSON.stringify(obj, function (key, val) {
56
52
  // 对function进行特殊处理
57
53
  if (typeof val === 'function') {
@@ -65,5 +61,4 @@ const toString = (obj) => {
65
61
  } while (result.indexOf('~ha~') >= 0);
66
62
  return result;
67
63
  };
68
- exports.toString = toString;
69
64
  ///.replace(/\\n/g, '')
@@ -1,13 +1,9 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.showAlertBottomModal = exports.alertBottomViewRef = void 0;
4
- const tslib_1 = require("tslib");
5
- const React = tslib_1.__importStar(require("react"));
6
- const react_native_1 = require("react-native");
7
- const react_native_modal_1 = tslib_1.__importDefault(require("react-native-modal"));
8
- const px2dp_1 = require("../../../screen/px2dp");
9
- const px2sp_1 = require("../../../screen/px2sp");
10
- exports.default = React.forwardRef((_, ref) => {
1
+ import * as React from "react";
2
+ import { View, Text, StyleSheet, Platform, StatusBar, TouchableOpacity, Dimensions, } from "react-native";
3
+ import Modal from "react-native-modal";
4
+ import { px2dp, deviceWidth } from "../../../screen/px2dp";
5
+ import { px2sp } from "../../../screen/px2sp";
6
+ export default React.forwardRef((_, ref) => {
11
7
  const defaultState = {
12
8
  visible: false,
13
9
  cancelText: "取消",
@@ -28,18 +24,18 @@ exports.default = React.forwardRef((_, ref) => {
28
24
  setState(defaultState);
29
25
  };
30
26
  React.useEffect(() => {
31
- if (react_native_1.Platform.OS == "android") {
27
+ if (Platform.OS == "android") {
32
28
  if (state.visible) {
33
- react_native_1.StatusBar.setBackgroundColor("black");
34
- react_native_1.StatusBar.setBarStyle("light-content");
29
+ StatusBar.setBackgroundColor("black");
30
+ StatusBar.setBarStyle("light-content");
35
31
  }
36
32
  else {
37
- react_native_1.StatusBar.setBackgroundColor("transparent");
38
- react_native_1.StatusBar.setBarStyle("dark-content");
33
+ StatusBar.setBackgroundColor("transparent");
34
+ StatusBar.setBarStyle("dark-content");
39
35
  }
40
36
  }
41
37
  }, [state.visible]);
42
- return (<react_native_modal_1.default hideModalContentWhileAnimating={true} //通过隐藏模态内容直到动画完成来增强性能
38
+ return (<Modal hideModalContentWhileAnimating={true} //通过隐藏模态内容直到动画完成来增强性能
43
39
  useNativeDriver={true} //定义动画是否应使用本机驱动程序
44
40
  animationIn="slideInUp" animationOut="slideOutDown" onBackButtonPress={() => {
45
41
  //按下Android后退按钮时调用
@@ -47,63 +43,62 @@ exports.default = React.forwardRef((_, ref) => {
47
43
  }} onBackdropPress={() => {
48
44
  //按下背景时调用
49
45
  hide();
50
- }} isVisible={state.visible} style={{ margin: 0 }} deviceHeight={react_native_1.Dimensions.get("screen").height}>
51
- <react_native_1.View style={styles.container}>
52
- <react_native_1.View style={[styles.wrapper, state.wrapperStyle]}>
53
- {state.title && <react_native_1.Text style={styles.titleText}>{state.title}</react_native_1.Text>}
54
- <react_native_1.View style={[state.contentContainerStyle]}>
46
+ }} isVisible={state.visible} style={{ margin: 0 }} deviceHeight={Dimensions.get("screen").height}>
47
+ <View style={styles.container}>
48
+ <View style={[styles.wrapper, state.wrapperStyle]}>
49
+ {state.title && <Text style={styles.titleText}>{state.title}</Text>}
50
+ <View style={[state.contentContainerStyle]}>
55
51
  {(() => {
56
52
  if (typeof state.content == "string")
57
- return <react_native_1.Text style={styles.contentText}>{state.content}</react_native_1.Text>;
53
+ return <Text style={styles.contentText}>{state.content}</Text>;
58
54
  if (React.isValidElement(state.content))
59
55
  return state.content;
60
- return <react_native_1.View />;
56
+ return <View />;
61
57
  })()}
62
- </react_native_1.View>
63
- {(state.cancelText || state.confirmText) && (<react_native_1.View style={styles.action}>
64
- {state.cancelText && (<react_native_1.TouchableOpacity style={[
58
+ </View>
59
+ {(state.cancelText || state.confirmText) && (<View style={styles.action}>
60
+ {state.cancelText && (<TouchableOpacity style={[
65
61
  styles.cancel,
66
- { marginRight: state.confirmText ? (0, px2dp_1.px2dp)(15) : 0 },
62
+ { marginRight: state.confirmText ? px2dp(15) : 0 },
67
63
  state.cancelContainerStyle,
68
64
  ]} activeOpacity={0.8} onPress={() => {
69
65
  hide();
70
66
  cancelCallbackRef.current && cancelCallbackRef.current();
71
67
  cancelCallbackRef.current = undefined;
72
68
  }}>
73
- <react_native_1.Text style={[styles.cancelText, state.cancelTextStyle]}>
69
+ <Text style={[styles.cancelText, state.cancelTextStyle]}>
74
70
  {state.cancelText}
75
- </react_native_1.Text>
76
- </react_native_1.TouchableOpacity>)}
71
+ </Text>
72
+ </TouchableOpacity>)}
77
73
 
78
- {state.confirmText && (<react_native_1.TouchableOpacity style={[
74
+ {state.confirmText && (<TouchableOpacity style={[
79
75
  styles.confirm,
80
- { marginLeft: state.cancelText ? (0, px2dp_1.px2dp)(15) : 0 },
76
+ { marginLeft: state.cancelText ? px2dp(15) : 0 },
81
77
  state.confirmContainerStyle,
82
78
  ]} activeOpacity={0.8} onPress={() => {
83
79
  hide();
84
80
  confirmCallbackRef.current && confirmCallbackRef.current();
85
81
  confirmCallbackRef.current = undefined;
86
82
  }}>
87
- <react_native_1.Text style={[styles.confirmText, state.confirmTextStyle]}>
83
+ <Text style={[styles.confirmText, state.confirmTextStyle]}>
88
84
  {state.confirmText}
89
- </react_native_1.Text>
90
- </react_native_1.TouchableOpacity>)}
91
- </react_native_1.View>)}
92
- </react_native_1.View>
93
- </react_native_1.View>
94
- </react_native_modal_1.default>);
85
+ </Text>
86
+ </TouchableOpacity>)}
87
+ </View>)}
88
+ </View>
89
+ </View>
90
+ </Modal>);
95
91
  });
96
- exports.alertBottomViewRef = React.createRef();
97
- const showAlertBottomModal = (props) => {
98
- exports.alertBottomViewRef.current?.show(props);
92
+ export const alertBottomViewRef = React.createRef();
93
+ export const showAlertBottomModal = (props) => {
94
+ alertBottomViewRef.current?.show(props);
99
95
  };
100
- exports.showAlertBottomModal = showAlertBottomModal;
101
96
  // const sleep = (msec?: number) => {
102
97
  // return new Promise(resolve => {
103
98
  // setTimeout(resolve, msec || 350);
104
99
  // });
105
100
  // }
106
- const styles = react_native_1.StyleSheet.create({
101
+ const styles = StyleSheet.create({
107
102
  container: {
108
103
  display: "flex",
109
104
  flexGrow: 1,
@@ -116,28 +111,28 @@ const styles = react_native_1.StyleSheet.create({
116
111
  width: "100%",
117
112
  backgroundColor: "white",
118
113
  overflow: "hidden",
119
- borderTopLeftRadius: (0, px2dp_1.px2dp)(10),
120
- borderTopRightRadius: (0, px2dp_1.px2dp)(10),
114
+ borderTopLeftRadius: px2dp(10),
115
+ borderTopRightRadius: px2dp(10),
121
116
  display: "flex",
122
- padding: (0, px2dp_1.px2dp)(15),
117
+ padding: px2dp(15),
123
118
  },
124
119
  titleText: {
125
- maxWidth: px2dp_1.deviceWidth - (0, px2dp_1.px2dp)(30),
126
- fontSize: (0, px2sp_1.px2sp)(18),
127
- marginBottom: (0, px2dp_1.px2dp)(20),
120
+ maxWidth: deviceWidth - px2dp(30),
121
+ fontSize: px2sp(18),
122
+ marginBottom: px2dp(20),
128
123
  // backgroundColor: 'red',
129
124
  textAlign: "center",
130
125
  fontWeight: "bold",
131
126
  color: "#1A1A1A",
132
127
  },
133
128
  contentText: {
134
- maxWidth: px2dp_1.deviceWidth - (0, px2dp_1.px2dp)(30),
135
- marginBottom: (0, px2dp_1.px2dp)(20),
136
- minHeight: (0, px2dp_1.px2dp)(40),
129
+ maxWidth: deviceWidth - px2dp(30),
130
+ marginBottom: px2dp(20),
131
+ minHeight: px2dp(40),
137
132
  flexGrow: 0,
138
133
  flexShrink: 1,
139
134
  width: undefined,
140
- fontSize: (0, px2sp_1.px2sp)(15),
135
+ fontSize: px2sp(15),
141
136
  // backgroundColor: 'red',
142
137
  color: "#1A1A1A",
143
138
  textAlign: "center",
@@ -151,29 +146,29 @@ const styles = react_native_1.StyleSheet.create({
151
146
  },
152
147
  cancel: {
153
148
  width: "40%",
154
- height: (0, px2dp_1.px2dp)(44),
149
+ height: px2dp(44),
155
150
  display: "flex",
156
151
  justifyContent: "center",
157
152
  alignItems: "center",
158
- borderRadius: (0, px2dp_1.px2dp)(10),
159
- borderWidth: (0, px2dp_1.px2dp)(1),
153
+ borderRadius: px2dp(10),
154
+ borderWidth: px2dp(1),
160
155
  borderColor: "#A3A9CC",
161
156
  },
162
157
  confirm: {
163
158
  width: "40%",
164
- height: (0, px2dp_1.px2dp)(44),
159
+ height: px2dp(44),
165
160
  display: "flex",
166
161
  justifyContent: "center",
167
162
  alignItems: "center",
168
163
  backgroundColor: "#2763FF",
169
- borderRadius: (0, px2dp_1.px2dp)(10),
164
+ borderRadius: px2dp(10),
170
165
  },
171
166
  cancelText: {
172
- fontSize: (0, px2sp_1.px2sp)(15),
167
+ fontSize: px2sp(15),
173
168
  color: "#A3A9CC",
174
169
  },
175
170
  confirmText: {
176
- fontSize: (0, px2sp_1.px2sp)(15),
171
+ fontSize: px2sp(15),
177
172
  color: "white",
178
173
  },
179
174
  });
@@ -1,13 +1,9 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.showAlertSheetModal = exports.alertSheetViewRef = void 0;
4
- const tslib_1 = require("tslib");
5
- const React = tslib_1.__importStar(require("react"));
6
- const react_native_1 = require("react-native");
7
- const react_native_modal_1 = tslib_1.__importDefault(require("react-native-modal"));
8
- const px2dp_1 = require("../../../screen/px2dp");
9
- const px2sp_1 = require("../../../screen/px2sp");
10
- exports.default = React.forwardRef((_, ref) => {
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) => {
11
7
  const defaultState = {
12
8
  visible: false,
13
9
  actions: [],
@@ -23,18 +19,18 @@ exports.default = React.forwardRef((_, ref) => {
23
19
  setState(defaultState);
24
20
  };
25
21
  React.useEffect(() => {
26
- if (react_native_1.Platform.OS == "android") {
22
+ if (Platform.OS == "android") {
27
23
  if (state.visible) {
28
- react_native_1.StatusBar.setBackgroundColor("black");
29
- react_native_1.StatusBar.setBarStyle("light-content");
24
+ StatusBar.setBackgroundColor("black");
25
+ StatusBar.setBarStyle("light-content");
30
26
  }
31
27
  else {
32
- react_native_1.StatusBar.setBackgroundColor("transparent");
33
- react_native_1.StatusBar.setBarStyle("dark-content");
28
+ StatusBar.setBackgroundColor("transparent");
29
+ StatusBar.setBarStyle("dark-content");
34
30
  }
35
31
  }
36
32
  }, [state.visible]);
37
- return (<react_native_modal_1.default hideModalContentWhileAnimating={true} //通过隐藏模态内容直到动画完成来增强性能
33
+ return (<Modal hideModalContentWhileAnimating={true} //通过隐藏模态内容直到动画完成来增强性能
38
34
  useNativeDriver={true} //定义动画是否应使用本机驱动程序
39
35
  animationIn="slideInUp" animationOut="slideOutDown" onBackButtonPress={() => {
40
36
  //按下Android后退按钮时调用
@@ -42,35 +38,34 @@ exports.default = React.forwardRef((_, ref) => {
42
38
  }} onBackdropPress={() => {
43
39
  //按下背景时调用
44
40
  hide();
45
- }} isVisible={state.visible} deviceHeight={react_native_1.Dimensions.get("screen").height} style={{ margin: 0 }}>
46
- <react_native_1.View style={styles.container}>
47
- <react_native_1.View style={[styles.wrapper]}>
48
- <react_native_1.View style={styles.itemContainer}>
49
- {state.actions?.map((i, idx) => (<react_native_1.TouchableOpacity key={`sg-action-${idx}`} style={[styles.item]} activeOpacity={1} onPress={() => {
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={() => {
50
46
  hide();
51
47
  i.onClick && i.onClick();
52
48
  }}>
53
- <react_native_1.Text style={[styles.itemText, { color: i.color }]} numberOfLines={2}>
49
+ <Text style={[styles.itemText, { color: i.color }]} numberOfLines={2}>
54
50
  {i.text}
55
- </react_native_1.Text>
56
- </react_native_1.TouchableOpacity>))}
57
- </react_native_1.View>
51
+ </Text>
52
+ </TouchableOpacity>))}
53
+ </View>
58
54
 
59
- <react_native_1.TouchableOpacity style={[styles.cancel]} activeOpacity={1} onPress={() => {
55
+ <TouchableOpacity style={[styles.cancel]} activeOpacity={1} onPress={() => {
60
56
  hide();
61
57
  }}>
62
- <react_native_1.Text style={[styles.cancelText]}>取消</react_native_1.Text>
63
- </react_native_1.TouchableOpacity>
64
- </react_native_1.View>
65
- </react_native_1.View>
66
- </react_native_modal_1.default>);
58
+ <Text style={[styles.cancelText]}>取消</Text>
59
+ </TouchableOpacity>
60
+ </View>
61
+ </View>
62
+ </Modal>);
67
63
  });
68
- exports.alertSheetViewRef = React.createRef();
69
- const showAlertSheetModal = (props) => {
70
- exports.alertSheetViewRef.current?.show(props);
64
+ export const alertSheetViewRef = React.createRef();
65
+ export const showAlertSheetModal = (props) => {
66
+ alertSheetViewRef.current?.show(props);
71
67
  };
72
- exports.showAlertSheetModal = showAlertSheetModal;
73
- const styles = react_native_1.StyleSheet.create({
68
+ const styles = StyleSheet.create({
74
69
  container: {
75
70
  display: "flex",
76
71
  flexGrow: 1,
@@ -83,40 +78,40 @@ const styles = react_native_1.StyleSheet.create({
83
78
  width: "100%",
84
79
  // backgroundColor: 'pink',
85
80
  overflow: "hidden",
86
- borderTopLeftRadius: (0, px2dp_1.px2dp)(10),
87
- borderTopRightRadius: (0, px2dp_1.px2dp)(10),
81
+ borderTopLeftRadius: px2dp(10),
82
+ borderTopRightRadius: px2dp(10),
88
83
  display: "flex",
89
- padding: (0, px2dp_1.px2dp)(15),
84
+ padding: px2dp(15),
90
85
  },
91
86
  cancel: {
92
- height: (0, px2dp_1.px2dp)(50),
87
+ height: px2dp(50),
93
88
  display: "flex",
94
89
  justifyContent: "center",
95
90
  alignItems: "center",
96
- borderRadius: (0, px2dp_1.px2dp)(10),
91
+ borderRadius: px2dp(10),
97
92
  backgroundColor: "white",
98
- marginTop: (0, px2dp_1.px2dp)(15),
93
+ marginTop: px2dp(15),
99
94
  },
100
95
  cancelText: {
101
- fontSize: (0, px2sp_1.px2sp)(15),
96
+ fontSize: px2sp(15),
102
97
  color: "#2763FF",
103
98
  },
104
99
  itemContainer: {
105
100
  display: "flex",
106
- borderRadius: (0, px2dp_1.px2dp)(10),
101
+ borderRadius: px2dp(10),
107
102
  overflow: "hidden",
108
103
  backgroundColor: "#f1f1f1",
109
104
  },
110
105
  item: {
111
- height: (0, px2dp_1.px2dp)(50),
106
+ height: px2dp(50),
112
107
  display: "flex",
113
108
  justifyContent: "center",
114
109
  alignItems: "center",
115
110
  backgroundColor: "white",
116
- marginTop: (0, px2dp_1.px2dp)(0.75),
111
+ marginTop: px2dp(0.75),
117
112
  },
118
113
  itemText: {
119
- fontSize: (0, px2sp_1.px2sp)(12),
114
+ fontSize: px2sp(12),
120
115
  color: "#666666",
121
116
  },
122
117
  });