motion-v 0.12.0-beta.2 → 0.12.0
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.
|
@@ -23,27 +23,39 @@ function handlePressEvent(state, event, lifecycle) {
|
|
|
23
23
|
}
|
|
24
24
|
class PressGesture extends Feature {
|
|
25
25
|
isActive() {
|
|
26
|
-
return Boolean(this.state.options.
|
|
26
|
+
return Boolean(this.state.options.whilePress);
|
|
27
27
|
}
|
|
28
28
|
constructor(state) {
|
|
29
29
|
super(state);
|
|
30
30
|
}
|
|
31
31
|
mount() {
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
(
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
32
|
+
this.register();
|
|
33
|
+
}
|
|
34
|
+
update() {
|
|
35
|
+
const preProps = this.state.visualElement.prevProps;
|
|
36
|
+
if (preProps.whilePress !== this.state.options.whilePress) {
|
|
37
|
+
this.register();
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
register() {
|
|
41
|
+
this.unmount();
|
|
42
|
+
if (this.isActive()) {
|
|
43
|
+
const element = this.state.element;
|
|
44
|
+
if (!element)
|
|
45
|
+
return;
|
|
46
|
+
this.unmount = press(
|
|
47
|
+
element,
|
|
48
|
+
(el, startEvent) => {
|
|
49
|
+
handlePressEvent(this.state, startEvent, "Start");
|
|
50
|
+
return (endEvent, { success }) => handlePressEvent(
|
|
51
|
+
this.state,
|
|
52
|
+
endEvent,
|
|
53
|
+
success ? "End" : "Cancel"
|
|
54
|
+
);
|
|
55
|
+
},
|
|
56
|
+
{ useGlobalTarget: this.state.options.globalPressTarget }
|
|
57
|
+
);
|
|
58
|
+
}
|
|
47
59
|
}
|
|
48
60
|
}
|
|
49
61
|
export {
|
|
@@ -196,7 +196,7 @@ class MotionState {
|
|
|
196
196
|
if (isAnimate) {
|
|
197
197
|
this.animateUpdates({
|
|
198
198
|
isFallback: !isActive && name !== "exit" && this.visualElement.isControllingVariants,
|
|
199
|
-
isExit: this.activeStates.exit
|
|
199
|
+
isExit: name === "exit" && this.activeStates.exit
|
|
200
200
|
});
|
|
201
201
|
}
|
|
202
202
|
}
|