@aks-dev/easyui 1.0.127 → 1.0.128
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,12 +2,12 @@
|
|
|
2
2
|
* @Author: shiguo
|
|
3
3
|
* @Date: 2022-05-17 15:22:06
|
|
4
4
|
* @LastEditors: shiguo
|
|
5
|
-
* @LastEditTime: 2022-12-21
|
|
6
|
-
* @FilePath:
|
|
5
|
+
* @LastEditTime: 2022-12-21 21:00:43
|
|
6
|
+
* @FilePath: /@aks-dev/easyui/lib/AnimationModal/AnimationModal.tsx
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
9
|
import * as React from "react";
|
|
10
|
-
import { Animated, Easing, LayoutRectangle, PanResponder, StyleSheet, useWindowDimensions } from 'react-native';
|
|
10
|
+
import { View, Animated, Easing, LayoutRectangle, PanResponder, StyleSheet, useWindowDimensions } from 'react-native';
|
|
11
11
|
import type { AnimationModalProps } from '.';
|
|
12
12
|
import * as utils from '../../utils/lazy';
|
|
13
13
|
type State = {
|
|
@@ -26,7 +26,7 @@ export const AnimationModal: React.ForwardRefExoticComponent<
|
|
|
26
26
|
mask = false
|
|
27
27
|
} = props || {}
|
|
28
28
|
|
|
29
|
-
const {height} = useWindowDimensions()
|
|
29
|
+
const { height } = useWindowDimensions()
|
|
30
30
|
|
|
31
31
|
const [state, dispatch] = React.useReducer<StateReducerProps>(
|
|
32
32
|
(state, action) => ({ ...state, ...action }),
|
|
@@ -35,7 +35,7 @@ export const AnimationModal: React.ForwardRefExoticComponent<
|
|
|
35
35
|
})
|
|
36
36
|
|
|
37
37
|
const animatedValue = React.useRef(new Animated.Value(0)).current;
|
|
38
|
-
const timing = (value) => {
|
|
38
|
+
const timing = (value: number) => {
|
|
39
39
|
Animated.timing(animatedValue, {
|
|
40
40
|
toValue: value,
|
|
41
41
|
duration: 350,
|
|
@@ -43,7 +43,6 @@ export const AnimationModal: React.ForwardRefExoticComponent<
|
|
|
43
43
|
easing: Easing.linear,
|
|
44
44
|
}).start(({ finished }) => {
|
|
45
45
|
/* 动画完成的回调函数 */
|
|
46
|
-
console.log({ finished })
|
|
47
46
|
});
|
|
48
47
|
};
|
|
49
48
|
|
|
@@ -74,10 +73,17 @@ export const AnimationModal: React.ForwardRefExoticComponent<
|
|
|
74
73
|
}
|
|
75
74
|
|
|
76
75
|
return (
|
|
77
|
-
<
|
|
76
|
+
<View
|
|
78
77
|
style={Object.assign({ display: state.display }, styles.container, props.style)}
|
|
79
78
|
{...PanResponder.create({
|
|
80
|
-
onStartShouldSetPanResponder: () =>
|
|
79
|
+
onStartShouldSetPanResponder: (e, gestureState) => {
|
|
80
|
+
let pageY = e.nativeEvent.pageY
|
|
81
|
+
let topY = height - layoutRef.current.h1
|
|
82
|
+
if (pageY <= topY && !mask) {
|
|
83
|
+
return true
|
|
84
|
+
}
|
|
85
|
+
return false
|
|
86
|
+
},
|
|
81
87
|
onPanResponderGrant: (e, gestureState) => {
|
|
82
88
|
// console.log({e})
|
|
83
89
|
let pageY = e.nativeEvent.pageY
|
|
@@ -98,7 +104,7 @@ export const AnimationModal: React.ForwardRefExoticComponent<
|
|
|
98
104
|
>
|
|
99
105
|
{props.children}
|
|
100
106
|
</Animated.View>
|
|
101
|
-
</
|
|
107
|
+
</View>
|
|
102
108
|
)
|
|
103
109
|
})
|
|
104
110
|
|