@aks-dev/easyui 1.0.10

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.
Files changed (66) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +35 -0
  3. package/android/build.gradle +44 -0
  4. package/android/src/main/AndroidManifest.xml +20 -0
  5. package/android/src/main/java/com/easyui/RNEasyuiModule.java +29 -0
  6. package/android/src/main/java/com/easyui/RNEasyuiPackage.java +38 -0
  7. package/android/src/main/java/com/easyui/UpgradeModule.java +54 -0
  8. package/ios/RNEasyui.h +18 -0
  9. package/ios/RNEasyui.m +13 -0
  10. package/ios/RNEasyui.podspec +24 -0
  11. package/ios/RNEasyui.xcodeproj/project.pbxproj +259 -0
  12. package/ios/RNEasyui.xcworkspace/contents.xcworkspacedata +9 -0
  13. package/ios/UpgradeModule.h +12 -0
  14. package/ios/UpgradeModule.m +38 -0
  15. package/jsbridge/RNEasyui.tsx +13 -0
  16. package/jsbridge/UpgradeModule.tsx +13 -0
  17. package/jsbridge/index.ts +13 -0
  18. package/lib/Badge/Badge.tsx +39 -0
  19. package/lib/Badge/index.ts +21 -0
  20. package/lib/Easy-Hud/AlertView/AlertView.tsx +233 -0
  21. package/lib/Easy-Hud/AlertView/index.ts +41 -0
  22. package/lib/Easy-Hud/EasyHud.tsx +48 -0
  23. package/lib/Easy-Hud/Loading/Loading.tsx +80 -0
  24. package/lib/Easy-Hud/Loading/index.ts +35 -0
  25. package/lib/Easy-Hud/Toast/Toast.tsx +86 -0
  26. package/lib/Easy-Hud/Toast/index.ts +22 -0
  27. package/lib/Easy-Hud/index.ts +18 -0
  28. package/lib/Echarts/EchartsView.tsx +151 -0
  29. package/lib/Echarts/demo.tsx +235 -0
  30. package/lib/Echarts/helper.tsx +63 -0
  31. package/lib/Echarts/index.ts +29 -0
  32. package/lib/Modal/Modal.tsx +12 -0
  33. package/lib/Modal/index.ts +10 -0
  34. package/lib/MutiPictureView/MutiPictureView.tsx +213 -0
  35. package/lib/MutiPictureView/icon_add_image.png +0 -0
  36. package/lib/MutiPictureView/icon_del_image.png +0 -0
  37. package/lib/MutiPictureView/index.ts +55 -0
  38. package/lib/PictureViewer/PictureViewer.tsx +80 -0
  39. package/lib/PictureViewer/index.ts +26 -0
  40. package/lib/RefreshList/RefreshList.tsx +222 -0
  41. package/lib/RefreshList/demo.tsx +30 -0
  42. package/lib/RefreshList/demo1.tsx +60 -0
  43. package/lib/RefreshList/demo2.tsx +46 -0
  44. package/lib/RefreshList/index.ts +84 -0
  45. package/lib/StickHeaderView/StickHeaderView.tsx +65 -0
  46. package/lib/StickHeaderView/demo.tsx +104 -0
  47. package/lib/StickHeaderView/index.ts +26 -0
  48. package/lib/TableCell/TableCell.tsx +117 -0
  49. package/lib/TableCell/back.png +0 -0
  50. package/lib/TableCell/index.ts +45 -0
  51. package/lib/TextInputArea/TextInputArea.tsx +88 -0
  52. package/lib/TextInputArea/index.ts +32 -0
  53. package/lib/WithLoadingContainer/WithLoadingContainer.tsx +93 -0
  54. package/lib/WithLoadingContainer/index.ts +36 -0
  55. package/lib/WithLoadingContainer/loading.gif +0 -0
  56. package/lib/WithLoadingContainer/loading3.gif +0 -0
  57. package/package.json +59 -0
  58. package/screen/index.ts +16 -0
  59. package/screen/px2dp.tsx +44 -0
  60. package/screen/px2sp.tsx +65 -0
  61. package/screen/text-set.tsx +58 -0
  62. package/src/index.d.ts +58 -0
  63. package/src/index.ts +66 -0
  64. package/utils/index.ts +56 -0
  65. package/utils/lazy.tsx +40 -0
  66. package/utils/mode.tsx +48 -0
@@ -0,0 +1,93 @@
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
+ */
8
+ import React from 'react';
9
+ import { View, Image, Text, StyleSheet, TouchableOpacity } from 'react-native'
10
+ const loading = require('./loading.gif')
11
+ const loading3 = require('./loading3.gif')
12
+ import { WithLoadingContainerProps, Status } from '.'
13
+
14
+
15
+
16
+ export default (props: Partial<WithLoadingContainerProps>) => {
17
+ const {
18
+ status = Status.NONE,
19
+ renderFailComponent,
20
+ renderEmptyComponent,
21
+ renderNomoreComponent,
22
+ reload,
23
+ failText = '网络请求失败,点击重新加载~',
24
+ emptyText = '暂无数据',
25
+ nomoreText = '没有更多数据了~',
26
+ } = props
27
+
28
+
29
+
30
+ return (
31
+ <View style={props.style}>
32
+ <>
33
+ {(() => {
34
+
35
+ switch (status) {
36
+ case Status.NONE: return undefined;
37
+ case Status.SUCCESS: return props.children;
38
+ case Status.LOADING: return <Loading />;
39
+ case Status.FAIL:
40
+ if (renderFailComponent) return renderFailComponent();
41
+ return (
42
+ <TouchableOpacity disabled={!reload} onPress={reload} style={styles.container}>
43
+ <Text style={styles.text}>{failText}</Text>
44
+ </TouchableOpacity>
45
+ );
46
+ case Status.EMPTY:
47
+ if (renderEmptyComponent) return renderEmptyComponent();
48
+ return (
49
+ <TouchableOpacity disabled={!reload} onPress={reload} style={styles.container}>
50
+ <Text style={styles.text}>{emptyText}</Text>
51
+ </TouchableOpacity>
52
+ );
53
+ case Status.NOMORE:
54
+ return (
55
+ <>
56
+ {props.children}
57
+ {renderNomoreComponent ? renderNomoreComponent() : <Text style={styles.text}>{nomoreText}</Text>}
58
+ </>
59
+ );
60
+ default: return <Text style={[styles.text, { lineHeight: 44, }]}>(^_^)∠※ 送你一束小花</Text>;
61
+
62
+ }
63
+ })()}
64
+ </>
65
+ </View>
66
+ )
67
+ }
68
+
69
+
70
+
71
+ const Loading = () => {
72
+ return (
73
+ <View style={styles.container}>
74
+ <Image source={loading3} style={{ width: 20, height: 20 }} resizeMode='contain' />
75
+ </View>
76
+ )
77
+ }
78
+
79
+
80
+ const styles = StyleSheet.create({
81
+ text: {
82
+ color: '#999999',
83
+ fontSize: 14,
84
+ // textAlign: 'center',
85
+ },
86
+ container: {
87
+ display: 'flex',
88
+ minHeight: 44,
89
+ justifyContent: 'center',
90
+ alignItems: 'center',
91
+ paddingHorizontal:15
92
+ }
93
+ })
@@ -0,0 +1,36 @@
1
+ /*
2
+ * @Author: shiguo
3
+ * @Date: 2022-04-20 15:33:30
4
+ * @LastEditors: shiguo
5
+ * @LastEditTime: 2022-04-29 10:54:37
6
+ * @FilePath: /@aks/easyui/lib/WithLoadingContainer/index.ts
7
+ */
8
+
9
+
10
+
11
+ import React from 'react'
12
+ import { ViewProps, GestureResponderEvent } from 'react-native'
13
+
14
+
15
+ export enum Status {
16
+ NONE = 'NONE',
17
+ LOADING = 'LOADING',
18
+ FAIL = 'FAIL',
19
+ SUCCESS = 'SUCCESS',
20
+ EMPTY = 'EMPTY',
21
+ NOMORE = 'NOMORE',
22
+ }
23
+
24
+ export type WithLoadingContainerProps = {
25
+ status: Status;
26
+ reload: (event: GestureResponderEvent) => void;
27
+ failText: string;
28
+ emptyText: string;
29
+ nomoreText: string;
30
+ renderEmptyComponent: () => React.ReactNode;
31
+ renderFailComponent: () => React.ReactNode;
32
+ renderNomoreComponent: () => React.ReactNode;
33
+ } & ViewProps
34
+
35
+
36
+ export declare const WithLoadingContainer: React.FC<Partial<WithLoadingContainerProps>>
package/package.json ADDED
@@ -0,0 +1,59 @@
1
+ {
2
+ "name": "@aks-dev/easyui",
3
+ "version": "1.0.10",
4
+ "description": "React Native Tools for iOS & Android",
5
+ "main": "./src/index.ts",
6
+ "typings": "./src/index.d.ts",
7
+ "scripts": {
8
+ "test": "echo \"Error: no test specified\" && exit 1"
9
+ },
10
+ "keywords": [
11
+ "react",
12
+ "react-native",
13
+ "@aks/easyui"
14
+ ],
15
+ "files": [
16
+ "/android",
17
+ "!/android/build",
18
+ "/ios",
19
+ "/*.podspec",
20
+ "/src",
21
+ "/lib",
22
+ "/screen",
23
+ "/jsbridge",
24
+ "/utils",
25
+ "/**/*.png",
26
+ "!/tsconfig.json",
27
+ "!/tsconfig.md"
28
+ ],
29
+ "homepage": "git+https://gitee.com/the_period_of_the_ten_kingdoms/aks-easy",
30
+ "repository": {
31
+ "type": "git",
32
+ "url": "git+https://gitee.com/the_period_of_the_ten_kingdoms/aks-easy.git"
33
+ },
34
+ "author": "",
35
+ "license": "MIT",
36
+ "peerDependencies": {
37
+ "@shiguo2022/react-native-syan-image-picker": "*",
38
+ "react": "*",
39
+ "react-native": "*",
40
+ "react-native-webview": "*"
41
+ },
42
+ "dependencies": {
43
+ "echarts": "^5.3.2",
44
+ "react-native-image-zoom-viewer": "^3.0.1",
45
+ "react-native-modal": "^13.0.1",
46
+ "react-native-swipe-list-view": "^3.2.9"
47
+ },
48
+ "devDependencies": {
49
+ "@shiguo2022/react-native-syan-image-picker": "^0.5.5",
50
+ "@types/react": "^17.0.39",
51
+ "@types/react-native": "^0.67.4",
52
+ "react-native-webview": "^11.18.2",
53
+ "tslib": "^2.4.0",
54
+ "typescript": "^4.6.3"
55
+ },
56
+ "resolutions": {
57
+ "@types/react": "*"
58
+ }
59
+ }
@@ -0,0 +1,16 @@
1
+ /*
2
+ * @Author: shiguo
3
+ * @Date: 2022-04-19 10:25:14
4
+ * @LastEditors: shiguo
5
+ * @LastEditTime: 2022-04-26 11:53:21
6
+ * @FilePath: /@aks/easy/screen/index.ts
7
+ */
8
+ export declare const deviceWidth: number; //设备的宽度
9
+ export declare const deviceHeight: number; //设备的高度
10
+ export declare const isAndroid: boolean;
11
+ export declare const isIos: boolean;
12
+ export declare const px2dp: (uiElePx: number) => number;
13
+ export declare const px2sp: (fontSize: number) => number;
14
+ export declare const isiPhoneX: boolean;
15
+ export declare const statusBarHeight: number;
16
+ export declare const navigationBarHeight: number;
@@ -0,0 +1,44 @@
1
+ import { Dimensions, StatusBar, Platform } from 'react-native';
2
+
3
+
4
+ // 设备宽度,单位 dp
5
+ export const deviceWidth = Dimensions.get('window').width; //设备的宽度
6
+ export const deviceHeight = Dimensions.get('window').height; //设备的高度
7
+ export const isAndroid = Platform.OS === "android"
8
+ export const isIos = Platform.OS === 'ios'
9
+
10
+ /**
11
+ * 375px/667px
12
+ * */
13
+ const uiWidthPx = 375;
14
+
15
+
16
+
17
+ // const pixelRatio = PixelRatio.get()
18
+ // const deviceWidthPx = PixelRatio.getPixelSizeForLayoutSize(deviceWidth);
19
+
20
+
21
+
22
+ export const px2dp = (uiElePx: number) => {
23
+ return Math.round(uiElePx * deviceWidth / uiWidthPx);
24
+ }
25
+
26
+
27
+
28
+ export const isiPhoneX = isIos && (deviceHeight > 736)
29
+
30
+
31
+
32
+ export const statusBarHeight = (() => {
33
+ if (isAndroid) {
34
+ if ((StatusBar.currentHeight || 0) > 20) return 40
35
+ }
36
+ if (isiPhoneX) return 44
37
+ return 20
38
+ })()
39
+
40
+ export const navigationBarHeight = (() => {
41
+ if (isAndroid) return statusBarHeight + 44
42
+ if (isiPhoneX) return 88
43
+ return 64
44
+ })()
@@ -0,0 +1,65 @@
1
+ import { Dimensions, PixelRatio } from 'react-native';
2
+ const pixelRatio = PixelRatio.get();
3
+ const width = Dimensions.get('window').width; //设备的宽度
4
+ const height = Dimensions.get('window').height; //设备的高度
5
+
6
+ export const px2sp = (size: number) => {
7
+ if (pixelRatio === 2) {
8
+ // iphone 5s and older Androids
9
+ if (width < 360) {
10
+ return size * 0.95;
11
+ }
12
+ // iphone 5
13
+ if (height < 667) {
14
+ return size;
15
+ // iphone 6-6s
16
+ } else if (height >= 667 && height <= 735) {
17
+ return size * 1.15;
18
+ }
19
+ // older phablets
20
+ return size * 1.25;
21
+ }
22
+ if (pixelRatio === 3) {
23
+ // catch Android font scaling on small machines
24
+ // where pixel ratio / font scale ratio => 3:3
25
+ if (width <= 360) {
26
+ return size;
27
+ }
28
+ // Catch other weird android width sizings
29
+ if (height < 667) {
30
+ return size * 1.15;
31
+ // catch in-between size Androids and scale font up
32
+ // a tad but not too much
33
+ }
34
+ if (height >= 667 && height <= 735) {
35
+ return size * 1.2;
36
+ }
37
+ // catch larger devices
38
+ // ie iphone 6s plus / 7 plus / mi note 等等
39
+ return size * 1.27;
40
+ }
41
+ if (pixelRatio === 3.5) {
42
+ // catch Android font scaling on small machines
43
+ // where pixel ratio / font scale ratio => 3:3
44
+ if (width <= 360) {
45
+ return size;
46
+ // Catch other smaller android height sizings
47
+ }
48
+ if (height < 667) {
49
+ return size * 1.2;
50
+ // catch in-between size Androids and scale font up
51
+ // a tad but not too much
52
+ }
53
+ if (height >= 667 && height <= 735) {
54
+ return size * 1.25;
55
+ }
56
+ // catch larger phablet devices
57
+ return size * 1.4;
58
+ }
59
+ // if older device ie pixelRatio !== 2 || 3 || 3.5
60
+ return size;
61
+ };
62
+
63
+
64
+
65
+
@@ -0,0 +1,58 @@
1
+ /*
2
+ * @Author: shiguo
3
+ * @Date: 2022-04-15 14:15:07
4
+ * @LastEditors: shiguo
5
+ * @LastEditTime: 2022-04-26 14:39:27
6
+ * @FilePath: /@aks/easy/screen/text-set.tsx
7
+ */
8
+ /**
9
+ * 全局配置Text
10
+ */
11
+
12
+ import React from 'react';
13
+ import { Platform, Text as Text_spaceName, TextInput as TextInput_spaceName } from 'react-native';
14
+ const Text: any = Text_spaceName
15
+ const TextInput: any = TextInput_spaceName
16
+ const textDefaultStyle = {
17
+ ...Platform.select({
18
+ android: { fontFamily: 'DroidSansFallback' }
19
+ }),
20
+ allowFontScaling: false,
21
+ paddingVertical: 0,
22
+ paddingHorizontal: 0,
23
+ };
24
+
25
+
26
+
27
+ const textRender = Text.render;
28
+ Text.render = function (...args: any[]) {
29
+ const origin = textRender.call(this, ...args);
30
+ return React.cloneElement(origin, {
31
+ style: [textDefaultStyle, origin.props.style]
32
+ });
33
+ };
34
+
35
+
36
+ const textInputDefaultStyle = {
37
+ defaultProps: false,
38
+ paddingVertical: 0,
39
+ paddingHorizontal: 0,
40
+ autoCapitalize: "none", //不自动大写
41
+ autoCorrect: false, //不自动纠正拼写
42
+ };
43
+
44
+ const textInputRender = TextInput.render;
45
+ TextInput.render = function (...args: any[]) {
46
+ const origin = textInputRender.call(this, ...args);
47
+ return React.cloneElement(origin, {
48
+ style: [textInputDefaultStyle, origin.props.style]
49
+ });
50
+ };
51
+
52
+
53
+
54
+ /**关闭字体缩放 */
55
+ if (!Text.defaultProps) Text.defaultProps = {};
56
+ if (!TextInput.defaultProps) TextInput.defaultProps = {};
57
+ Text.defaultProps.allowFontScaling = false
58
+ TextInput.defaultProps.allowFontScaling = false
package/src/index.d.ts ADDED
@@ -0,0 +1,58 @@
1
+ /*
2
+ * @Author: shiguo
3
+ * @Date: 2022-04-26 11:44:22
4
+ * @LastEditors: shiguo
5
+ * @LastEditTime: 2022-05-05 16:25:03
6
+ * @FilePath: /@aks/easyui/src/index.d.ts
7
+ */
8
+
9
+
10
+
11
+ /// 组件 easy-ui
12
+
13
+ export * from '../lib/Badge'
14
+
15
+ export * from '../lib/Easy-Hud'
16
+
17
+ export * from '../lib/Modal'
18
+
19
+ export * from '../lib/MutiPictureView'
20
+
21
+ export * from '../lib/PictureViewer'
22
+
23
+ export * from '../lib/RefreshList'
24
+
25
+ export * from '../lib/TableCell'
26
+
27
+ export * from '../lib/TextInputArea'
28
+
29
+ export * from '../lib/WithLoadingContainer'
30
+
31
+
32
+ export * from '../lib/StickHeaderView'
33
+
34
+ export * from '../lib/Echarts'
35
+
36
+ /// 全局适配
37
+ export * from '../screen'
38
+
39
+
40
+
41
+
42
+
43
+ /// 工具
44
+ import * as utils from '../utils'
45
+ export {
46
+ utils
47
+ }
48
+
49
+ //通用类型
50
+ export type ItemProps = {
51
+ item: any;
52
+ index: number
53
+ }
54
+
55
+
56
+
57
+ ///
58
+ export * as jsbridge from '../jsbridge'
package/src/index.ts ADDED
@@ -0,0 +1,66 @@
1
+
2
+ /*
3
+ * @Author: shiguo
4
+ * @Date: 2022-04-13 12:47:34
5
+ * @LastEditors: shiguo
6
+ * @LastEditTime: 2022-05-05 17:29:57
7
+ * @FilePath: /@aks/easyui/src/index.ts
8
+ */
9
+
10
+
11
+
12
+ /// 组件
13
+
14
+
15
+ export * from '../lib/Badge/Badge'
16
+ export type { BadgeProps } from '../lib/Badge'
17
+
18
+
19
+ export { EasyHud, ShowLoading, HideLoading, ShowToast, ShowAlertModal } from '../lib/Easy-Hud/EasyHud'
20
+
21
+ export * from '../lib/Modal/Modal'
22
+
23
+ export { default as MutiPictureView } from '../lib/MutiPictureView/MutiPictureView'
24
+
25
+ export { PictureViewer } from '../lib/PictureViewer/PictureViewer'
26
+
27
+ export { default as RefreshList } from '../lib/RefreshList/RefreshList'
28
+ export type { RefreshListProps, RefreshState } from '../lib/RefreshList'
29
+
30
+ export { default as TableCell } from '../lib/TableCell/TableCell'
31
+ export type { TableCellProps } from '../lib/TableCell'
32
+
33
+
34
+ export { default as TextInputArea } from '../lib/TextInputArea/TextInputArea'
35
+ export type { TextInputAreaCurrent, TextInputAreaProps } from '../lib/TextInputArea'
36
+
37
+
38
+ export { default as WithLoadingContainer } from '../lib/WithLoadingContainer/WithLoadingContainer'
39
+ export { WithLoadingContainerProps, Status } from '../lib/WithLoadingContainer'
40
+
41
+
42
+
43
+ export * from '../lib/StickHeaderView/StickHeaderView'
44
+ export type { StickHeaderViewProps } from '../lib/StickHeaderView'
45
+
46
+
47
+ export { default as EchartsView } from '../lib/Echarts/EchartsView'
48
+ export { echarts } from '../lib/Echarts'
49
+ export type { EchartsViewProps } from '../lib/Echarts'
50
+
51
+
52
+ /// 全局适配
53
+ export * from '../screen/px2dp'
54
+ export * from '../screen/px2sp'
55
+
56
+
57
+ /// 工具
58
+ import * as mode from '../utils/mode'
59
+ import * as lazy from '../utils/lazy'
60
+ export const utils = Object.assign({}, mode, lazy)
61
+
62
+
63
+
64
+ ///  桥接
65
+ import * as UpgradeModule from '../jsbridge/UpgradeModule'
66
+ export const jsbridge = Object.assign({}, UpgradeModule)
package/utils/index.ts ADDED
@@ -0,0 +1,56 @@
1
+ /*
2
+ * @Author: shiguo
3
+ * @Date: 2022-04-19 10:25:43
4
+ * @LastEditors: shiguo
5
+ * @LastEditTime: 2022-05-10 18:32:50
6
+ * @FilePath: /@aks/easyui/utils/index.ts
7
+ */
8
+
9
+
10
+ import * as rn from 'react-native'
11
+
12
+ /**
13
+ * @description: 睡眠时间
14
+ * @param {*}毫秒值
15
+ * @return {*}
16
+ */
17
+ export declare const sleep: (msec?: number) => void;
18
+
19
+
20
+ export declare const keyboardDismissHandlers: rn.GestureResponderHandlers;
21
+
22
+ export type CallBack = (...args: any[]) => void;
23
+
24
+
25
+
26
+
27
+ /**
28
+ * @description: 手势动作回调
29
+ * @param {*}
30
+ * @return {*}
31
+ */
32
+ export declare const panHandlersCallback: (props: { GrantCallback: CallBack, MoveCallback: CallBack, ReleaseCallback: CallBack }) => void;
33
+
34
+ /**
35
+ * @description: 拨打电话
36
+ * @param {number} phone
37
+ * @return {*}
38
+ */
39
+ export declare const callTelephone: (phone: number | string) => void;
40
+
41
+ /**
42
+ * @description: 获取随机色
43
+ * @param {*}
44
+ * @return {*}
45
+ */
46
+ export declare const randomcolor: () => string;
47
+
48
+
49
+
50
+ export type SyncLoopCallBack = (item: any, index: number) => void;
51
+ /**
52
+ * @description: 同步遍历
53
+ * @param {*} dataList:数据源
54
+ * @return {*}
55
+ */
56
+ export declare const syncLoop: (dataList: any[], callback: SyncLoopCallBack) => Promise<string>;
package/utils/lazy.tsx ADDED
@@ -0,0 +1,40 @@
1
+ /*
2
+ * @Author: shiguo
3
+ * @Date: 2022-04-27 18:17:54
4
+ * @LastEditors: shiguo
5
+ * @LastEditTime: 2022-05-10 14:28:24
6
+ * @FilePath: /@aks/easyui/utils/lazy.tsx
7
+ */
8
+ import type { SyncLoopCallBack } from '.'
9
+
10
+ export const sleep = (msec?: number) => {
11
+ return new Promise(resolve => {
12
+ setTimeout(resolve, msec || 350);
13
+ });
14
+ }
15
+
16
+
17
+
18
+
19
+ export const randomcolor = () => {
20
+ return `rgba(${Math.round(Math.random() * 255)},${Math.round(Math.random() * 255)},${Math.round(Math.random() * 255)},${Math.random()})`
21
+ }
22
+
23
+
24
+
25
+
26
+
27
+ export const syncLoop = async (dataList: any[], callback: SyncLoopCallBack) => {
28
+ const length = dataList.length;
29
+ const O = Object(dataList);
30
+ let k = 0;
31
+ while (k < length) {
32
+ if (k in O) {
33
+ const kValue = O[k];
34
+ await callback(kValue, k);
35
+ }
36
+ k++;
37
+ }
38
+
39
+ return Promise.resolve('SyncForeach loop over')
40
+ };
package/utils/mode.tsx ADDED
@@ -0,0 +1,48 @@
1
+ /*
2
+ * @Author: shiguo
3
+ * @Date: 2022-04-18 18:40:07
4
+ * @LastEditors: shiguo
5
+ * @LastEditTime: 2022-05-09 16:21:37
6
+ * @FilePath: /@aks/easyui/utils/mode.tsx
7
+ */
8
+ import type { CallBack } from '.'
9
+
10
+
11
+
12
+
13
+ import { PanResponder, Keyboard, Linking } from 'react-native'
14
+ export const keyboardDismissHandlers = PanResponder.create({
15
+ onStartShouldSetPanResponder: () => true,
16
+ onPanResponderGrant: Keyboard.dismiss
17
+ }).panHandlers
18
+
19
+
20
+
21
+
22
+ export const panHandlersCallback = (props: { GrantCallback: CallBack, MoveCallback: CallBack, ReleaseCallback: CallBack }) => {
23
+ return PanResponder.create({
24
+ onStartShouldSetPanResponder: () => true,
25
+ onMoveShouldSetPanResponder: () => true,
26
+ onPanResponderGrant: props.GrantCallback,
27
+ onPanResponderMove: props.MoveCallback,
28
+ onPanResponderRelease: props.ReleaseCallback
29
+ }).panHandlers
30
+
31
+ }
32
+
33
+
34
+ export const callTelephone = (phone: number | string) => {
35
+
36
+ let tel = 'tel:' + phone
37
+ Linking.canOpenURL(tel).then((supported) => {
38
+ if (!supported) {
39
+ console.warn('[sg:mode]', '模拟器不支持拨打电话')
40
+ } else {
41
+ Linking.openURL(tel)
42
+ }
43
+ }).catch(error => {
44
+ //alert(error.toString())
45
+ console.warn('[sg:mode]', error.toString())
46
+ })
47
+
48
+ }