@arco-design/mobile-react 2.27.0 → 2.27.2

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.
Files changed (50) hide show
  1. package/CHANGELOG.md +26 -0
  2. package/README.en-US.md +2 -2
  3. package/README.md +2 -2
  4. package/cjs/_helpers/index.d.ts +1 -0
  5. package/cjs/_helpers/index.js +10 -0
  6. package/cjs/index-bar/index.js +7 -9
  7. package/cjs/index-bar/type.d.ts +3 -3
  8. package/cjs/load-more/index.js +4 -1
  9. package/cjs/nav-bar/index.js +2 -2
  10. package/cjs/show-monitor/index.js +112 -38
  11. package/cjs/swipe-load/demo/style/css/mobile.css +3 -0
  12. package/cjs/swipe-load/demo/style/mobile.less +11 -0
  13. package/cjs/swipe-load/index.js +86 -32
  14. package/cjs/swipe-load/style/css/index.css +3 -0
  15. package/cjs/swipe-load/style/index.less +7 -0
  16. package/cjs/swipe-load/type.d.ts +29 -0
  17. package/cjs/tabs/index.js +1 -0
  18. package/dist/index.js +393 -838
  19. package/dist/index.min.js +5 -5
  20. package/dist/style.css +3 -0
  21. package/dist/style.min.css +1 -1
  22. package/esm/_helpers/index.d.ts +1 -0
  23. package/esm/_helpers/index.js +7 -0
  24. package/esm/index-bar/index.js +1 -2
  25. package/esm/index-bar/type.d.ts +3 -3
  26. package/esm/load-more/index.js +4 -1
  27. package/esm/nav-bar/index.js +2 -2
  28. package/esm/show-monitor/index.js +112 -38
  29. package/esm/swipe-load/demo/style/css/mobile.css +3 -0
  30. package/esm/swipe-load/demo/style/mobile.less +11 -0
  31. package/esm/swipe-load/index.js +85 -32
  32. package/esm/swipe-load/style/css/index.css +3 -0
  33. package/esm/swipe-load/style/index.less +7 -0
  34. package/esm/swipe-load/type.d.ts +29 -0
  35. package/esm/tabs/index.js +1 -0
  36. package/package.json +3 -3
  37. package/umd/_helpers/index.d.ts +1 -0
  38. package/umd/_helpers/index.js +10 -0
  39. package/umd/index-bar/index.js +10 -10
  40. package/umd/index-bar/type.d.ts +3 -3
  41. package/umd/load-more/index.js +4 -1
  42. package/umd/nav-bar/index.js +2 -2
  43. package/umd/show-monitor/index.js +112 -38
  44. package/umd/swipe-load/demo/style/css/mobile.css +3 -0
  45. package/umd/swipe-load/demo/style/mobile.less +11 -0
  46. package/umd/swipe-load/index.js +88 -36
  47. package/umd/swipe-load/style/css/index.css +3 -0
  48. package/umd/swipe-load/style/index.less +7 -0
  49. package/umd/swipe-load/type.d.ts +29 -0
  50. package/umd/tabs/index.js +1 -0
package/CHANGELOG.md CHANGED
@@ -3,6 +3,32 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## [2.27.2](https://github.com/arco-design/arco-design-mobile/compare/@arco-design/mobile-react@2.27.1...@arco-design/mobile-react@2.27.2) (2023-05-10)
7
+
8
+
9
+ ### Bug Fixes
10
+
11
+ * `LoadMore` status reset time for controlled mode ([#121](https://github.com/arco-design/arco-design-mobile/issues/121)) ([f141e7f](https://github.com/arco-design/arco-design-mobile/commit/f141e7f8e91944f5d68bb5fbf59238d5d48b8eda))
12
+ * `NavBar` fix warning in nextjs ssr ([#118](https://github.com/arco-design/arco-design-mobile/issues/118)) ([57c2838](https://github.com/arco-design/arco-design-mobile/commit/57c283852f26e06fb4d38dc8753cff7a34232a98))
13
+ * `ShowMonitor` support observer singleton ([#113](https://github.com/arco-design/arco-design-mobile/issues/113)) ([7099b30](https://github.com/arco-design/arco-design-mobile/commit/7099b307935357e496b902f6148ea0854da2912a))
14
+ * `SwipeLoad` support bounce animate ([#29](https://github.com/arco-design/arco-design-mobile/issues/29)) ([cad1a6b](https://github.com/arco-design/arco-design-mobile/commit/cad1a6ba19e6d45a33233281fba863434f553ce2))
15
+ * `Tabs` enable auto scroll when activeTab changed in scroll mode ([#116](https://github.com/arco-design/arco-design-mobile/issues/116)) ([07374f1](https://github.com/arco-design/arco-design-mobile/commit/07374f105f99418d447fc494c90d99d876601f9b))
16
+
17
+
18
+
19
+
20
+
21
+ ## [2.27.1](https://github.com/arco-design/arco-design-mobile/compare/@arco-design/mobile-react@2.27.0...@arco-design/mobile-react@2.27.1) (2023-04-26)
22
+
23
+
24
+ ### Bug Fixes
25
+
26
+ * `IndexBar` modify utils deps ([#115](https://github.com/arco-design/arco-design-mobile/issues/115)) ([b322d71](https://github.com/arco-design/arco-design-mobile/commit/b322d716e8dc6a107afb2a8b84edfcc0f5daddc2))
27
+
28
+
29
+
30
+
31
+
6
32
  # [2.27.0](https://github.com/arco-design/arco-design-mobile/compare/@arco-design/mobile-react@2.26.0...@arco-design/mobile-react@2.27.0) (2023-04-25)
7
33
 
8
34
 
package/README.en-US.md CHANGED
@@ -59,8 +59,8 @@ React & ReactDOM: **<a href="https://reactjs.org/docs/cdn-links.html" target="_b
59
59
  React Transition Group: **<a href="https://reactcommunity.org/react-transition-group/" target="_blank">Click here</a>**
60
60
 
61
61
  ```
62
- <link ref="stylesheet" href="https://unpkg.com/@arco-design/mobile-react@2.26.0/dist/style.min.css">
63
- <script src="https://unpkg.com/@arco-design/mobile-react@2.26.0/dist/index.min.js"></script>
62
+ <link ref="stylesheet" href="https://unpkg.com/@arco-design/mobile-react@2.27.1/dist/style.min.css">
63
+ <script src="https://unpkg.com/@arco-design/mobile-react@2.27.1/dist/index.min.js"></script>
64
64
  ```
65
65
 
66
66
  ## Full import
package/README.md CHANGED
@@ -59,8 +59,8 @@ React & ReactDOM: **<a href="https://reactjs.org/docs/cdn-links.html" target="
59
59
  React Transition Group: **<a href="https://reactcommunity.org/react-transition-group/" target="_blank">戳这里获取</a>**
60
60
 
61
61
  ```
62
- <link ref="stylesheet" href="https://unpkg.com/@arco-design/mobile-react@2.26.0/dist/style.min.css">
63
- <script src="https://unpkg.com/@arco-design/mobile-react@2.26.0/dist/index.min.js"></script>
62
+ <link ref="stylesheet" href="https://unpkg.com/@arco-design/mobile-react@2.27.1/dist/style.min.css">
63
+ <script src="https://unpkg.com/@arco-design/mobile-react@2.27.1/dist/index.min.js"></script>
64
64
  ```
65
65
 
66
66
  ## 引入全部
@@ -7,6 +7,7 @@ export * from './hooks';
7
7
  export * from './type';
8
8
  export * from './react-dom';
9
9
  export declare function getStyleWithVendor(style: CSSProperties): CSSProperties;
10
+ export declare function setStyleWithVendor(dom: HTMLElement, style: CSSProperties): void;
10
11
  /**
11
12
  * 计算默认值,仅未定义时使用默认值
12
13
  * @desc {en} Calculate the default value, use default value only if undefined
@@ -5,10 +5,12 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
5
5
  exports.__esModule = true;
6
6
  var _exportNames = {
7
7
  getStyleWithVendor: true,
8
+ setStyleWithVendor: true,
8
9
  getDefaultValue: true
9
10
  };
10
11
  exports.getDefaultValue = void 0;
11
12
  exports.getStyleWithVendor = getStyleWithVendor;
13
+ exports.setStyleWithVendor = setStyleWithVendor;
12
14
 
13
15
  var _extends3 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
14
16
 
@@ -55,6 +57,14 @@ function getStyleWithVendor(style) {
55
57
  }, {});
56
58
  return newStyle;
57
59
  }
60
+
61
+ function setStyleWithVendor(dom, style) {
62
+ var vendorStyle = getStyleWithVendor(style);
63
+
64
+ for (var key in vendorStyle) {
65
+ dom.style[key] = vendorStyle[key];
66
+ }
67
+ }
58
68
  /**
59
69
  * 计算默认值,仅未定义时使用默认值
60
70
  * @desc {en} Calculate the default value, use default value only if undefined
@@ -7,8 +7,6 @@ exports.default = void 0;
7
7
 
8
8
  var _mobileUtils = require("@arco-design/mobile-utils");
9
9
 
10
- var _utils = require("@arco-design/mobile-utils/utils");
11
-
12
10
  var _lodash = _interopRequireDefault(require("lodash.throttle"));
13
11
 
14
12
  var _react = _interopRequireWildcard(require("react"));
@@ -21,7 +19,7 @@ var _group = require("./group");
21
19
 
22
20
  var _sideBar = require("./side-bar");
23
21
 
24
- var _utils2 = require("./utils");
22
+ var _utils = require("./utils");
25
23
 
26
24
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
27
25
 
@@ -56,7 +54,7 @@ var IndexBar = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
56
54
 
57
55
  var containerRef = (0, _react.useRef)(null); // 过滤掉jsx写法中,奇怪的child
58
56
 
59
- var formatChildren = (0, _utils2.filterValidIndexBarChild)(children); // 所有的索引内容,优先从props.groups中获取,再从formatChildren中获取
57
+ var formatChildren = (0, _utils.filterValidIndexBarChild)(children); // 所有的索引内容,优先从props.groups中获取,再从formatChildren中获取
60
58
 
61
59
  var indexes = (0, _react.useMemo)(function () {
62
60
  if (groups.length) {
@@ -95,7 +93,7 @@ var IndexBar = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
95
93
 
96
94
  var handleChangeActiveIndex = function handleChangeActiveIndex(index, type) {
97
95
  setActiveIndex(function (oldActiveIndex) {
98
- var newActiveIndex = (0, _utils2.getFormatIndex)(index, oldActiveIndex); // 和上一次激活的acitveIndex不同,再触发onChange事件
96
+ var newActiveIndex = (0, _utils.getFormatIndex)(index, oldActiveIndex); // 和上一次激活的acitveIndex不同,再触发onChange事件
99
97
 
100
98
  if (newActiveIndex !== oldActiveIndex) {
101
99
  onChange == null ? void 0 : onChange(newActiveIndex, type);
@@ -115,12 +113,12 @@ var IndexBar = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
115
113
  var formatIndex = index != null ? index : indexes == null ? void 0 : indexes[0];
116
114
  var containerDom = containerRef.current;
117
115
 
118
- if (!(0, _utils2.isValidIndex)(index) || !containerDom) {
116
+ if (!(0, _utils.isValidIndex)(index) || !containerDom) {
119
117
  return;
120
118
  } // 寻找Index对应的groupDom
121
119
 
122
120
 
123
- var groupDom = (0, _utils2.getGroupDomFromIndex)(containerDom, formatIndex);
121
+ var groupDom = (0, _utils.getGroupDomFromIndex)(containerDom, formatIndex);
124
122
 
125
123
  if (groupDom) {
126
124
  handleChangeActiveIndex(formatIndex, type);
@@ -136,7 +134,7 @@ var IndexBar = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
136
134
  }
137
135
 
138
136
  if (duration > 0) {
139
- (0, _utils.scrollWithAnimation)(containerDom.scrollTop, targetScrollTop, function (top) {
137
+ (0, _mobileUtils.scrollWithAnimation)(containerDom.scrollTop, targetScrollTop, function (top) {
140
138
  return containerDom.scrollTop = top;
141
139
  }, duration, scrollBezier);
142
140
  } else {
@@ -149,7 +147,7 @@ var IndexBar = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
149
147
  return {
150
148
  dom: domRef.current,
151
149
  scrollToIndex: function scrollToIndex(index, rightNow) {
152
- if ((0, _utils2.isValidIndex)(index)) {
150
+ if ((0, _utils.isValidIndex)(index)) {
153
151
  handleScrollIntoIndex({
154
152
  index: index,
155
153
  rightNow: rightNow,
@@ -9,7 +9,7 @@ export interface IndexBarBaseData {
9
9
  */
10
10
  content: ReactNode;
11
11
  }
12
- interface IndexBarGroupItem<Data extends IndexBarBaseData> {
12
+ interface IndexBarGroupItem<Data extends IndexBarBaseData = IndexBarBaseData> {
13
13
  /**
14
14
  * IndexBarGroup对应的索引
15
15
  * @en Index corresponding to IndexBarGroup
@@ -39,7 +39,7 @@ export interface IndexBarSideBarProps {
39
39
  renderSideBar?: (Content: ReactNode) => ReactElement;
40
40
  renderTip?: (index: IndexBarIndexType) => ReactNode;
41
41
  }
42
- export interface IndexBarGroupProps<Data extends IndexBarBaseData> extends IndexBarGroupItem<Data> {
42
+ export interface IndexBarGroupProps<Data extends IndexBarBaseData = IndexBarBaseData> extends IndexBarGroupItem<Data> {
43
43
  /**
44
44
  * 自定义类名
45
45
  * @en Custom classname
@@ -78,7 +78,7 @@ export interface IndexBarGroupProps<Data extends IndexBarBaseData> extends Index
78
78
  }
79
79
  export interface IndexBarGroupRef extends BaseRef {
80
80
  }
81
- export interface IndexBarProps<Data extends IndexBarBaseData> {
81
+ export interface IndexBarProps<Data extends IndexBarBaseData = IndexBarBaseData> {
82
82
  /**
83
83
  * 自定义类名
84
84
  * @en Custom classname
@@ -75,11 +75,14 @@ var LoadMore = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
75
75
 
76
76
  changeStatus('loading', scene);
77
77
  getData == null ? void 0 : getData(function (st) {
78
- lastScrollEndRef.current = false;
79
78
  changeStatus(st, 'manual');
80
79
  });
81
80
  }, [blockWhenLoading, changeStatus, getData]);
82
81
  (0, _react.useEffect)(function () {
82
+ if (!blockWhenLoading || nowStatus !== 'loading') {
83
+ lastScrollEndRef.current = false;
84
+ }
85
+
83
86
  statusRef.current = nowStatus;
84
87
  }, [nowStatus]);
85
88
  (0, _helpers.useUpdateEffect)(function () {
@@ -146,7 +146,7 @@ var NavBar = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
146
146
  ref: navBarRef,
147
147
  className: (0, _mobileUtils.cls)(wrapClass, prefixCls + "-nav-bar", (_cls = {}, _cls[prefixCls + "-nav-bar-fixed"] = fixed, _cls[prefixCls + "-nav-bar-float"] = !placeholder, _cls[prefixCls + "-nav-bar-hide"] = scrollToggleHide, _cls)),
148
148
  style: (0, _extends2.default)({
149
- paddingTop: fixed && statusBarHeight ? statusBarHeight + "px" : ''
149
+ paddingTop: fixed && statusBarHeight ? statusBarHeight + "px" : '0px'
150
150
  }, style || {}, relBackground ? {
151
151
  background: relBackground
152
152
  } : {}),
@@ -155,7 +155,7 @@ var NavBar = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
155
155
  }, /*#__PURE__*/_react.default.createElement("div", {
156
156
  className: (0, _mobileUtils.cls)(className, system, prefixCls + "-nav-bar-wrapper", (_cls2 = {}, _cls2[prefixCls + "-nav-bar-wrapper-fixed"] = fixed, _cls2[prefixCls + "-nav-bar-wrapper-border"] = hasBottomLine, _cls2)),
157
157
  style: (0, _extends2.default)({
158
- paddingTop: statusBarHeight ? statusBarHeight + "px" : ''
158
+ paddingTop: statusBarHeight ? statusBarHeight + "px" : '0px'
159
159
  }, customStyle)
160
160
  }, /*#__PURE__*/_react.default.createElement("div", {
161
161
  className: prefixCls + "-nav-bar-inner all-border-box"
@@ -31,6 +31,18 @@ var wrapperNodeList = [];
31
31
 
32
32
  var listeners = {};
33
33
  var onOnceEmittedListeners = {};
34
+ /**
35
+ * Intersection Observer 同一 root 节点下的监听队列
36
+ * @en Intersection Observer Listening queue under the same root node
37
+ */
38
+
39
+ var ioListeners = [];
40
+ /**
41
+ * Intersection Observer 监听 visible 状态队列
42
+ * @en Intersection Observer listens to the visible status queue
43
+ */
44
+
45
+ var ioVisibleList = [];
34
46
  var throttlingVisibleChange;
35
47
  /**
36
48
  * 通过滚动事件监测 children 是否进入视口或离开视口。
@@ -78,12 +90,6 @@ var ShowMonitor = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
78
90
  */
79
91
 
80
92
  var domRefParent = (0, _react.useRef)(null);
81
- /**
82
- * 当前元素是否在可视区域内
83
- * @en Whether the current element is in the visible area
84
- */
85
-
86
- var isVisible = (0, _react.useRef)(false);
87
93
  /**
88
94
  * 保存当前节点信息,类似于 class component 中 this
89
95
  * @en Save current node information, similar to this in class component
@@ -130,10 +136,8 @@ var ShowMonitor = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
130
136
  * @en Reset the initial visible state of the element to false, and re-detect the visibility of the element, the priority is lower than 'disabled'(Usually used to re-listen when elements inside ShowMonitor change)
131
137
  */
132
138
  flushVisibleStatus: function flushVisibleStatus() {
133
- isVisible.current = false;
134
-
135
- if (isSupportNativeApi && io.current && domRef.current) {
136
- disabled ? io.current.unobserve(domRef.current) : io.current.observe(domRef.current);
139
+ if (isSupportNativeApi) {
140
+ disabled ? ioUnobserve() : ioObserve();
137
141
  } else if (listener.current) {
138
142
  var _key = wrapperKey.current;
139
143
 
@@ -197,7 +201,7 @@ var ShowMonitor = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
197
201
  */
198
202
 
199
203
 
200
- curVisible !== preVisible.current && handleCheckChildrenExist() && onCompVisibleChange(curVisible, node);
204
+ curVisible !== preVisible && handleCheckChildrenExist() && onCompVisibleChange(curVisible, node);
201
205
  var key = wrapperKey.current;
202
206
  /**
203
207
  * 监听一次后加入 pendingList 队列,随后被 listeners 过滤掉
@@ -213,8 +217,7 @@ var ShowMonitor = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
213
217
  */
214
218
 
215
219
 
216
- curVisible && !preVisible.current && compOnce && onOnceEmittedListeners[key].push(component);
217
- preVisible.current = curVisible;
220
+ curVisible && !preVisible && compOnce && onOnceEmittedListeners[key].push(component);
218
221
  }
219
222
 
220
223
  var checkVisibleHandler = (0, _react.useCallback)(function () {
@@ -234,22 +237,98 @@ var ShowMonitor = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
234
237
  }
235
238
 
236
239
  function handleObserverStatusChange(entries) {
237
- var _io$current;
240
+ entries.forEach(function (entry) {
241
+ var isIntersecting = entry.isIntersecting,
242
+ target = entry.target;
243
+ var visibleItem = ioVisibleList.find(function (item) {
244
+ return item.node === target;
245
+ });
238
246
 
239
- var isIntersecting = entries[0].isIntersecting;
240
- /**
241
- * 当前元素 visible 对比之前发生改变,触发回调函数
242
- * @en Callback when the visible status of current element changes before the comparison
243
- */
247
+ if (visibleItem) {
248
+ var curVisible = visibleItem.isVisible,
249
+ onCompVisibleChange = visibleItem.onVisibleChange,
250
+ onceEmit = visibleItem.once;
251
+ /**
252
+ * 当前元素 visible 对比之前发生改变,触发回调函数
253
+ * @en Callback when the visible status of current element changes before the comparison
254
+ */
255
+
256
+ isIntersecting !== curVisible && handleCheckChildrenExist() && onCompVisibleChange(isIntersecting, target);
257
+ /**
258
+ * 当前元素状态由不可见变为可见,且只触发一次
259
+ * @en The current element is invisible -> visible, and once, triggers the callback
260
+ */
261
+
262
+ isIntersecting && !curVisible && onceEmit && target && ioUnobserve(target);
263
+ visibleItem.isVisible = isIntersecting;
264
+ }
265
+ });
266
+ }
267
+ /**
268
+ * 获取 io 单例
269
+ * @en Get the io singleton
270
+ */
244
271
 
245
- isIntersecting !== isVisible.current && handleCheckChildrenExist() && onVisibleChange(isIntersecting, domRef.current);
246
- /**
247
- * 当前元素不可见 -> 可见,且 once, 触发回调函数
248
- * @en The current element is invisible -> visible, and once, triggers the callback
249
- */
250
272
 
251
- isIntersecting && !isVisible.current && once && domRef.current && ((_io$current = io.current) == null ? void 0 : _io$current.unobserve(domRef.current));
252
- isVisible.current = isIntersecting;
273
+ function getIOSingleton(ioOptions) {
274
+ var root = ioOptions.root,
275
+ rootMargin = ioOptions.rootMargin,
276
+ ioThreshold = ioOptions.threshold;
277
+ var ioKey = JSON.stringify({
278
+ rootMargin: rootMargin,
279
+ threshold: ioThreshold
280
+ });
281
+
282
+ var _ioListener = ioListeners.find(function (ioListener) {
283
+ return ioListener.root === root && ioListener.key === ioKey;
284
+ });
285
+
286
+ if (!_ioListener) {
287
+ ioListeners.push({
288
+ root: root,
289
+ key: ioKey,
290
+ listener: io.current = new IntersectionObserver(handleObserverStatusChange, ioOptions)
291
+ });
292
+ } else {
293
+ io.current = _ioListener.listener;
294
+ }
295
+ }
296
+
297
+ function ioObserve() {
298
+ if (domRef.current && io.current) {
299
+ var curIdx = ioVisibleList.findIndex(function (ioVisibleItem) {
300
+ return ioVisibleItem.node === domRef.current;
301
+ });
302
+
303
+ if (curIdx !== -1) {
304
+ ioVisibleList[curIdx].isVisible = false;
305
+ } else {
306
+ ioVisibleList.push({
307
+ node: domRef.current,
308
+ isVisible: false,
309
+ once: once,
310
+ onVisibleChange: onVisibleChange
311
+ });
312
+ }
313
+
314
+ io.current.observe(domRef.current);
315
+ }
316
+ }
317
+
318
+ function ioUnobserve(target) {
319
+ var targetNode = target || domRef.current;
320
+
321
+ if (io.current && targetNode) {
322
+ var curIdx = ioVisibleList.findIndex(function (ioVisibleItem) {
323
+ return ioVisibleItem.node === targetNode;
324
+ });
325
+
326
+ if (curIdx !== -1) {
327
+ ioVisibleList.splice(curIdx, 1);
328
+ }
329
+
330
+ io.current.unobserve(targetNode);
331
+ }
253
332
  }
254
333
  /**
255
334
  * 非首次下disabled变化时,重新监听元素
@@ -259,14 +338,11 @@ var ShowMonitor = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
259
338
 
260
339
  (0, _react.useEffect)(function () {
261
340
  if (isSupportNativeApi) {
262
- // 非首次下
341
+ // 非首次 render 下
263
342
  // @en Not for the first time
264
- if (io.current && domRef.current) {
265
- // 禁用监听 || 监听
266
- disabled ? io.current.unobserve(domRef.current) : io.current.observe(domRef.current);
267
- }
343
+ disabled ? ioUnobserve() : ioObserve();
268
344
  } else {
269
- // 非首次下
345
+ // 非首次 render 下
270
346
  // @en Not for the first time
271
347
  if (wrapperKey.current !== -1 && listener.current && listeners[wrapperKey.current]) {
272
348
  // 禁用监听,找到对应listener并删除
@@ -330,12 +406,12 @@ var ShowMonitor = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
330
406
  rootMargin = offset + "px";
331
407
  }
332
408
 
333
- io.current = new IntersectionObserver(handleObserverStatusChange, {
409
+ getIOSingleton({
334
410
  root: root,
335
411
  rootMargin: rootMargin,
336
412
  threshold: threshold
337
413
  });
338
- !disabled && io.current.observe(domRef.current);
414
+ !disabled && ioObserve();
339
415
  }
340
416
  } else {
341
417
  // 节流后回调函数
@@ -379,7 +455,7 @@ var ShowMonitor = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
379
455
 
380
456
  listener.current = {
381
457
  node: domRef.current,
382
- isVisible: isVisible,
458
+ isVisible: false,
383
459
  overflow: overflow,
384
460
  once: once,
385
461
  offset: offset,
@@ -396,9 +472,7 @@ var ShowMonitor = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
396
472
  (0, _react.useEffect)(function () {
397
473
  return function () {
398
474
  if (isSupportNativeApi) {
399
- var _io$current2;
400
-
401
- domRef.current && ((_io$current2 = io.current) == null ? void 0 : _io$current2.unobserve(domRef.current));
475
+ ioUnobserve();
402
476
  } else {
403
477
  if (overflow) {
404
478
  var parent = domRefParent.current;
@@ -2,6 +2,9 @@
2
2
  width: 100%;
3
3
  background: #e5e6eb ;
4
4
  }
5
+ #demo-swipe-load .list-container::-webkit-scrollbar {
6
+ display: none;
7
+ }
5
8
  #demo-swipe-load .course-list {
6
9
  display: -webkit-inline-box;
7
10
  display: -webkit-inline-flex;
@@ -4,36 +4,47 @@
4
4
  .list-container {
5
5
  width: 100%;
6
6
  .use-var(background, line-color);
7
+
8
+ &::-webkit-scrollbar {
9
+ display: none;
10
+ }
7
11
  }
12
+
8
13
  .course-list {
9
14
  display: inline-flex;
10
15
  align-items: flex-start;
11
16
  padding: 12px 0;
12
17
  }
18
+
13
19
  .list-item,
14
20
  .list-item-color {
15
21
  height: 72px;
16
22
  margin-right: 10px;
17
23
  .use-var(background, background-color);
18
24
  }
25
+
19
26
  .list-item-color {
20
27
  .use-var(background, primary-disabled-color);
21
28
  }
29
+
22
30
  .mylabel-start,
23
31
  .mylabel-end {
24
32
  width: 100px;
25
33
  height: 96px;
26
34
  transition: background 0.2s;
27
35
  .use-var(background, background-color);
36
+
28
37
  &.end {
29
38
  .use-var(background, line-color);
30
39
  }
31
40
  }
41
+
32
42
  .mylabel-single {
33
43
  width: 100px;
34
44
  height: 88px;
35
45
  .use-var(background, primary-disabled-color);
36
46
  }
47
+
37
48
  .single-element {
38
49
  height: 88px;
39
50
  .use-var(background, primary-disabled-color);