@bifrostui/utils 1.3.1-beta.1 → 1.4.0-beta.0
Sign up to get free protection for your applications and to get access to all the features.
@@ -169,6 +169,12 @@ const getStylesAndLocation = ({
|
|
169
169
|
arrowLocation,
|
170
170
|
selector
|
171
171
|
}) => {
|
172
|
+
if (!(childrenRef == null ? void 0 : childrenRef.current)) {
|
173
|
+
console.error(
|
174
|
+
"\u7EC4\u4EF6\u5305\u88F9\u7684children\u53EF\u80FD\u662F\u4E00\u4E2A\u7EC4\u4EF6\uFF0C\u60A8\u7684\u5F53\u524D\u5199\u6CD5\u53EF\u80FD\u5BFC\u81F4ref\u6CA1\u6709\u7ED1\u5B9A\u5230children\u4E0A\uFF0C\u8BF7\u5C1D\u8BD5\u5BF9children\u5BF9\u5E94\u7684\u7EC4\u4EF6\u4F7F\u7528/* @__PURE__ */ React.forwardRef\u6765\u89E3\u51B3"
|
175
|
+
);
|
176
|
+
return null;
|
177
|
+
}
|
172
178
|
const rootOffset = childrenRef.current.getBoundingClientRect();
|
173
179
|
const $rtDom = document.querySelector(selector);
|
174
180
|
if (!$rtDom)
|
@@ -1,3 +1,3 @@
|
|
1
1
|
import type { TaroElement } from '@tarojs/runtime';
|
2
|
-
declare const getRootElement: (rootEle?: TaroElement | (() => TaroElement)) =>
|
2
|
+
declare const getRootElement: (rootEle?: TaroElement | (() => TaroElement)) => TaroElement | HTMLElement;
|
3
3
|
export default getRootElement;
|
package/dist/touchBlocker.js
CHANGED
@@ -66,6 +66,8 @@ function blockTouch(root) {
|
|
66
66
|
};
|
67
67
|
const onTouchMove = (e) => {
|
68
68
|
const currentTouch = e.touches[0];
|
69
|
+
if (!lastTouch || !currentTouch)
|
70
|
+
return;
|
69
71
|
if (!moveAxis) {
|
70
72
|
if (Math.abs(lastTouch.screenY - currentTouch.screenY) > Math.abs(lastTouch.screenX - currentTouch.screenX))
|
71
73
|
moveAxis = "y";
|
@@ -79,7 +81,9 @@ function blockTouch(root) {
|
|
79
81
|
) && !e.cancelable === false)
|
80
82
|
e.preventDefault();
|
81
83
|
};
|
82
|
-
const onTouchEnd = () => {
|
84
|
+
const onTouchEnd = (e) => {
|
85
|
+
if (e.touches.length !== 0)
|
86
|
+
return;
|
83
87
|
lastTouch = void 0;
|
84
88
|
moveDirection = void 0;
|
85
89
|
moveAxis = void 0;
|
@@ -144,6 +144,12 @@ const getStylesAndLocation = ({
|
|
144
144
|
arrowLocation,
|
145
145
|
selector
|
146
146
|
}) => {
|
147
|
+
if (!(childrenRef == null ? void 0 : childrenRef.current)) {
|
148
|
+
console.error(
|
149
|
+
"\u7EC4\u4EF6\u5305\u88F9\u7684children\u53EF\u80FD\u662F\u4E00\u4E2A\u7EC4\u4EF6\uFF0C\u60A8\u7684\u5F53\u524D\u5199\u6CD5\u53EF\u80FD\u5BFC\u81F4ref\u6CA1\u6709\u7ED1\u5B9A\u5230children\u4E0A\uFF0C\u8BF7\u5C1D\u8BD5\u5BF9children\u5BF9\u5E94\u7684\u7EC4\u4EF6\u4F7F\u7528/* @__PURE__ */ React.forwardRef\u6765\u89E3\u51B3"
|
150
|
+
);
|
151
|
+
return null;
|
152
|
+
}
|
147
153
|
const rootOffset = childrenRef.current.getBoundingClientRect();
|
148
154
|
const $rtDom = document.querySelector(selector);
|
149
155
|
if (!$rtDom)
|
package/es/touchBlocker.js
CHANGED
@@ -44,6 +44,8 @@ function blockTouch(root) {
|
|
44
44
|
};
|
45
45
|
const onTouchMove = (e) => {
|
46
46
|
const currentTouch = e.touches[0];
|
47
|
+
if (!lastTouch || !currentTouch)
|
48
|
+
return;
|
47
49
|
if (!moveAxis) {
|
48
50
|
if (Math.abs(lastTouch.screenY - currentTouch.screenY) > Math.abs(lastTouch.screenX - currentTouch.screenX))
|
49
51
|
moveAxis = "y";
|
@@ -57,7 +59,9 @@ function blockTouch(root) {
|
|
57
59
|
) && !e.cancelable === false)
|
58
60
|
e.preventDefault();
|
59
61
|
};
|
60
|
-
const onTouchEnd = () => {
|
62
|
+
const onTouchEnd = (e) => {
|
63
|
+
if (e.touches.length !== 0)
|
64
|
+
return;
|
61
65
|
lastTouch = void 0;
|
62
66
|
moveDirection = void 0;
|
63
67
|
moveAxis = void 0;
|