@aks-dev/easyui 1.0.99 → 1.0.102

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.
@@ -1,24 +1,24 @@
1
1
  import * as React from 'react'
2
- import { View, Text, StyleSheet, Platform, StatusBar, TouchableOpacity, } from 'react-native'
2
+ import { View, Text, StyleSheet, Platform, StatusBar, TouchableOpacity,Dimensions } from 'react-native'
3
3
  import Modal from 'react-native-modal'
4
4
 
5
5
  import { px2dp, deviceWidth } from '../../../screen/px2dp'
6
6
  import { px2sp } from '../../../screen/px2sp'
7
7
 
8
- import { AlertBottomViewOptions, AlertBottomViewCurrent } from '.'
8
+ import { AlertBottomOptions } from '.'
9
9
 
10
10
 
11
11
 
12
12
  type State = {
13
13
  visible: boolean;
14
14
 
15
- } & Omit<AlertBottomViewOptions, 'cancel' | 'confirm'>
15
+ } & Omit<AlertBottomOptions, 'cancel' | 'confirm'>
16
16
 
17
17
 
18
18
 
19
19
 
20
20
 
21
- export default React.forwardRef<AlertBottomViewCurrent, {}>((_, ref) => {
21
+ export default React.forwardRef<AlertBottomOptions.RefAttributes, {}>((_, ref) => {
22
22
 
23
23
 
24
24
  const defaultState: Partial<State> = {
@@ -32,8 +32,8 @@ export default React.forwardRef<AlertBottomViewCurrent, {}>((_, ref) => {
32
32
 
33
33
 
34
34
 
35
- React.useImperativeHandle<unknown, AlertBottomViewCurrent>(ref, () => ({
36
- show: async (options: Partial<AlertBottomViewOptions>) => {
35
+ React.useImperativeHandle<unknown, AlertBottomOptions.RefAttributes>(ref, () => ({
36
+ show: async (options: Partial<AlertBottomOptions>) => {
37
37
 
38
38
  setState(Object.assign({}, defaultState, { visible: true }, options))
39
39
  cancelCallbackRef.current = options.cancel;
@@ -77,6 +77,7 @@ export default React.forwardRef<AlertBottomViewCurrent, {}>((_, ref) => {
77
77
  }}
78
78
  isVisible={state.visible}
79
79
  style={{ margin: 0 }}
80
+ deviceHeight={Dimensions.get('screen').height}
80
81
  >
81
82
  <View style={styles.container}>
82
83
  <View style={[styles.wrapper, state.wrapperStyle]}>
@@ -129,11 +130,11 @@ export default React.forwardRef<AlertBottomViewCurrent, {}>((_, ref) => {
129
130
 
130
131
 
131
132
 
132
- export const alertBottomViewRef = React.createRef<AlertBottomViewCurrent>();
133
+ export const alertBottomViewRef = React.createRef<AlertBottomOptions.RefAttributes>();
133
134
 
134
135
 
135
136
 
136
- export const showAlertBottomModal = (props: Partial<AlertBottomViewOptions>) => {
137
+ export const showAlertBottomModal = (props: Partial<AlertBottomOptions>) => {
137
138
  alertBottomViewRef.current?.show(props)
138
139
  }
139
140
 
@@ -2,8 +2,8 @@
2
2
  * @Author: shiguo
3
3
  * @Date: 2022-04-22 17:30:32
4
4
  * @LastEditors: shiguo
5
- * @LastEditTime: 2022-07-12 19:39:48
6
- * @FilePath: /@aks-dev/easyui/lib/Hud/AlertBottomView/index.ts
5
+ * @LastEditTime: 2022-09-09 10:52:55
6
+ * @FilePath: /@aks-dev/easyui/lib/Hud/AlertBottomView/index.d.ts
7
7
  */
8
8
  import * as React from 'react'
9
9
 
@@ -11,7 +11,7 @@ import * as React from 'react'
11
11
  import { StyleProp, ViewStyle, TextStyle } from 'react-native'
12
12
 
13
13
 
14
- export declare type AlertBottomViewOptions = {
14
+ export declare type AlertBottomOptions = {
15
15
  title: string;
16
16
  wrapperStyle: StyleProp<ViewStyle>;
17
17
  content: string | React.ReactElement;
@@ -27,16 +27,16 @@ export declare type AlertBottomViewOptions = {
27
27
  }
28
28
 
29
29
 
30
- export declare const showAlertBottomModal: (props: Partial<AlertBottomViewOptions>) => void;
30
+ export declare const showAlertBottomModal: (props: Partial<AlertBottomOptions>) => void;
31
31
 
32
-
33
-
34
- export declare type AlertBottomViewCurrent = {
35
- show: (options: Partial<AlertBottomViewOptions>) => void;
36
- hide: () => void;
32
+ declare namespace AlertBottomOptions {
33
+ type RefAttributes = {
34
+ show: (options: Partial<AlertBottomOptions>) => void;
35
+ hide: () => void;
36
+ }
37
37
  }
38
38
 
39
39
 
40
- export declare const AlertBottomView: React.ForwardRefExoticComponent<React.PropsWithoutRef<{}> & React.RefAttributes<AlertBottomViewCurrent>>;
40
+ export declare const AlertBottomView: React.ForwardRefExoticComponent<React.PropsWithoutRef<{}> & React.RefAttributes<AlertBottomOptions.RefAttributes>>;
41
41
 
42
- export declare const AlertBottomViewRef: React.RefObject<AlertBottomViewCurrent>
42
+ export declare const AlertBottomViewRef: React.RefObject<AlertBottomOptions.RefAttributes>
@@ -0,0 +1,176 @@
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 { AlertSheetViewOptions } from '.'
5
+ import { px2dp } from '../../../screen/px2dp'
6
+ import { px2sp } from '../../../screen/px2sp'
7
+
8
+
9
+
10
+
11
+
12
+ type State = {
13
+ visible: boolean;
14
+ } & AlertSheetViewOptions
15
+
16
+
17
+
18
+
19
+
20
+ export default React.forwardRef<AlertSheetViewOptions.RefAttributes, {}>((_, ref) => {
21
+
22
+
23
+ const defaultState: Partial<State> = {
24
+ visible: false,
25
+ actions: []
26
+ }
27
+ const [state, setState] = React.useState<Partial<State>>(defaultState)
28
+
29
+ React.useImperativeHandle<unknown, AlertSheetViewOptions.RefAttributes>(ref, () => ({
30
+ show: async (options: Partial<AlertSheetViewOptions>) => {
31
+ setState(Object.assign({}, defaultState, { visible: true }, options))
32
+ },
33
+ hide
34
+ }), [])
35
+
36
+
37
+ const hide = async () => {
38
+ setState(defaultState)
39
+ }
40
+
41
+
42
+ React.useEffect(() => {
43
+ if (Platform.OS == 'android') {
44
+ if (state.visible) {
45
+ StatusBar.setBackgroundColor('black')
46
+ StatusBar.setBarStyle('light-content')
47
+ } else {
48
+ StatusBar.setBackgroundColor('transparent')
49
+ StatusBar.setBarStyle('dark-content')
50
+ }
51
+ }
52
+
53
+ }, [state.visible])
54
+ return (
55
+ <Modal
56
+ hideModalContentWhileAnimating={true}//通过隐藏模态内容直到动画完成来增强性能
57
+ useNativeDriver={true}//定义动画是否应使用本机驱动程序
58
+ animationIn='slideInUp'
59
+ animationOut='slideOutDown'
60
+ onBackButtonPress={() => {
61
+ //按下Android后退按钮时调用
62
+ hide()
63
+ }}
64
+ onBackdropPress={() => {
65
+ //按下背景时调用
66
+ hide()
67
+ }}
68
+ isVisible={state.visible}
69
+ deviceHeight={Dimensions.get('screen').height}
70
+ style={{ margin: 0}}
71
+ >
72
+ <View style={styles.container}>
73
+ <View style={[styles.wrapper]}>
74
+ <View style={styles.itemContainer}>
75
+ {state.actions?.map((i, idx) =>
76
+ <TouchableOpacity
77
+
78
+ key={`sg-action-${idx}`}
79
+ style={[styles.item]}
80
+ activeOpacity={1}
81
+ onPress={() => i.onClick && i.onClick()}>
82
+ <Text style={[styles.itemText,{color:i.color}]} numberOfLines={2}>{i.text}</Text>
83
+ </TouchableOpacity>
84
+ )}
85
+ </View>
86
+
87
+
88
+
89
+ <TouchableOpacity
90
+ style={[styles.cancel]}
91
+ activeOpacity={1}
92
+ onPress={() => {
93
+ hide()
94
+ }}>
95
+ <Text style={[styles.cancelText]}>取消</Text>
96
+ </TouchableOpacity>
97
+ </View>
98
+
99
+ </View>
100
+ </Modal>
101
+ )
102
+ })
103
+
104
+
105
+
106
+ export const alertSheetViewRef = React.createRef<AlertSheetViewOptions.RefAttributes>();
107
+
108
+
109
+
110
+ export const showAlertSheetModal = (props: Partial<AlertSheetViewOptions>) => {
111
+ alertSheetViewRef.current?.show(props)
112
+ }
113
+
114
+
115
+
116
+
117
+
118
+
119
+ const styles = StyleSheet.create({
120
+ container: {
121
+ display: 'flex',
122
+ flexGrow: 1,
123
+ justifyContent: 'flex-end',
124
+ alignItems: 'center',
125
+
126
+ },
127
+
128
+ wrapper: {
129
+ flexGrow: 0,
130
+ flexShrink: 0,
131
+ width: '100%',
132
+ // backgroundColor: 'pink',
133
+ overflow: 'hidden',
134
+ borderTopLeftRadius: px2dp(10),
135
+ borderTopRightRadius: px2dp(10),
136
+ display: 'flex',
137
+ padding: px2dp(15),
138
+ },
139
+
140
+ cancel: {
141
+ height: px2dp(50),
142
+ display: 'flex',
143
+ justifyContent: 'center',
144
+ alignItems: 'center',
145
+ borderRadius: px2dp(10),
146
+ backgroundColor: 'white',
147
+ marginTop: px2dp(15),
148
+ },
149
+ cancelText: {
150
+ fontSize: px2sp(15),
151
+ color: '#2763FF',
152
+
153
+ },
154
+
155
+ itemContainer: {
156
+ display: 'flex',
157
+ borderRadius: px2dp(10),
158
+ overflow: 'hidden',
159
+ backgroundColor:'#f1f1f1'
160
+ },
161
+ item: {
162
+ height: px2dp(50),
163
+ display: 'flex',
164
+ justifyContent: 'center',
165
+ alignItems: 'center',
166
+
167
+ backgroundColor: 'white',
168
+ marginTop: px2dp(0.5)
169
+ },
170
+ itemText: {
171
+ fontSize: px2sp(12),
172
+ color: '#666666',
173
+
174
+ },
175
+
176
+ })
@@ -0,0 +1,35 @@
1
+ /*
2
+ * @Author: shiguo
3
+ * @Date: 2022-04-22 17:30:32
4
+ * @LastEditors: shiguo
5
+ * @LastEditTime: 2022-09-09 10:51:19
6
+ * @FilePath: /@aks-dev/easyui/lib/Hud/AlertSheetView/index.d.ts
7
+ */
8
+ import * as React from 'react';
9
+ import { ColorValue } from 'react-native';
10
+
11
+
12
+
13
+ type ActionSheet = {
14
+ text: string;
15
+ color?: ColorValue | undefined;
16
+ onClick?: () => void;
17
+ }
18
+ export declare type AlertSheetViewOptions = {
19
+ actions:ActionSheet[];
20
+ }
21
+
22
+
23
+ export declare const showAlertSheetModal: (props: Partial<AlertSheetViewOptions>) => void;
24
+
25
+
26
+ declare namespace AlertSheetViewOptions {
27
+ type RefAttributes = {
28
+ show: (options: Partial<AlertSheetViewOptions>) => void;
29
+ hide: () => void;
30
+ }
31
+ }
32
+
33
+ export declare const AlertSheetView: React.ForwardRefExoticComponent<React.PropsWithoutRef<{}> & React.RefAttributes<AlertSheetViewOptions.RefAttributes>>;
34
+
35
+ export declare const AlertSheetViewRef: React.RefObject<AlertSheetViewOptions.RefAttributes>
@@ -5,7 +5,7 @@ import { View, Text, StyleSheet, Platform, Modal, StatusBar, TouchableOpacity, A
5
5
  import { px2dp, deviceWidth } from '../../../screen/px2dp'
6
6
  import { px2sp } from '../../../screen/px2sp'
7
7
 
8
- import { AlertViewOptions, AlertViewCurrent } from '.'
8
+ import { AlertViewOptions } from '.'
9
9
 
10
10
 
11
11
 
@@ -18,7 +18,7 @@ type State = {
18
18
 
19
19
 
20
20
 
21
- export default React.forwardRef<AlertViewCurrent, {}>((_, ref) => {
21
+ export default React.forwardRef<AlertViewOptions.RefAttributes, {}>((_, ref) => {
22
22
 
23
23
 
24
24
  const defaultState: Partial<State> = {
@@ -32,7 +32,7 @@ export default React.forwardRef<AlertViewCurrent, {}>((_, ref) => {
32
32
 
33
33
 
34
34
 
35
- React.useImperativeHandle<unknown, AlertViewCurrent>(ref, () => ({
35
+ React.useImperativeHandle<unknown, AlertViewOptions.RefAttributes>(ref, () => ({
36
36
  show: async (options: Partial<AlertViewOptions>) => {
37
37
 
38
38
  setState(Object.assign({}, defaultState, { visible: true }, options))
@@ -134,7 +134,7 @@ export default React.forwardRef<AlertViewCurrent, {}>((_, ref) => {
134
134
 
135
135
 
136
136
 
137
- export const alertViewRef = React.createRef<AlertViewCurrent>();
137
+ export const alertViewRef = React.createRef<AlertViewOptions.RefAttributes>();
138
138
 
139
139
 
140
140
 
@@ -2,8 +2,8 @@
2
2
  * @Author: shiguo
3
3
  * @Date: 2022-04-22 17:30:32
4
4
  * @LastEditors: shiguo
5
- * @LastEditTime: 2022-07-12 19:06:29
6
- * @FilePath: /cmwy-device-app/node_modules/@aks-dev/easyui/lib/Hud/AlertView/index.ts
5
+ * @LastEditTime: 2022-09-09 10:53:51
6
+ * @FilePath: /@aks-dev/easyui/lib/Hud/AlertView/index.ts
7
7
  */
8
8
  import * as React from 'react'
9
9
 
@@ -30,12 +30,16 @@ export declare const showAlertModal: (props: Partial<AlertViewOptions>) => void;
30
30
 
31
31
 
32
32
 
33
- export declare type AlertViewCurrent = {
34
- show: (options: Partial<AlertViewOptions>) => void;
35
- hide: () => void;
33
+ declare namespace AlertViewOptions {
34
+ type RefAttributes = {
35
+ show: (options: Partial<AlertViewOptions>) => void;
36
+ hide: () => void;
37
+ }
36
38
  }
37
39
 
38
40
 
39
- export declare const AlertView: React.ForwardRefExoticComponent<React.PropsWithoutRef<{}> & React.RefAttributes<AlertViewCurrent>>;
40
41
 
41
- export declare const alertViewRef: React.RefObject<AlertViewCurrent>
42
+
43
+ export declare const AlertView: React.ForwardRefExoticComponent<React.PropsWithoutRef<{}> & React.RefAttributes<AlertViewOptions.RefAttributes>>;
44
+
45
+ export declare const alertViewRef: React.RefObject<AlertViewOptions.RefAttributes>
package/lib/Hud/Hud.tsx CHANGED
@@ -2,7 +2,7 @@
2
2
  * @Author: shiguo
3
3
  * @Date: 2022-04-24 14:10:04
4
4
  * @LastEditors: shiguo
5
- * @LastEditTime: 2022-07-15 09:58:50
5
+ * @LastEditTime: 2022-09-09 09:55:01
6
6
  * @FilePath: /cmwy-device-app/node_modules/@aks-dev/easyui/lib/Hud/Hud.tsx
7
7
  */
8
8
  import * as React from 'react'
@@ -14,6 +14,9 @@ import {
14
14
  import {
15
15
  alertBottomViewRef, default as AlertBottomView, showAlertBottomModal
16
16
  } from './AlertBottomView/AlertBottomView'
17
+ import {
18
+ alertSheetViewRef, default as AlertSheetView, showAlertSheetModal
19
+ } from './AlertSheetView/AlertSheetView'
17
20
 
18
21
  import {
19
22
  hideLoading, Loading, loadingRef, showLoading
@@ -25,7 +28,7 @@ import {
25
28
  } from './Toast/Toast'
26
29
 
27
30
 
28
- import {showPopoverView,hidePopoverView,popoverViewRef,PopoverView} from './PopoverView/PopoverView'
31
+ import { showPopoverView, hidePopoverView, popoverViewRef, PopoverView } from './PopoverView/PopoverView'
29
32
 
30
33
 
31
34
 
@@ -42,8 +45,9 @@ export const Hud: React.FC<{}> = () => React.cloneElement(
42
45
  <Loading key="hud-0" ref={loadingRef} />,
43
46
  <Toast key="hud-1" ref={toastRef} />,
44
47
  <AlertView key="hud-2" ref={alertViewRef} />,
45
- <AlertBottomView key="hud-3" ref={alertBottomViewRef} />,
46
- <PopoverView key="hud-4" ref={popoverViewRef}/>,
48
+ <AlertBottomView key="hud-3-0" ref={alertBottomViewRef} />,
49
+ <AlertSheetView key="hud-3-1" ref={alertSheetViewRef} />,
50
+ <PopoverView key="hud-4" ref={popoverViewRef} />,
47
51
  ]
48
52
  )
49
53
 
@@ -51,9 +55,9 @@ export const Hud: React.FC<{}> = () => React.cloneElement(
51
55
  export {
52
56
  showAlertModal,
53
57
  showToast,
54
- showLoading,
55
- hideLoading,
58
+ showLoading, hideLoading,
56
59
  showAlertBottomModal,
57
- showPopoverView,
58
- hidePopoverView
60
+ showAlertSheetModal,
61
+ showPopoverView, hidePopoverView
62
+
59
63
  }
@@ -2,19 +2,19 @@
2
2
  * @Author: shiguo
3
3
  * @Date: 2022-04-24 14:27:02
4
4
  * @LastEditors: shiguo
5
- * @LastEditTime: 2022-07-15 14:21:00
5
+ * @LastEditTime: 2022-09-09 10:55:48
6
6
  * @FilePath: /@aks-dev/easyui/lib/Hud/Loading/Loading.tsx
7
7
  */
8
8
  import React, { useImperativeHandle, useState } from 'react';
9
9
  import { View, ActivityIndicator, StyleSheet, Text, Dimensions, TouchableOpacity, BackHandler } from 'react-native';
10
10
 
11
- import type { LoadingCurrent } from '.'
11
+ import { LoadingOptions } from '.'
12
12
 
13
13
 
14
14
 
15
15
 
16
16
 
17
- export const Loading = React.forwardRef<LoadingCurrent, {}>((_, ref) => {
17
+ export const Loading = React.forwardRef<LoadingOptions.RefAttributes, {}>((_, ref) => {
18
18
  const [show, setShow] = useState(false);
19
19
  const [tipText, setTipText] = useState('加载中');
20
20
 
@@ -26,7 +26,7 @@ export const Loading = React.forwardRef<LoadingCurrent, {}>((_, ref) => {
26
26
  }, [show])
27
27
 
28
28
 
29
- useImperativeHandle<unknown, LoadingCurrent>(ref, () => ({
29
+ useImperativeHandle<unknown, LoadingOptions.RefAttributes>(ref, () => ({
30
30
  showLoading: (content?: string) => {
31
31
  setShow(true);
32
32
  setTipText(content || '加载中')
@@ -50,7 +50,7 @@ export const Loading = React.forwardRef<LoadingCurrent, {}>((_, ref) => {
50
50
  )
51
51
  })
52
52
 
53
- export const loadingRef = React.createRef<LoadingCurrent>();
53
+ export const loadingRef = React.createRef<LoadingOptions.RefAttributes>();
54
54
  export const showLoading = (content?: string) => loadingRef.current?.showLoading(content)
55
55
  export const hideLoading = () => loadingRef.current?.hideLoading()
56
56
 
@@ -0,0 +1,38 @@
1
+
2
+ /*
3
+ * @Author: shiguo
4
+ * @Date: 2022-04-24 14:27:02
5
+ * @LastEditors: shiguo
6
+ * @LastEditTime: 2022-09-09 10:55:28
7
+ * @FilePath: /@aks-dev/easyui/lib/Hud/Loading/index.ts
8
+ */
9
+ import * as React from 'react'
10
+
11
+
12
+
13
+
14
+
15
+
16
+
17
+
18
+
19
+
20
+ declare namespace LoadingOptions {
21
+ type RefAttributes = {
22
+ showLoading: (content?: string) => void;
23
+ hideLoading: () => void;
24
+ }
25
+ }
26
+
27
+
28
+
29
+ export declare const showLoading: (content?: string) => void;
30
+
31
+
32
+ export declare const hideLoading: () => void;
33
+
34
+
35
+ export declare const loadingRef: React.RefObject<LoadingOptions.RefAttributes>;
36
+
37
+ export declare const Loading: React.ForwardRefExoticComponent<React.PropsWithoutRef<{}> & React.RefAttributes<LoadingOptions.RefAttributes>>
38
+
@@ -2,19 +2,19 @@
2
2
  * @Author: shiguo
3
3
  * @Date: 2022-04-24 14:27:02
4
4
  * @LastEditors: shiguo
5
- * @LastEditTime: 2022-07-15 14:20:40
5
+ * @LastEditTime: 2022-09-09 10:57:45
6
6
  * @FilePath: /@aks-dev/easyui/lib/Hud/PopoverView/PopoverView.tsx
7
7
  */
8
8
  import React, { useImperativeHandle, useState } from 'react';
9
9
  import { StyleSheet, TouchableOpacity, BackHandler } from 'react-native';
10
- import type { PopoverViewCurrent, PopoverViewOptions } from '.';
10
+ import type {PopoverViewOptions } from '.';
11
11
 
12
12
 
13
13
 
14
14
 
15
15
 
16
16
 
17
- export const PopoverView = React.forwardRef<PopoverViewCurrent, {}>((_, ref) => {
17
+ export const PopoverView = React.forwardRef<PopoverViewOptions.RefAttributes, {}>((_, ref) => {
18
18
  const [visible, setVisible] = useState<boolean>(false);
19
19
  const [options, setOptions] = useState<Partial<PopoverViewOptions> | undefined>()
20
20
 
@@ -25,7 +25,7 @@ export const PopoverView = React.forwardRef<PopoverViewCurrent, {}>((_, ref) =>
25
25
  }, [visible])
26
26
 
27
27
 
28
- useImperativeHandle<unknown, PopoverViewCurrent>(ref, () => ({
28
+ useImperativeHandle<unknown, PopoverViewOptions.RefAttributes>(ref, () => ({
29
29
  showPopoverView: (options: Partial<PopoverViewOptions>) => {
30
30
  setVisible(true);
31
31
  setOptions(options)
@@ -51,7 +51,7 @@ export const PopoverView = React.forwardRef<PopoverViewCurrent, {}>((_, ref) =>
51
51
  )
52
52
  })
53
53
 
54
- export const popoverViewRef = React.createRef<PopoverViewCurrent>();
54
+ export const popoverViewRef = React.createRef<PopoverViewOptions.RefAttributes>();
55
55
  export const showPopoverView = (options: Partial<PopoverViewOptions>) => popoverViewRef.current?.showPopoverView(options)
56
56
  export const hidePopoverView = () => popoverViewRef.current?.hidePopoverView()
57
57
 
@@ -3,8 +3,8 @@
3
3
  * @Author: shiguo
4
4
  * @Date: 2022-04-24 14:27:02
5
5
  * @LastEditors: shiguo
6
- * @LastEditTime: 2022-07-15 10:07:56
7
- * @FilePath: /cmwy-device-app/node_modules/@aks-dev/easyui/lib/Hud/PopoverView/index.ts
6
+ * @LastEditTime: 2022-09-09 10:57:07
7
+ * @FilePath: /@aks-dev/easyui/lib/Hud/PopoverView/index.ts
8
8
  */
9
9
  import * as React from 'react'
10
10
 
@@ -18,21 +18,21 @@ export type PopoverViewOptions = {
18
18
 
19
19
 
20
20
 
21
- export declare type PopoverViewCurrent = {
22
- showPopoverView: (options:Partial<PopoverViewOptions>) => void;
23
- hidePopoverView: () => void;
21
+ declare namespace PopoverViewOptions {
22
+ type RefAttributes = {
23
+ showPopoverView: (options:Partial<PopoverViewOptions>) => void;
24
+ hidePopoverView: () => void;
25
+ }
24
26
  }
25
27
 
26
28
 
27
-
28
-
29
29
  export declare const showPopoverView: (options:Partial<PopoverViewOptions>) => void;
30
30
 
31
31
 
32
32
  export declare const hidePopoverView: () => void;
33
33
 
34
34
 
35
- export declare const popoverViewRef: React.RefObject<PopoverViewCurrent>;
35
+ export declare const popoverViewRef: React.RefObject<PopoverViewOptions.RefAttributes>;
36
36
 
37
- export declare const PopoverView: React.ForwardRefExoticComponent<React.PropsWithoutRef<PopoverViewOptions> & React.RefAttributes<PopoverViewCurrent>>
37
+ export declare const PopoverView: React.ForwardRefExoticComponent<React.PropsWithoutRef<PopoverViewOptions> & React.RefAttributes<PopoverViewOptions.RefAttributes>>
38
38
 
@@ -2,21 +2,20 @@
2
2
  * @Author: shiguo
3
3
  * @Date: 2021-04-27 10:38:04
4
4
  * @LastEditors: shiguo
5
- * @LastEditTime: 2022-08-04 10:43:06
5
+ * @LastEditTime: 2022-09-09 10:58:34
6
6
  * @FilePath: /@aks-dev/easyui/lib/Hud/Toast/Toast.tsx
7
7
  */
8
8
  import React, { useImperativeHandle, useState, useRef } from 'react';
9
9
  import { View, StyleSheet, Text, Dimensions, Animated, Easing } from 'react-native';
10
10
 
11
11
 
12
- import type { ToastCurrent } from '.'
12
+ import type { ToastOptions } from '.'
13
13
 
14
14
  const errorMsg = '(^_^)∠※ 送你一束小花'
15
15
 
16
- export const Toast = React.forwardRef<ToastCurrent, {}>((_, ref) => {
16
+ export const Toast = React.forwardRef<ToastOptions.RefAttributes, {}>((_, ref) => {
17
17
  const [tipText, setTipText] = useState(errorMsg);
18
18
  const fade = useRef(new Animated.Value(0)).current;
19
- const [tipTheme, setTipTheme] = useState<'black' | 'white'>('black')
20
19
 
21
20
  const fadeAnimation = Animated.sequence([
22
21
  Animated.timing(fade, {
@@ -34,10 +33,9 @@ export const Toast = React.forwardRef<ToastCurrent, {}>((_, ref) => {
34
33
  })
35
34
  ])
36
35
 
37
- useImperativeHandle<unknown, ToastCurrent>(ref, () => ({
38
- showToast: (content: string, theme?: 'black' | 'white') => {
36
+ useImperativeHandle<unknown, ToastOptions.RefAttributes>(ref, () => ({
37
+ showToast: (content: string) => {
39
38
  setTipText(content || errorMsg)
40
- setTipTheme(theme ? theme : 'black')
41
39
  fadeAnimation.reset()
42
40
  fadeAnimation.start()
43
41
  },
@@ -45,17 +43,17 @@ export const Toast = React.forwardRef<ToastCurrent, {}>((_, ref) => {
45
43
 
46
44
  return (
47
45
  <Animated.View style={{ ...styles.toastContainer, opacity: fade }}>
48
- <View style={[styles.toastTipsContainer, { backgroundColor: tipTheme == 'black' ? '#00000088' : '#ffffff88' }]}>
49
- <Text numberOfLines={5} style={[styles.toastTitle, { color: tipTheme == 'black' ? ' white' : 'black' }]}>{tipText} </Text>
46
+ <View style={styles.toastTipsContainer}>
47
+ <Text numberOfLines={5} style={{ ...styles.toastTitle, }}>{tipText} </Text>
50
48
  </View>
51
49
  </Animated.View>
52
50
 
53
51
  )
54
52
  })
55
53
 
56
- export const toastRef = React.createRef<ToastCurrent>();
54
+ export const toastRef = React.createRef<ToastOptions.RefAttributes>();
57
55
 
58
- export const showToast = (content: string, theme?: 'black' | 'white') => toastRef.current?.showToast(content, theme)
56
+ export const showToast = (content: string) => toastRef.current?.showToast(content)
59
57
 
60
58
 
61
59
 
@@ -0,0 +1,22 @@
1
+ /*
2
+ * @Author: shiguo
3
+ * @Date: 2022-04-18 19:18:03
4
+ * @LastEditors: shiguo
5
+ * @LastEditTime: 2022-09-09 10:58:11
6
+ * @FilePath: /@aks-dev/easyui/lib/Hud/Toast/index.ts
7
+ */
8
+ import * as React from 'react'
9
+
10
+
11
+ declare namespace ToastOptions {
12
+ type RefAttributes = {
13
+ showToast: (content: string) => void;
14
+ }
15
+ }
16
+
17
+ export declare const showToast: (content: string) => void;
18
+
19
+
20
+ export declare const toastRef: React.RefObject<ToastOptions.RefAttributes>;
21
+
22
+ export declare const Toast: React.ForwardRefExoticComponent<React.PropsWithoutRef<{}> & React.RefAttributes<ToastOptions.RefAttributes>>;
package/lib/Hud/index.ts CHANGED
@@ -2,8 +2,8 @@
2
2
  * @Author: shiguo
3
3
  * @Date: 2022-04-24 14:14:42
4
4
  * @LastEditors: shiguo
5
- * @LastEditTime: 2022-07-15 12:40:12
6
- * @FilePath: /@aks-dev/easyui/lib/Hud/index.ts
5
+ * @LastEditTime: 2022-09-09 09:55:43
6
+ * @FilePath: /cmwy-device-app/node_modules/@aks-dev/easyui/lib/Hud/index.ts
7
7
  */
8
8
 
9
9
 
@@ -14,6 +14,6 @@ export * from './AlertView'
14
14
  export * from './Loading'
15
15
  export * from './Toast'
16
16
  export * from './AlertBottomView'
17
+ export * from './AlertSheetView'
17
18
  export * from './PopoverView'
18
-
19
19
  export declare const Hud: React.FC<{}>
@@ -2,7 +2,7 @@
2
2
  * @Author: shiguo
3
3
  * @Date: 2022-04-24 13:56:47
4
4
  * @LastEditors: shiguo
5
- * @LastEditTime: 2022-07-14 11:56:11
5
+ * @LastEditTime: 2022-09-09 10:59:38
6
6
  * @FilePath: /@aks-dev/easyui/lib/TextInputArea/TextInputArea.tsx
7
7
  */
8
8
  import React from 'react'
@@ -11,9 +11,9 @@ import {px2dp} from '../../screen/px2dp'
11
11
  import {px2sp} from '../../screen/px2sp'
12
12
 
13
13
 
14
- import type { TextInputAreaProps, TextInputAreaCurrent } from '.'
14
+ import type { TextInputAreaProps } from '.'
15
15
 
16
- export default React.forwardRef<TextInputAreaCurrent, Partial<TextInputAreaProps>>((props, ref) => {
16
+ export default React.forwardRef<TextInputAreaProps.RefAttributes, Partial<TextInputAreaProps>>((props, ref) => {
17
17
  const { defaultValue, placeholder, maxLength = 200, on, ...rest } = props
18
18
 
19
19
  const [value, setValue] = React.useState<string | undefined>(defaultValue)
@@ -23,7 +23,7 @@ export default React.forwardRef<TextInputAreaCurrent, Partial<TextInputAreaProps
23
23
  }, [defaultValue])
24
24
 
25
25
 
26
- React.useImperativeHandle<unknown,TextInputAreaCurrent>(ref, () => ({
26
+ React.useImperativeHandle<unknown,TextInputAreaProps.RefAttributes>(ref, () => ({
27
27
  value: value,
28
28
  }), [value])
29
29
 
@@ -2,8 +2,8 @@
2
2
  * @Author: shiguo
3
3
  * @Date: 2022-04-24 13:59:32
4
4
  * @LastEditors: shiguo
5
- * @LastEditTime: 2022-07-14 11:56:00
6
- * @FilePath: /@aks-dev/easyui/lib/TextInputArea/index.ts
5
+ * @LastEditTime: 2022-09-09 10:59:23
6
+ * @FilePath: /@aks-dev/easyui/lib/TextInputArea/index.d.ts
7
7
  */
8
8
  import * as React from 'react'
9
9
  import { ViewStyle, StyleProp, TextInputProps, TextStyle } from 'react-native'
@@ -21,13 +21,13 @@ export type TextInputAreaProps = {
21
21
  } & TextInputProps
22
22
 
23
23
 
24
-
25
-
26
- export type TextInputAreaCurrent = {
27
- value: string | undefined;
24
+ declare namespace TextInputAreaProps {
25
+ type RefAttributes = {
26
+ value: string | undefined;
27
+ }
28
28
  }
29
29
 
30
30
 
31
- export declare const TextInputArea: React.ForwardRefExoticComponent<React.PropsWithoutRef<Partial<TextInputAreaProps>> & React.RefAttributes<TextInputAreaCurrent>>;
31
+ export declare const TextInputArea: React.ForwardRefExoticComponent<React.PropsWithoutRef<Partial<TextInputAreaProps>> & React.RefAttributes<TextInputAreaProps.RefAttributes>>;
32
32
 
33
33
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aks-dev/easyui",
3
- "version": "1.0.99",
3
+ "version": "1.0.102",
4
4
  "description": "移动端App开发工具包",
5
5
  "main": "./src/index.ts",
6
6
  "typings": "./src/index.d.ts",
@@ -10,8 +10,7 @@
10
10
  "keywords": [
11
11
  "react",
12
12
  "react-native",
13
- "easyui",
14
- "爱科森开发"
13
+ "easyui"
15
14
  ],
16
15
  "files": [
17
16
  "/android",
package/screen/px2dp.ts CHANGED
@@ -2,15 +2,15 @@
2
2
  * @Author: shiguo
3
3
  * @Date: 2022-04-18 14:32:25
4
4
  * @LastEditors: shiguo
5
- * @LastEditTime: 2022-07-14 20:19:39
5
+ * @LastEditTime: 2022-09-09 10:35:02
6
6
  * @FilePath: /@aks-dev/easyui/screen/px2dp.ts
7
7
  */
8
8
  import { Dimensions, Platform, StatusBar } from 'react-native';
9
9
 
10
10
 
11
11
  // 设备宽度,单位 dp
12
- export const deviceWidth = Dimensions.get('window').width; //设备的宽度
13
- export const deviceHeight = Dimensions.get('window').height; //设备的高度
12
+ export const deviceWidth = Dimensions.get('screen').width; //设备的宽度
13
+ export const deviceHeight = Dimensions.get('screen').height; //设备的高度
14
14
  export const isAndroid = Platform.OS === "android"
15
15
  export const isIos = Platform.OS === 'ios'
16
16
  export const isiPhoneX = isIos && (deviceHeight > 736)
@@ -43,7 +43,7 @@ export const statusBarHeight = (() => {
43
43
 
44
44
 
45
45
 
46
- export const navigationBarHeight = (() => {
46
+ export const navigationBarHeight = ( () => {
47
47
  if (isAndroid) return 56
48
48
  return 44
49
49
  })()
package/src/index.ts CHANGED
@@ -3,7 +3,7 @@
3
3
  * @Author: shiguo
4
4
  * @Date: 2022-04-13 12:47:34
5
5
  * @LastEditors: shiguo
6
- * @LastEditTime: 2022-07-15 12:40:31
6
+ * @LastEditTime: 2022-09-09 10:37:09
7
7
  * @FilePath: /@aks-dev/easyui/src/index.ts
8
8
  */
9
9
 
@@ -14,7 +14,15 @@
14
14
 
15
15
  export * from '../lib/Badge/Badge'
16
16
 
17
- export { Hud, showLoading, hideLoading, showToast, showAlertModal, showAlertBottomModal, showPopoverView, hidePopoverView } from '../lib/Hud/Hud'
17
+ export {
18
+ Hud,
19
+ showLoading, hideLoading,
20
+ showToast,
21
+ showAlertModal,
22
+ showAlertBottomModal,
23
+ showAlertSheetModal,
24
+ showPopoverView, hidePopoverView
25
+ } from '../lib/Hud/Hud'
18
26
 
19
27
  export * from '../lib/Modal/Modal'
20
28
 
package/utils/lazy.ts CHANGED
@@ -2,7 +2,7 @@
2
2
  * @Author: shiguo
3
3
  * @Date: 2022-04-27 18:17:54
4
4
  * @LastEditors: shiguo
5
- * @LastEditTime: 2022-07-11 15:59:49
5
+ * @LastEditTime: 2022-08-25 17:02:22
6
6
  * @FilePath: /@aks-dev/easyui/utils/lazy.ts
7
7
  */
8
8
  import type { SyncLoopCallBack } from '.'
@@ -17,7 +17,7 @@ export const sleep = (msec?: number) => {
17
17
 
18
18
 
19
19
  export const randomcolor = () => {
20
- return `rgba(${Math.round(Math.random() * 255)},${Math.round(Math.random() * 255)},${Math.round(Math.random() * 255)},${Math.random()})`
20
+ return `rgba(${Math.round(Math.random() * 255)},${Math.round(Math.random() * 255)},${Math.round(Math.random() * 255)},${1})`
21
21
  }
22
22
 
23
23
 
@@ -1,35 +0,0 @@
1
-
2
- /*
3
- * @Author: shiguo
4
- * @Date: 2022-04-24 14:27:02
5
- * @LastEditors: shiguo
6
- * @LastEditTime: 2022-05-12 11:32:41
7
- * @FilePath: /@aks/easyui/lib/Easy-Hud/Loading/index.ts
8
- */
9
- import * as React from 'react'
10
-
11
-
12
-
13
-
14
-
15
-
16
-
17
-
18
- export declare type LoadingCurrent = {
19
- showLoading: (content?: string) => void;
20
- hideLoading: () => void;
21
- }
22
-
23
-
24
-
25
-
26
- export declare const showLoading: (content?: string) => void;
27
-
28
-
29
- export declare const hideLoading: () => void;
30
-
31
-
32
- export declare const loadingRef: React.RefObject<LoadingCurrent>;
33
-
34
- export declare const Loading: React.ForwardRefExoticComponent<React.PropsWithoutRef<{}> & React.RefAttributes<LoadingCurrent>>
35
-
@@ -1,22 +0,0 @@
1
- /*
2
- * @Author: shiguo
3
- * @Date: 2022-04-18 19:18:03
4
- * @LastEditors: shiguo
5
- * @LastEditTime: 2022-08-04 09:51:29
6
- * @FilePath: /@aks-dev/easyui/lib/Hud/Toast/index.ts
7
- */
8
- import * as React from 'react'
9
-
10
-
11
-
12
-
13
- export declare type ToastCurrent = {
14
- showToast: (content: string, theme?: 'black' | 'white') => void;
15
- }
16
-
17
- export declare const showToast: (content: string, theme?: 'black' | 'white') => void;
18
-
19
-
20
- export declare const toastRef: React.RefObject<ToastCurrent>;
21
-
22
- export declare const Toast: React.ForwardRefExoticComponent<React.PropsWithoutRef<{}> & React.RefAttributes<ToastCurrent>>;