@sheinx/base 3.7.8-beta.6 → 3.7.8-beta.7

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.
@@ -1 +1 @@
1
- {"version":3,"file":"virtual-scroll-list.d.ts","sourceRoot":"","sources":["virtual-scroll-list.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AAE9D,QAAA,MAAM,WAAW,0FAoQhB,CAAC;AAEF,eAAe,WAAW,CAAC"}
1
+ {"version":3,"file":"virtual-scroll-list.d.ts","sourceRoot":"","sources":["virtual-scroll-list.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AAE9D,QAAA,MAAM,WAAW,0FAwQhB,CAAC;AAEF,eAAe,WAAW,CAAC"}
@@ -68,7 +68,8 @@ var VirtualList = function VirtualList(props) {
68
68
  preIndex: null,
69
69
  topTimer: null,
70
70
  rateTimer: null,
71
- shouldUpdateHeight: true
71
+ shouldUpdateHeight: true,
72
+ prevWrapperRefHeight: 0
72
73
  }),
73
74
  context = _useRef.current;
74
75
  var getContentHeight = function getContentHeight(index) {
@@ -228,11 +229,14 @@ var VirtualList = function VirtualList(props) {
228
229
  context.preIndex = startIndex;
229
230
  }, [startIndex]);
230
231
  (0, _react.useLayoutEffect)(function () {
231
- if (keepScrollHeight) return;
232
+ var _wrapperRef$current2;
233
+ var currentWrapperRefHeight = ((_wrapperRef$current2 = wrapperRef.current) === null || _wrapperRef$current2 === void 0 ? void 0 : _wrapperRef$current2.clientHeight) || 0;
234
+ if (keepScrollHeight && currentWrapperRefHeight === context.prevWrapperRefHeight) return;
232
235
  if (keepScrollTop) return;
233
236
  // 数据变化的时候清空掉 preIndex, 如果之前有缓存的index, setRowHeight 会有问题
234
237
  setTop(0);
235
238
  setStartIndex(0);
239
+ context.prevWrapperRefHeight = currentWrapperRefHeight;
236
240
  return function () {
237
241
  context.preIndex = null;
238
242
  };
@@ -1 +1 @@
1
- {"version":3,"file":"virtual-scroll-list.d.ts","sourceRoot":"","sources":["virtual-scroll-list.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AAE9D,QAAA,MAAM,WAAW,0FAoQhB,CAAC;AAEF,eAAe,WAAW,CAAC"}
1
+ {"version":3,"file":"virtual-scroll-list.d.ts","sourceRoot":"","sources":["virtual-scroll-list.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AAE9D,QAAA,MAAM,WAAW,0FAwQhB,CAAC;AAEF,eAAe,WAAW,CAAC"}
@@ -59,7 +59,8 @@ var VirtualList = function VirtualList(props) {
59
59
  preIndex: null,
60
60
  topTimer: null,
61
61
  rateTimer: null,
62
- shouldUpdateHeight: true
62
+ shouldUpdateHeight: true,
63
+ prevWrapperRefHeight: 0
63
64
  }),
64
65
  context = _useRef.current;
65
66
  var getContentHeight = function getContentHeight(index) {
@@ -219,11 +220,14 @@ var VirtualList = function VirtualList(props) {
219
220
  context.preIndex = startIndex;
220
221
  }, [startIndex]);
221
222
  useLayoutEffect(function () {
222
- if (keepScrollHeight) return;
223
+ var _wrapperRef$current2;
224
+ var currentWrapperRefHeight = ((_wrapperRef$current2 = wrapperRef.current) === null || _wrapperRef$current2 === void 0 ? void 0 : _wrapperRef$current2.clientHeight) || 0;
225
+ if (keepScrollHeight && currentWrapperRefHeight === context.prevWrapperRefHeight) return;
223
226
  if (keepScrollTop) return;
224
227
  // 数据变化的时候清空掉 preIndex, 如果之前有缓存的index, setRowHeight 会有问题
225
228
  setTop(0);
226
229
  setStartIndex(0);
230
+ context.prevWrapperRefHeight = currentWrapperRefHeight;
227
231
  return function () {
228
232
  context.preIndex = null;
229
233
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sheinx/base",
3
- "version": "3.7.8-beta.6",
3
+ "version": "3.7.8-beta.7",
4
4
  "description": "",
5
5
  "keywords": [],
6
6
  "license": "MIT",
@@ -10,7 +10,7 @@
10
10
  "module": "./esm/index.js",
11
11
  "typings": "./cjs/index.d.ts",
12
12
  "dependencies": {
13
- "@sheinx/hooks": "3.7.8-beta.6",
13
+ "@sheinx/hooks": "3.7.8-beta.7",
14
14
  "immer": "^10.0.0",
15
15
  "classnames": "^2.0.0",
16
16
  "@shined/reactive": "^0.1.3-alpha.0"