@aks-dev/easyui 1.0.162 → 1.0.163

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.
@@ -2,7 +2,7 @@
2
2
  * @Author: shiguo
3
3
  * @Date: 2022-05-17 15:22:06
4
4
  * @LastEditors: shiguo
5
- * @LastEditTime: 2022-12-27 09:12:36
5
+ * @LastEditTime: 2023-09-27 15:17:15
6
6
  * @FilePath: /@aks-dev/easyui/lib/AnimationModal/AnimationModal.tsx
7
7
  */
8
8
 
@@ -69,28 +69,35 @@ export const AnimationModal: React.ForwardRefExoticComponent<
69
69
  })
70
70
  }
71
71
 
72
- React.useImperativeHandle<unknown, AnimationModalProps.RefAttributes>(ref, () => ({
73
- show,
74
- hide,
75
- target: targetRef.current
76
- }), [])
77
72
 
78
- const targetRef = React.useRef<any>()
79
73
 
74
+ const init = React.useCallback(() => ({ show, hide, setData, getData }), [])
75
+ React.useImperativeHandle<unknown, AnimationModalProps.RefAttributes>(ref, init, [])
76
+ const dataRef = React.useRef<any>()
77
+ const setData = (data?: any) => {
78
+ dataRef.current = data
79
+ return init()
80
+ }
80
81
 
82
+ const getData = () => dataRef.current
81
83
 
82
84
 
83
- const show = async () => {
85
+ const show = () => {
84
86
  setDisplay('flex', async () => {
85
87
  await utils.sleep(50)
86
88
  await getLayoutPromise()
87
89
  timing(-layoutRef.current?.h1)
88
90
  })
91
+
92
+ return init()
89
93
  }
90
- const hide = async () => {
94
+ const hide = () => {
91
95
  timing(0)
92
- await utils.sleep(300)
93
- setDisplay('none')
96
+ setTimeout(() => {
97
+ setDisplay('none')
98
+ }, 300)
99
+
100
+ return init()
94
101
  }
95
102
 
96
103
 
@@ -2,7 +2,7 @@
2
2
  * @Author: shiguo
3
3
  * @Date: 2022-05-18 17:26:41
4
4
  * @LastEditors: shiguo
5
- * @LastEditTime: 2022-12-22 11:17:17
5
+ * @LastEditTime: 2023-09-27 15:12:59
6
6
  * @FilePath: /@aks-dev/easyui/lib/AnimationModal/index.d.ts
7
7
  */
8
8
  import { StyleProp, ViewStyle } from 'react-native';
@@ -26,9 +26,10 @@ export type AnimationModalProps = {
26
26
 
27
27
  declare namespace AnimationModalProps {
28
28
  type RefAttributes = {
29
- show: (target?:any) => void;
30
- hide: () => void;
31
- target:any
29
+ show: () => RefAttributes;
30
+ hide: () => RefAttributes;
31
+ setData: (data?: any) => RefAttributes;
32
+ getData: () => any;
32
33
  }
33
34
  }
34
35
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aks-dev/easyui",
3
- "version": "1.0.162",
3
+ "version": "1.0.163",
4
4
  "description": "工具箱",
5
5
  "main": "./src/index.ts",
6
6
  "typings": "./src/index.d.ts",