@aks-dev/easyui 1.0.196 → 1.0.198

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 (86) hide show
  1. package/dist/components/AnimationModal/AnimationModal.js +41 -23
  2. package/dist/components/Badge/Badge.js +16 -7
  3. package/dist/components/DottedLine/DottedLine.js +20 -15
  4. package/dist/components/Echarts/EchartsView.js +77 -40
  5. package/dist/components/Echarts/helper.js +16 -1
  6. package/dist/components/Hud/AlertBottomView/AlertBottomView.js +64 -49
  7. package/dist/components/Hud/AlertSheetView/AlertSheetView.js +34 -30
  8. package/dist/components/Hud/AlertView/AlertView.js +66 -52
  9. package/dist/components/Hud/Hud.js +19 -8
  10. package/dist/components/Hud/Loading/Loading.js +25 -7
  11. package/dist/components/Hud/PopoverView/PopoverView.js +20 -5
  12. package/dist/components/Hud/Scanner/Scanner.js +99 -71
  13. package/dist/components/Hud/Toast/Toast.js +16 -6
  14. package/dist/components/MenuView/MenuView.js +73 -32
  15. package/dist/components/Modal/Modal.js +7 -0
  16. package/dist/components/MutiPictureView/MutiPictureView.js +88 -78
  17. package/dist/components/PictureViewer/PictureViewer.js +32 -11
  18. package/dist/components/RefreshList/RefreshList.js +52 -43
  19. package/dist/components/RichText/RichText.js +23 -23
  20. package/dist/components/StickHeaderView/StickHeaderView.js +12 -2
  21. package/dist/components/TableCell/TableCell.js +53 -37
  22. package/dist/components/TextInputArea/TextInputArea.js +31 -22
  23. package/dist/components/WithLoadingContainer/WithLoadingContainer.js +31 -14
  24. package/dist/index.js +11 -0
  25. package/dist/jsbridge/RNEasyui.js +26 -1
  26. package/dist/jsbridge/UpgradeModule.js +21 -12
  27. package/dist/jsbridge/index.js +7 -0
  28. package/dist/screen/index.js +8 -0
  29. package/dist/screen/px2dp.js +25 -2
  30. package/dist/screen/px2sp.js +35 -5
  31. package/dist/screen/text-fit.js +21 -5
  32. package/dist/utils/index.js +7 -0
  33. package/dist/utils/lazy.js +71 -19
  34. package/dist/utils/mode.js +21 -0
  35. package/package.json +1 -2
  36. package/types/components/AnimationModal/AnimationModal.d.ts +8 -0
  37. package/types/components/AnimationModal/AnimationModal.d.ts.map +1 -1
  38. package/types/components/Echarts/helper.d.ts +5 -0
  39. package/types/components/Echarts/helper.d.ts.map +1 -1
  40. package/types/components/Hud/AlertBottomView/AlertBottomView.d.ts +1 -1
  41. package/types/components/Hud/AlertBottomView/AlertBottomView.d.ts.map +1 -1
  42. package/types/components/Hud/AlertSheetView/AlertSheetView.d.ts +1 -1
  43. package/types/components/Hud/AlertSheetView/AlertSheetView.d.ts.map +1 -1
  44. package/types/components/Hud/AlertView/AlertView.d.ts +1 -1
  45. package/types/components/Hud/AlertView/AlertView.d.ts.map +1 -1
  46. package/types/components/Hud/Loading/Loading.d.ts +3 -3
  47. package/types/components/Hud/Loading/Loading.d.ts.map +1 -1
  48. package/types/components/Hud/PopoverView/PopoverView.d.ts +3 -3
  49. package/types/components/Hud/PopoverView/PopoverView.d.ts.map +1 -1
  50. package/types/components/Hud/Scanner/Scanner.d.ts +3 -3
  51. package/types/components/Hud/Scanner/Scanner.d.ts.map +1 -1
  52. package/types/components/Hud/Toast/Toast.d.ts +2 -2
  53. package/types/components/Hud/Toast/Toast.d.ts.map +1 -1
  54. package/types/components/MutiPictureView/MutiPictureView.d.ts +9 -0
  55. package/types/components/MutiPictureView/MutiPictureView.d.ts.map +1 -1
  56. package/types/components/StickHeaderView/StickHeaderView.d.ts +6 -0
  57. package/types/components/StickHeaderView/StickHeaderView.d.ts.map +1 -1
  58. package/types/components/TextInputArea/TextInputArea.d.ts +1 -0
  59. package/types/components/TextInputArea/TextInputArea.d.ts.map +1 -1
  60. package/types/jsbridge/RNEasyui.d.ts +18 -0
  61. package/types/jsbridge/RNEasyui.d.ts.map +1 -1
  62. package/types/jsbridge/UpgradeModule.d.ts +15 -0
  63. package/types/jsbridge/UpgradeModule.d.ts.map +1 -1
  64. package/types/screen/px2dp.d.ts +11 -0
  65. package/types/screen/px2dp.d.ts.map +1 -1
  66. package/types/screen/text-fit.d.ts +3 -0
  67. package/types/screen/text-fit.d.ts.map +1 -1
  68. package/types/utils/lazy.d.ts +35 -2
  69. package/types/utils/lazy.d.ts.map +1 -1
  70. package/types/utils/mode.d.ts +14 -0
  71. package/types/utils/mode.d.ts.map +1 -1
  72. package/dist/components/Echarts/demo.js +0 -201
  73. package/dist/components/RefreshList/demo.js +0 -9
  74. package/dist/components/RefreshList/demo1.js +0 -27
  75. package/dist/components/RefreshList/demo2.js +0 -9
  76. package/dist/components/StickHeaderView/demo.js +0 -37
  77. package/types/components/Echarts/demo.d.ts +0 -4
  78. package/types/components/Echarts/demo.d.ts.map +0 -1
  79. package/types/components/RefreshList/demo.d.ts +0 -2
  80. package/types/components/RefreshList/demo.d.ts.map +0 -1
  81. package/types/components/RefreshList/demo1.d.ts +0 -2
  82. package/types/components/RefreshList/demo1.d.ts.map +0 -1
  83. package/types/components/RefreshList/demo2.d.ts +0 -2
  84. package/types/components/RefreshList/demo2.d.ts.map +0 -1
  85. package/types/components/StickHeaderView/demo.d.ts +0 -4
  86. package/types/components/StickHeaderView/demo.d.ts.map +0 -1
@@ -4,43 +4,56 @@ import { px2dp } from "../../screen/px2dp";
4
4
  import { px2sp } from "../../screen/px2sp";
5
5
  export default (props) => {
6
6
  const { showNav = false, activeOpacity = 0.8 } = props;
7
- return (React.createElement(TouchableOpacity, { activeOpacity: props.onPress == undefined ? activeOpacity : 1, style: [styles.container, props.style], disabled: props.onPress == undefined, onPress: () => props.onPress && props.onPress() },
8
- React.createElement(View, { style: [
9
- styles.warpper,
10
- props.showUnderline
11
- ? Object.assign({ borderBottomColor: "#f2f2f2", borderBottomWidth: px2dp(1) }, props.underlineStyle) : {},
12
- ] },
13
- props.icon && (React.createElement(Image, { style: [
14
- { width: px2dp(20), height: px2dp(20), marginRight: px2dp(8) },
15
- props.iconStyle,
16
- ], resizeMode: "contain", source: props.icon })),
17
- React.createElement(View, { style: [styles.middle, props.middleContaierStyle] },
18
- (() => {
19
- var _a;
20
- if (typeof props.title === "string" ||
21
- typeof props.title === "number") {
22
- return (React.createElement(Text, Object.assign({ numberOfLines: 1 }, props.titleOptions, { style: [styles.title, (_a = props.titleOptions) === null || _a === void 0 ? void 0 : _a.style] }), props.title));
23
- }
24
- if (React.isValidElement(props.title))
25
- return props.title;
26
- return React.createElement(View, { style: styles.title });
27
- })(),
28
- (() => {
29
- var _a;
30
- if (typeof props.content === "string" ||
31
- typeof props.content === "number") {
32
- return (React.createElement(Text, Object.assign({ numberOfLines: 1 }, props.contentOptions, { style: [styles.content, (_a = props.contentOptions) === null || _a === void 0 ? void 0 : _a.style] }), props.content));
33
- }
34
- if (React.isValidElement(props.content))
35
- return props.content;
36
- return undefined;
37
- })()),
38
- showNav &&
39
- (props.nav || (React.createElement(Image, { style: {
40
- width: px2dp(9),
41
- height: px2dp(16),
42
- marginLeft: px2dp(8),
43
- }, source: require("./assets/back.png") }))))));
7
+ return (<TouchableOpacity activeOpacity={props.onPress == undefined ? activeOpacity : 1} style={[styles.container, props.style]} disabled={props.onPress == undefined} onPress={() => props.onPress && props.onPress()}>
8
+ <View style={[
9
+ styles.warpper,
10
+ props.showUnderline
11
+ ? {
12
+ borderBottomColor: "#f2f2f2",
13
+ // borderBottomWidth: StyleSheet.hairlineWidth,
14
+ borderBottomWidth: px2dp(1),
15
+ ...props.underlineStyle,
16
+ }
17
+ : {},
18
+ ]}>
19
+ {props.icon && (<Image style={[
20
+ { width: px2dp(20), height: px2dp(20), marginRight: px2dp(8) },
21
+ props.iconStyle,
22
+ ]} resizeMode="contain" source={props.icon}/>)}
23
+ <View style={[styles.middle, props.middleContaierStyle]}>
24
+ {/* 标题 */}
25
+ {(() => {
26
+ if (typeof props.title === "string" ||
27
+ typeof props.title === "number") {
28
+ return (<Text numberOfLines={1} {...props.titleOptions} style={[styles.title, props.titleOptions?.style]}>
29
+ {props.title}
30
+ </Text>);
31
+ }
32
+ if (React.isValidElement(props.title))
33
+ return props.title;
34
+ return <View style={styles.title}/>;
35
+ })()}
36
+
37
+ {(() => {
38
+ if (typeof props.content === "string" ||
39
+ typeof props.content === "number") {
40
+ return (<Text numberOfLines={1} {...props.contentOptions} style={[styles.content, props.contentOptions?.style]}>
41
+ {props.content}
42
+ </Text>);
43
+ }
44
+ if (React.isValidElement(props.content))
45
+ return props.content;
46
+ return undefined;
47
+ })()}
48
+ </View>
49
+ {showNav &&
50
+ (props.nav || (<Image style={{
51
+ width: px2dp(9),
52
+ height: px2dp(16),
53
+ marginLeft: px2dp(8),
54
+ }} source={require("./assets/back.png")}/>))}
55
+ </View>
56
+ </TouchableOpacity>);
44
57
  };
45
58
  const styles = StyleSheet.create({
46
59
  container: {
@@ -64,14 +77,17 @@ const styles = StyleSheet.create({
64
77
  flexDirection: "row",
65
78
  alignItems: "center",
66
79
  justifyContent: "space-between",
80
+ // backgroundColor: 'cyan'
67
81
  },
68
82
  title: {
83
+ // backgroundColor: 'red',
69
84
  flexGrow: 0,
70
85
  flexShrink: 0,
71
86
  fontSize: px2sp(14),
72
87
  color: "#333333",
73
88
  },
74
89
  content: {
90
+ // backgroundColor: 'yellow',
75
91
  flexGrow: 1,
76
92
  flexShrink: 1,
77
93
  fontSize: px2sp(14),
@@ -1,20 +1,16 @@
1
- var __rest = (this && this.__rest) || function (s, e) {
2
- var t = {};
3
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
4
- t[p] = s[p];
5
- if (s != null && typeof Object.getOwnPropertySymbols === "function")
6
- for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
7
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
8
- t[p[i]] = s[p[i]];
9
- }
10
- return t;
11
- };
1
+ /*
2
+ * @Author: shiguo
3
+ * @Date: 2022-04-24 13:56:47
4
+ * @LastEditors: shiguo
5
+ * @LastEditTime: 2022-09-09 10:59:38
6
+ * @FilePath: /@aks-dev/easyui/lib/TextInputArea/TextInputArea.tsx
7
+ */
12
8
  import React from "react";
13
9
  import { View, Text, TextInput, StyleSheet, } from "react-native";
14
10
  import { px2dp } from "../../screen/px2dp";
15
11
  import { px2sp } from "../../screen/px2sp";
16
12
  export default React.forwardRef((props, ref) => {
17
- const { defaultValue, placeholder, maxLength = 200, on } = props, rest = __rest(props, ["defaultValue", "placeholder", "maxLength", "on"]);
13
+ const { defaultValue, placeholder, maxLength = 200, on, ...rest } = props;
18
14
  const [value, setValue] = React.useState(defaultValue);
19
15
  React.useLayoutEffect(() => {
20
16
  setValue(defaultValue);
@@ -22,20 +18,30 @@ export default React.forwardRef((props, ref) => {
22
18
  React.useImperativeHandle(ref, () => ({
23
19
  value: value,
24
20
  }), [value]);
25
- return (React.createElement(View, { style: [styles.container, rest.style] },
26
- React.createElement(TextInput, Object.assign({}, rest, { style: [styles.textInput, rest.textInputStyle], value: value, onChangeText: (txt) => {
27
- setValue(txt);
28
- on && on(txt);
29
- }, multiline: true, textAlignVertical: "top", maxLength: maxLength, placeholder: placeholder })),
30
- React.createElement(View, { style: styles.corner },
31
- React.createElement(Text, { style: styles.limit },
32
- React.createElement(Text, { style: Object.assign(Object.assign({}, styles.limit), { color: value && (value === null || value === void 0 ? void 0 : value.length) > maxLength - 5 ? "red" : "#AFAFAF" }) }, (value === null || value === void 0 ? void 0 : value.length) || 0),
33
- "/",
34
- maxLength))));
21
+ return (<View style={[styles.container, rest.style]}>
22
+ <TextInput {...rest} style={[styles.textInput, rest.textInputStyle]} value={value} onChangeText={(txt) => {
23
+ setValue(txt);
24
+ on && on(txt);
25
+ }} multiline={true} textAlignVertical={"top"} maxLength={maxLength} placeholder={placeholder}/>
26
+
27
+ <View style={styles.corner}>
28
+ <Text style={styles.limit}>
29
+ <Text style={{
30
+ ...styles.limit,
31
+ color: value && value?.length > maxLength - 5 ? "red" : "#AFAFAF",
32
+ }}>
33
+ {value?.length || 0}
34
+ </Text>
35
+ /{maxLength}
36
+ </Text>
37
+ </View>
38
+ </View>);
35
39
  });
36
40
  const styles = StyleSheet.create({
37
41
  container: {
42
+ // backgroundColor: '#F5F5F5',
38
43
  minHeight: px2dp(200),
44
+ // borderRadius: px2dp(10),
39
45
  backgroundColor: "white",
40
46
  },
41
47
  textInput: {
@@ -43,8 +49,11 @@ const styles = StyleSheet.create({
43
49
  margin: px2dp(15),
44
50
  marginBottom: px2dp(8),
45
51
  fontSize: px2sp(14),
52
+ // backgroundColor: 'red'
46
53
  },
47
54
  corner: {
55
+ // position: 'absolute',
56
+ // backgroundColor:'cyan',
48
57
  marginHorizontal: px2dp(15),
49
58
  marginBottom: px2dp(8),
50
59
  },
@@ -1,3 +1,10 @@
1
+ /*
2
+ * @Author: shiguo
3
+ * @Date: 2022-04-20 14:56:47
4
+ * @LastEditors: shiguo
5
+ * @LastEditTime: 2022-05-09 14:35:04
6
+ * @FilePath: /@aks/easyui/lib/WithLoadingContainer/WithLoadingContainer.tsx
7
+ */
1
8
  import React from "react";
2
9
  import { View, Image, Text, StyleSheet, TouchableOpacity, } from "react-native";
3
10
  const loading = require("./assets/loading.gif");
@@ -13,42 +20,52 @@ export var Status;
13
20
  })(Status || (Status = {}));
14
21
  export default (props) => {
15
22
  const { status = Status.NONE, renderFailComponent, renderEmptyComponent, renderNomoreComponent, reload, failText = "网络请求失败,点击重新加载~", emptyText = "暂无数据", nomoreText = "没有更多数据了~", } = props;
16
- return (React.createElement(View, { style: props.style },
17
- React.createElement(React.Fragment, null, (() => {
23
+ return (<View style={props.style}>
24
+ <>
25
+ {(() => {
18
26
  switch (status) {
19
27
  case Status.NONE:
20
28
  return undefined;
21
29
  case Status.SUCCESS:
22
30
  return props.children;
23
31
  case Status.LOADING:
24
- return React.createElement(Loading, null);
32
+ return <Loading />;
25
33
  case Status.FAIL:
26
34
  if (renderFailComponent)
27
35
  return renderFailComponent();
28
- return (React.createElement(TouchableOpacity, { disabled: !reload, onPress: reload, style: styles.container },
29
- React.createElement(Text, { style: styles.text }, failText)));
36
+ return (<TouchableOpacity disabled={!reload} onPress={reload} style={styles.container}>
37
+ <Text style={styles.text}>{failText}</Text>
38
+ </TouchableOpacity>);
30
39
  case Status.EMPTY:
31
40
  if (renderEmptyComponent)
32
41
  return renderEmptyComponent();
33
- return (React.createElement(TouchableOpacity, { disabled: !reload, onPress: reload, style: styles.container },
34
- React.createElement(Text, { style: styles.text }, emptyText)));
42
+ return (<TouchableOpacity disabled={!reload} onPress={reload} style={styles.container}>
43
+ <Text style={styles.text}>{emptyText}</Text>
44
+ </TouchableOpacity>);
35
45
  case Status.NOMORE:
36
- return (React.createElement(React.Fragment, null,
37
- props.children,
38
- renderNomoreComponent ? (renderNomoreComponent()) : (React.createElement(Text, { style: styles.text }, nomoreText))));
46
+ return (<>
47
+ {props.children}
48
+ {renderNomoreComponent ? (renderNomoreComponent()) : (<Text style={styles.text}>{nomoreText}</Text>)}
49
+ </>);
39
50
  default:
40
- return (React.createElement(Text, { style: [styles.text, { lineHeight: 44 }] }, "(^_^)\u2220\u203B \u9001\u4F60\u4E00\u675F\u5C0F\u82B1"));
51
+ return (<Text style={[styles.text, { lineHeight: 44 }]}>
52
+ (^_^)∠※ 送你一束小花
53
+ </Text>);
41
54
  }
42
- })())));
55
+ })()}
56
+ </>
57
+ </View>);
43
58
  };
44
59
  const Loading = () => {
45
- return (React.createElement(View, { style: styles.container },
46
- React.createElement(Image, { source: loading3, style: { width: 20, height: 20 }, resizeMode: "contain" })));
60
+ return (<View style={styles.container}>
61
+ <Image source={loading3} style={{ width: 20, height: 20 }} resizeMode="contain"/>
62
+ </View>);
47
63
  };
48
64
  const styles = StyleSheet.create({
49
65
  text: {
50
66
  color: "#999999",
51
67
  fontSize: 14,
68
+ // textAlign: 'center',
52
69
  },
53
70
  container: {
54
71
  display: "flex",
package/dist/index.js CHANGED
@@ -1,3 +1,11 @@
1
+ /*
2
+ * @Author: shiguo
3
+ * @Date: 2022-04-13 12:47:34
4
+ * @LastEditors: shiguo
5
+ * @LastEditTime: 2023-03-23 15:26:14
6
+ * @FilePath: /@aks-dev/easyui/src/index.ts
7
+ */
8
+ /// 组件
1
9
  export * from "./components/Badge/Badge";
2
10
  export { Hud, showLoading, hideLoading, showToast, showAlertModal, showAlertBottomModal, showAlertSheetModal, showPopoverView, hidePopoverView, showScanner, hideScanner, } from "./components/Hud/Hud";
3
11
  export * from "./components/Modal/Modal";
@@ -13,7 +21,10 @@ export { default as RichText } from "./components/RichText/RichText";
13
21
  export { default as DottedLine } from "./components/DottedLine/DottedLine";
14
22
  export { default as MenuView } from "./components/MenuView/MenuView";
15
23
  export { AnimationModal } from "./components/AnimationModal/AnimationModal";
24
+ /// 全局适配
16
25
  export * from "./screen";
26
+ /// 工具
17
27
  import * as utils from "./utils";
28
+ ///  桥接
18
29
  import * as jsbridge from "./jsbridge";
19
30
  export { utils, jsbridge };
@@ -1,6 +1,22 @@
1
+ /*
2
+ * @Author: shiguo
3
+ * @Date: 2022-04-19 10:23:01
4
+ * @LastEditors: shiguo
5
+ * @LastEditTime: 2023-03-10 14:05:17
6
+ * @FilePath: /@aks-dev/easyui/jsbridge/RNEasyui.ts
7
+ */
1
8
  import { Dimensions, NativeModules, Platform } from "react-native";
2
9
  const { RNEasyui } = NativeModules;
10
+ /**
11
+ * @description: 获取设备品牌
12
+ * @return {*}
13
+ */
3
14
  export const getDeviceBrand = () => RNEasyui.getDeviceBrand();
15
+ /**
16
+ * @deprecated 测量不准确,已放弃
17
+ * @description: 获取status_bar_height
18
+ * @return {*}
19
+ */
4
20
  export const getStatusBarHeight = () => {
5
21
  if (Platform.OS == "android")
6
22
  return RNEasyui.getStatusBarHeight();
@@ -10,12 +26,21 @@ export const getStatusBarHeight = () => {
10
26
  return Promise.resolve(44);
11
27
  return Promise.resolve(20);
12
28
  };
29
+ /**
30
+ * @deprecated 测量不准确,已放弃
31
+ * @description: 获取navigation_bar_height
32
+ * @return {*}
33
+ */
13
34
  export const getNavigationBarHeight = () => {
14
35
  if (Platform.OS == "android")
15
36
  return RNEasyui.getNavigationBarHeight();
16
37
  return Promise.resolve(44);
17
38
  };
39
+ /**
40
+ * only android
41
+ * 返回桌面
42
+ */
18
43
  export const gotoDesktop = () => {
19
44
  if (Platform.OS == "android")
20
- RNEasyui === null || RNEasyui === void 0 ? void 0 : RNEasyui.gotoDesktop();
45
+ RNEasyui?.gotoDesktop();
21
46
  };
@@ -1,21 +1,30 @@
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
- };
1
+ /*
2
+ * @Author: shiguo
3
+ * @Date: 2022-05-05 14:19:39
4
+ * @LastEditors: shiguo
5
+ * @LastEditTime: 2023-03-23 15:15:06
6
+ * @FilePath: /@aks-dev/easyui/jsbridge/UpgradeModule.ts
7
+ */
10
8
  import { NativeModules, PermissionsAndroid, Platform } from "react-native";
11
9
  const { UpgradeModule } = NativeModules;
10
+ /**
11
+ * @description: 获取App版本号
12
+ * @param {*}
13
+ * @return {*}
14
+ */
12
15
  export const getAppVersion = () => UpgradeModule.getAppVersion();
16
+ /**
17
+ * @description: 获取操作系统版本
18
+ *
19
+ react-native-device-info
20
+ * @return {*}
21
+ */
13
22
  export const getOSVersion = () => UpgradeModule.getOSVersion();
14
- export const upgrade = (options) => __awaiter(void 0, void 0, void 0, function* () {
23
+ export const upgrade = async (options) => {
15
24
  const { title = "提示" } = options;
16
25
  if (Platform.OS == "android") {
17
26
  try {
18
- const granted = yield PermissionsAndroid.request(PermissionsAndroid.PERMISSIONS.WRITE_EXTERNAL_STORAGE, {
27
+ const granted = await PermissionsAndroid.request(PermissionsAndroid.PERMISSIONS.WRITE_EXTERNAL_STORAGE, {
19
28
  title: "提示",
20
29
  message: "应用升级需要获取APP的写入权限",
21
30
  buttonNeutral: "稍后再询问",
@@ -32,4 +41,4 @@ export const upgrade = (options) => __awaiter(void 0, void 0, void 0, function*
32
41
  }
33
42
  }
34
43
  return UpgradeModule.upgrade(options);
35
- });
44
+ };
@@ -1,2 +1,9 @@
1
+ /*
2
+ * @Author: shiguo
3
+ * @Date: 2022-04-19 10:23:01
4
+ * @LastEditors: shiguo
5
+ * @LastEditTime: 2023-03-23 15:14:55
6
+ * @FilePath: /@aks-dev/easyui/jsbridge/index.ts
7
+ */
1
8
  export * from './RNEasyui';
2
9
  export * from './UpgradeModule';
@@ -1,2 +1,10 @@
1
+ /*
2
+ * @Author: shiguo
3
+ * @Date: 2022-04-19 10:25:14
4
+ * @LastEditors: shiguo
5
+ * @LastEditTime: 2023-03-23 15:09:24
6
+ * @FilePath: /@aks-dev/easyui/screen/index.ts
7
+ */
8
+ /// 全局适配
1
9
  export * from '../screen/px2dp';
2
10
  export * from '../screen/px2sp';
@@ -1,13 +1,31 @@
1
+ /*
2
+ * @Author: shiguo
3
+ * @Date: 2022-04-18 14:32:25
4
+ * @LastEditors: shiguo
5
+ * @LastEditTime: 2022-09-09 10:35:02
6
+ * @FilePath: /@aks-dev/easyui/screen/px2dp.ts
7
+ */
1
8
  import { Dimensions, Platform, StatusBar } from "react-native";
2
- export const deviceWidth = Dimensions.get("screen").width;
3
- export const deviceHeight = Dimensions.get("screen").height;
9
+ /**设备宽度,单位 dp */
10
+ export const deviceWidth = Dimensions.get("screen").width; //设备的宽度
11
+ export const deviceHeight = Dimensions.get("screen").height; //设备的高度
4
12
  export const isAndroid = Platform.OS === "android";
5
13
  export const isIos = Platform.OS === "ios";
6
14
  export const isiPhoneX = isIos && deviceHeight > 736;
15
+ /**
16
+ * 375px/667px
17
+ * */
7
18
  const uiWidthPx = 375;
19
+ // const pixelRatio = PixelRatio.get()
20
+ // const deviceWidthPx = PixelRatio.getPixelSizeForLayoutSize(deviceWidth);
8
21
  export const px2dp = (uiElePx) => {
9
22
  return Math.round((uiElePx * deviceWidth) / uiWidthPx);
10
23
  };
24
+ /**
25
+ * @description: 状态栏的高度
26
+ * @param {*}
27
+ * @return {*}
28
+ */
11
29
  export const statusBarHeight = (() => {
12
30
  if (isAndroid)
13
31
  return StatusBar.currentHeight || 24;
@@ -15,6 +33,11 @@ export const statusBarHeight = (() => {
15
33
  return 44;
16
34
  return 20;
17
35
  })();
36
+ /**
37
+ * @description: 顶部导航条的高度,高度不包含statusBarHeight
38
+ * @param {*}
39
+ * @return {*}
40
+ */
18
41
  export const navigationBarHeight = (() => {
19
42
  if (isAndroid)
20
43
  return 56;
@@ -1,43 +1,73 @@
1
+ /*
2
+ * @Author: shiguo
3
+ * @Date: 2021-04-27 10:40:36
4
+ * @LastEditors: shiguo
5
+ * @LastEditTime: 2022-10-28 17:14:14
6
+ * @FilePath: /@aks-dev/easyui/screen/px2sp.ts
7
+ */
1
8
  import { Dimensions, PixelRatio } from 'react-native';
2
9
  const pixelRatio = PixelRatio.get();
3
- const width = Dimensions.get('window').width;
4
- const height = Dimensions.get('window').height;
10
+ const width = Dimensions.get('window').width; //设备的宽度
11
+ const height = Dimensions.get('window').height; //设备的高度
5
12
  export const px2sp = (size) => {
13
+ // console.log({
14
+ // pixelRatio,
15
+ // width,
16
+ // height
17
+ // })
6
18
  if (pixelRatio === 2) {
19
+ // iphone 5s and older Androids
7
20
  if (width < 360) {
8
21
  return size * 0.95;
9
22
  }
23
+ // iphone 5
10
24
  if (height < 667) {
11
25
  return size;
26
+ // iphone 6-6s
12
27
  }
13
28
  else if (height >= 667 && height <= 735) {
14
29
  return size * 1.15;
15
30
  }
31
+ // older phablets
16
32
  return size * 1.25;
17
33
  }
18
34
  if (pixelRatio === 3) {
35
+ // catch Android font scaling on small machines
36
+ // where pixel ratio / font scale ratio => 3:3
19
37
  if (width <= 360) {
20
38
  return size;
21
39
  }
40
+ // Catch other weird android width sizings
22
41
  if (height < 667) {
23
42
  return size * 1.15;
43
+ // catch in-between size Androids and scale font up
44
+ // a tad but not too much
24
45
  }
25
46
  if (height >= 667 && height <= 735) {
26
47
  return size * 1.2;
27
48
  }
49
+ // catch larger devices
50
+ // ie iphone 6s plus / 7 plus / mi note 等等
28
51
  return size * 1.27;
29
52
  }
30
53
  if (pixelRatio === 3.5) {
54
+ // catch Android font scaling on small machines
55
+ // where pixel ratio / font scale ratio => 3:3
31
56
  if (width <= 360) {
32
57
  return size;
58
+ // Catch other smaller android height sizings
33
59
  }
34
60
  if (height < 667) {
35
- return size * 1.15;
61
+ return size * 1.15; //older:1.20
62
+ // catch in-between size Androids and scale font up
63
+ // a tad but not too much
36
64
  }
37
65
  if (height >= 667 && height <= 735) {
38
- return size * 1.20;
66
+ return size * 1.20; //older:1.25
39
67
  }
40
- return size * 1.25;
68
+ // catch larger phablet devices
69
+ return size * 1.25; //older:1.30
41
70
  }
71
+ // if older device ie pixelRatio !== 2 || 3 || 3.5
42
72
  return size;
43
73
  };
@@ -1,10 +1,25 @@
1
+ /*
2
+ * @Author: shiguo
3
+ * @Date: 2022-04-15 14:15:07
4
+ * @LastEditors: shiguo
5
+ * @LastEditTime: 2022-06-02 11:03:59
6
+ * @FilePath: /@aks-dev/easyui/screen/text-fit.tsx
7
+ */
8
+ /**
9
+ * 全局配置Text
10
+ */
1
11
  import React from 'react';
2
12
  import { Platform, Text as Text_spaceName, TextInput as TextInput_spaceName } from 'react-native';
3
13
  const Text = Text_spaceName;
4
14
  const TextInput = TextInput_spaceName;
5
- const textDefaultStyle = Object.assign(Object.assign({}, Platform.select({
6
- android: { fontFamily: 'DroidSansFallback' }
7
- })), { allowFontScaling: false, paddingVertical: 0, paddingHorizontal: 0 });
15
+ const textDefaultStyle = {
16
+ ...Platform.select({
17
+ android: { fontFamily: 'DroidSansFallback' }
18
+ }),
19
+ allowFontScaling: false,
20
+ paddingVertical: 0,
21
+ paddingHorizontal: 0,
22
+ };
8
23
  const textRender = Text.render;
9
24
  Text.render = function (...args) {
10
25
  const origin = textRender.call(this, ...args);
@@ -16,8 +31,8 @@ const textInputDefaultStyle = {
16
31
  defaultProps: false,
17
32
  paddingVertical: 0,
18
33
  paddingHorizontal: 0,
19
- autoCapitalize: "none",
20
- autoCorrect: false,
34
+ autoCapitalize: "none", //不自动大写
35
+ autoCorrect: false, //不自动纠正拼写
21
36
  };
22
37
  const textInputRender = TextInput.render;
23
38
  TextInput.render = function (...args) {
@@ -26,6 +41,7 @@ TextInput.render = function (...args) {
26
41
  style: [textInputDefaultStyle, origin.props.style]
27
42
  });
28
43
  };
44
+ /**关闭字体缩放 */
29
45
  if (!Text.defaultProps)
30
46
  Text.defaultProps = {};
31
47
  if (!TextInput.defaultProps)
@@ -1,2 +1,9 @@
1
+ /*
2
+ * @Author: shiguo
3
+ * @Date: 2022-04-19 10:25:43
4
+ * @LastEditors: shiguo
5
+ * @LastEditTime: 2023-03-23 15:08:21
6
+ * @FilePath: /@aks-dev/easyui/utils/index.ts
7
+ */
1
8
  export * from '../utils/mode';
2
9
  export * from '../utils/lazy';