@legendapp/list 2.0.10 → 2.0.12
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.
- package/CHANGELOG.md +7 -0
- package/animated.d.mts +2 -2
- package/animated.d.ts +2 -2
- package/index.d.mts +1 -0
- package/index.d.ts +1 -0
- package/index.js +132 -126
- package/index.mjs +77 -71
- package/package.json +1 -1
- package/reanimated.d.mts +5 -4
- package/reanimated.d.ts +5 -4
- package/reanimated.js +24 -6
- package/reanimated.mjs +2 -1
package/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var React2 = require('react');
|
|
4
4
|
var reactNative = require('react-native');
|
|
5
5
|
var shim = require('use-sync-external-store/shim');
|
|
6
6
|
|
|
@@ -22,12 +22,12 @@ function _interopNamespace(e) {
|
|
|
22
22
|
return Object.freeze(n);
|
|
23
23
|
}
|
|
24
24
|
|
|
25
|
-
var
|
|
25
|
+
var React2__namespace = /*#__PURE__*/_interopNamespace(React2);
|
|
26
26
|
|
|
27
27
|
// src/components/LegendList.tsx
|
|
28
|
-
var ContextState =
|
|
28
|
+
var ContextState = React2__namespace.createContext(null);
|
|
29
29
|
function StateProvider({ children }) {
|
|
30
|
-
const [value] =
|
|
30
|
+
const [value] = React2__namespace.useState(() => ({
|
|
31
31
|
animatedScrollY: new reactNative.Animated.Value(0),
|
|
32
32
|
columnWrapperStyle: void 0,
|
|
33
33
|
internalState: void 0,
|
|
@@ -46,10 +46,10 @@ function StateProvider({ children }) {
|
|
|
46
46
|
]),
|
|
47
47
|
viewRefs: /* @__PURE__ */ new Map()
|
|
48
48
|
}));
|
|
49
|
-
return /* @__PURE__ */
|
|
49
|
+
return /* @__PURE__ */ React2__namespace.createElement(ContextState.Provider, { value }, children);
|
|
50
50
|
}
|
|
51
51
|
function useStateContext() {
|
|
52
|
-
return
|
|
52
|
+
return React2__namespace.useContext(ContextState);
|
|
53
53
|
}
|
|
54
54
|
function createSelectorFunctionsArr(ctx, signalNames) {
|
|
55
55
|
let lastValues = [];
|
|
@@ -119,23 +119,23 @@ function getContentSize(ctx) {
|
|
|
119
119
|
return headerSize + footerSize + totalSize + stylePaddingTop;
|
|
120
120
|
}
|
|
121
121
|
function useArr$(signalNames) {
|
|
122
|
-
const ctx =
|
|
123
|
-
const { subscribe, get } =
|
|
122
|
+
const ctx = React2__namespace.useContext(ContextState);
|
|
123
|
+
const { subscribe, get } = React2__namespace.useMemo(() => createSelectorFunctionsArr(ctx, signalNames), [ctx, signalNames]);
|
|
124
124
|
const value = shim.useSyncExternalStore(subscribe, get);
|
|
125
125
|
return value;
|
|
126
126
|
}
|
|
127
127
|
function useSelector$(signalName, selector) {
|
|
128
|
-
const ctx =
|
|
129
|
-
const { subscribe, get } =
|
|
128
|
+
const ctx = React2__namespace.useContext(ContextState);
|
|
129
|
+
const { subscribe, get } = React2__namespace.useMemo(() => createSelectorFunctionsArr(ctx, [signalName]), [ctx, signalName]);
|
|
130
130
|
const value = shim.useSyncExternalStore(subscribe, () => selector(get()[0]));
|
|
131
131
|
return value;
|
|
132
132
|
}
|
|
133
133
|
|
|
134
134
|
// src/components/DebugView.tsx
|
|
135
135
|
var DebugRow = ({ children }) => {
|
|
136
|
-
return /* @__PURE__ */
|
|
136
|
+
return /* @__PURE__ */ React2__namespace.createElement(reactNative.View, { style: { alignItems: "center", flexDirection: "row", justifyContent: "space-between" } }, children);
|
|
137
137
|
};
|
|
138
|
-
var DebugView =
|
|
138
|
+
var DebugView = React2__namespace.memo(function DebugView2({ state }) {
|
|
139
139
|
const ctx = useStateContext();
|
|
140
140
|
const [totalSize = 0, scrollAdjust = 0, rawScroll = 0, scroll = 0, _numContainers = 0, _numContainersPooled = 0] = useArr$([
|
|
141
141
|
"totalSize",
|
|
@@ -146,11 +146,11 @@ var DebugView = React3__namespace.memo(function DebugView2({ state }) {
|
|
|
146
146
|
"numContainersPooled"
|
|
147
147
|
]);
|
|
148
148
|
const contentSize = getContentSize(ctx);
|
|
149
|
-
const [, forceUpdate] =
|
|
149
|
+
const [, forceUpdate] = React2.useReducer((x) => x + 1, 0);
|
|
150
150
|
useInterval(() => {
|
|
151
151
|
forceUpdate();
|
|
152
152
|
}, 100);
|
|
153
|
-
return /* @__PURE__ */
|
|
153
|
+
return /* @__PURE__ */ React2__namespace.createElement(
|
|
154
154
|
reactNative.View,
|
|
155
155
|
{
|
|
156
156
|
pointerEvents: "none",
|
|
@@ -166,18 +166,18 @@ var DebugView = React3__namespace.memo(function DebugView2({ state }) {
|
|
|
166
166
|
top: 0
|
|
167
167
|
}
|
|
168
168
|
},
|
|
169
|
-
/* @__PURE__ */
|
|
170
|
-
/* @__PURE__ */
|
|
171
|
-
/* @__PURE__ */
|
|
172
|
-
/* @__PURE__ */
|
|
173
|
-
/* @__PURE__ */
|
|
174
|
-
/* @__PURE__ */
|
|
175
|
-
/* @__PURE__ */
|
|
176
|
-
/* @__PURE__ */
|
|
169
|
+
/* @__PURE__ */ React2__namespace.createElement(DebugRow, null, /* @__PURE__ */ React2__namespace.createElement(reactNative.Text, null, "TotalSize:"), /* @__PURE__ */ React2__namespace.createElement(reactNative.Text, null, totalSize.toFixed(2))),
|
|
170
|
+
/* @__PURE__ */ React2__namespace.createElement(DebugRow, null, /* @__PURE__ */ React2__namespace.createElement(reactNative.Text, null, "ContentSize:"), /* @__PURE__ */ React2__namespace.createElement(reactNative.Text, null, contentSize.toFixed(2))),
|
|
171
|
+
/* @__PURE__ */ React2__namespace.createElement(DebugRow, null, /* @__PURE__ */ React2__namespace.createElement(reactNative.Text, null, "At end:"), /* @__PURE__ */ React2__namespace.createElement(reactNative.Text, null, String(state.isAtEnd))),
|
|
172
|
+
/* @__PURE__ */ React2__namespace.createElement(reactNative.Text, null),
|
|
173
|
+
/* @__PURE__ */ React2__namespace.createElement(DebugRow, null, /* @__PURE__ */ React2__namespace.createElement(reactNative.Text, null, "ScrollAdjust:"), /* @__PURE__ */ React2__namespace.createElement(reactNative.Text, null, scrollAdjust.toFixed(2))),
|
|
174
|
+
/* @__PURE__ */ React2__namespace.createElement(reactNative.Text, null),
|
|
175
|
+
/* @__PURE__ */ React2__namespace.createElement(DebugRow, null, /* @__PURE__ */ React2__namespace.createElement(reactNative.Text, null, "RawScroll: "), /* @__PURE__ */ React2__namespace.createElement(reactNative.Text, null, rawScroll.toFixed(2))),
|
|
176
|
+
/* @__PURE__ */ React2__namespace.createElement(DebugRow, null, /* @__PURE__ */ React2__namespace.createElement(reactNative.Text, null, "ComputedScroll: "), /* @__PURE__ */ React2__namespace.createElement(reactNative.Text, null, scroll.toFixed(2)))
|
|
177
177
|
);
|
|
178
178
|
});
|
|
179
179
|
function useInterval(callback, delay) {
|
|
180
|
-
|
|
180
|
+
React2.useEffect(() => {
|
|
181
181
|
const interval = setInterval(callback, delay);
|
|
182
182
|
return () => clearInterval(interval);
|
|
183
183
|
}, [delay]);
|
|
@@ -189,7 +189,7 @@ var ENABLE_DEVMODE = __DEV__ && false;
|
|
|
189
189
|
var ENABLE_DEBUG_VIEW = __DEV__ && false;
|
|
190
190
|
var IsNewArchitecture = global.nativeFabricUIManager != null;
|
|
191
191
|
var useAnimatedValue = (initialValue) => {
|
|
192
|
-
return
|
|
192
|
+
return React2.useRef(new reactNative.Animated.Value(initialValue)).current;
|
|
193
193
|
};
|
|
194
194
|
|
|
195
195
|
// src/hooks/useValue$.ts
|
|
@@ -198,7 +198,7 @@ function useValue$(key, params) {
|
|
|
198
198
|
const { getValue, delay } = params || {};
|
|
199
199
|
const ctx = useStateContext();
|
|
200
200
|
const animValue = useAnimatedValue((_a = getValue ? getValue(peek$(ctx, key)) : peek$(ctx, key)) != null ? _a : 0);
|
|
201
|
-
|
|
201
|
+
React2.useMemo(() => {
|
|
202
202
|
let newValue;
|
|
203
203
|
let prevValue;
|
|
204
204
|
let didQueueTask = false;
|
|
@@ -230,8 +230,8 @@ function useValue$(key, params) {
|
|
|
230
230
|
}, []);
|
|
231
231
|
return animValue;
|
|
232
232
|
}
|
|
233
|
-
var typedForwardRef =
|
|
234
|
-
var typedMemo =
|
|
233
|
+
var typedForwardRef = React2.forwardRef;
|
|
234
|
+
var typedMemo = React2.memo;
|
|
235
235
|
|
|
236
236
|
// src/components/PositionView.tsx
|
|
237
237
|
var PositionViewState = typedMemo(function PositionView({
|
|
@@ -242,7 +242,7 @@ var PositionViewState = typedMemo(function PositionView({
|
|
|
242
242
|
...rest
|
|
243
243
|
}) {
|
|
244
244
|
const [position = POSITION_OUT_OF_VIEW] = useArr$([`containerPosition${id}`]);
|
|
245
|
-
return /* @__PURE__ */
|
|
245
|
+
return /* @__PURE__ */ React2__namespace.createElement(
|
|
246
246
|
reactNative.View,
|
|
247
247
|
{
|
|
248
248
|
ref: refView,
|
|
@@ -270,7 +270,7 @@ var PositionViewAnimated = typedMemo(function PositionView2({
|
|
|
270
270
|
} else {
|
|
271
271
|
position = horizontal ? { left: position$ } : { top: position$ };
|
|
272
272
|
}
|
|
273
|
-
return /* @__PURE__ */
|
|
273
|
+
return /* @__PURE__ */ React2__namespace.createElement(reactNative.Animated.View, { ref: refView, style: [style, position], ...rest });
|
|
274
274
|
});
|
|
275
275
|
var PositionViewSticky = typedMemo(function PositionViewSticky2({
|
|
276
276
|
id,
|
|
@@ -283,7 +283,7 @@ var PositionViewSticky = typedMemo(function PositionViewSticky2({
|
|
|
283
283
|
...rest
|
|
284
284
|
}) {
|
|
285
285
|
const [position = POSITION_OUT_OF_VIEW, headerSize] = useArr$([`containerPosition${id}`, "headerSize"]);
|
|
286
|
-
const transform =
|
|
286
|
+
const transform = React2__namespace.useMemo(() => {
|
|
287
287
|
if (animatedScrollY && stickyOffset !== void 0) {
|
|
288
288
|
const stickyPosition = animatedScrollY.interpolate({
|
|
289
289
|
extrapolate: "clamp",
|
|
@@ -293,13 +293,13 @@ var PositionViewSticky = typedMemo(function PositionViewSticky2({
|
|
|
293
293
|
return horizontal ? [{ translateX: stickyPosition }] : [{ translateY: stickyPosition }];
|
|
294
294
|
}
|
|
295
295
|
}, [animatedScrollY, headerSize, horizontal, stickyOffset, position]);
|
|
296
|
-
const viewStyle =
|
|
297
|
-
return /* @__PURE__ */
|
|
296
|
+
const viewStyle = React2__namespace.useMemo(() => [style, { zIndex: index + 1e3 }, { transform }], [style, transform]);
|
|
297
|
+
return /* @__PURE__ */ React2__namespace.createElement(reactNative.Animated.View, { ref: refView, style: viewStyle, ...rest });
|
|
298
298
|
});
|
|
299
299
|
var PositionView3 = IsNewArchitecture ? PositionViewState : PositionViewAnimated;
|
|
300
300
|
var symbolFirst = Symbol();
|
|
301
301
|
function useInit(cb) {
|
|
302
|
-
const refValue =
|
|
302
|
+
const refValue = React2.useRef(symbolFirst);
|
|
303
303
|
if (refValue.current === symbolFirst) {
|
|
304
304
|
refValue.current = cb();
|
|
305
305
|
}
|
|
@@ -338,10 +338,10 @@ function extractPadding(style, contentContainerStyle, type) {
|
|
|
338
338
|
}
|
|
339
339
|
|
|
340
340
|
// src/state/ContextContainer.ts
|
|
341
|
-
var ContextContainer =
|
|
341
|
+
var ContextContainer = React2.createContext(null);
|
|
342
342
|
function useViewability(callback, configId) {
|
|
343
343
|
const ctx = useStateContext();
|
|
344
|
-
const { containerId } =
|
|
344
|
+
const { containerId } = React2.useContext(ContextContainer);
|
|
345
345
|
const key = containerId + (configId != null ? configId : "");
|
|
346
346
|
useInit(() => {
|
|
347
347
|
const value = ctx.mapViewabilityValues.get(key);
|
|
@@ -350,7 +350,7 @@ function useViewability(callback, configId) {
|
|
|
350
350
|
}
|
|
351
351
|
});
|
|
352
352
|
ctx.mapViewabilityCallbacks.set(key, callback);
|
|
353
|
-
|
|
353
|
+
React2.useEffect(
|
|
354
354
|
() => () => {
|
|
355
355
|
ctx.mapViewabilityCallbacks.delete(key);
|
|
356
356
|
},
|
|
@@ -359,7 +359,7 @@ function useViewability(callback, configId) {
|
|
|
359
359
|
}
|
|
360
360
|
function useViewabilityAmount(callback) {
|
|
361
361
|
const ctx = useStateContext();
|
|
362
|
-
const { containerId } =
|
|
362
|
+
const { containerId } = React2.useContext(ContextContainer);
|
|
363
363
|
useInit(() => {
|
|
364
364
|
const value = ctx.mapViewabilityAmountValues.get(containerId);
|
|
365
365
|
if (value) {
|
|
@@ -367,7 +367,7 @@ function useViewabilityAmount(callback) {
|
|
|
367
367
|
}
|
|
368
368
|
});
|
|
369
369
|
ctx.mapViewabilityAmountCallbacks.set(containerId, callback);
|
|
370
|
-
|
|
370
|
+
React2.useEffect(
|
|
371
371
|
() => () => {
|
|
372
372
|
ctx.mapViewabilityAmountCallbacks.delete(containerId);
|
|
373
373
|
},
|
|
@@ -375,12 +375,12 @@ function useViewabilityAmount(callback) {
|
|
|
375
375
|
);
|
|
376
376
|
}
|
|
377
377
|
function useRecyclingEffect(effect) {
|
|
378
|
-
const { index, value } =
|
|
379
|
-
const prevValues =
|
|
378
|
+
const { index, value } = React2.useContext(ContextContainer);
|
|
379
|
+
const prevValues = React2.useRef({
|
|
380
380
|
prevIndex: void 0,
|
|
381
381
|
prevItem: void 0
|
|
382
382
|
});
|
|
383
|
-
|
|
383
|
+
React2.useEffect(() => {
|
|
384
384
|
let ret;
|
|
385
385
|
if (prevValues.current.prevIndex !== void 0 && prevValues.current.prevItem !== void 0) {
|
|
386
386
|
ret = effect({
|
|
@@ -398,12 +398,12 @@ function useRecyclingEffect(effect) {
|
|
|
398
398
|
}, [index, value, effect]);
|
|
399
399
|
}
|
|
400
400
|
function useRecyclingState(valueOrFun) {
|
|
401
|
-
const { index, value, itemKey, triggerLayout } =
|
|
402
|
-
const refState =
|
|
401
|
+
const { index, value, itemKey, triggerLayout } = React2.useContext(ContextContainer);
|
|
402
|
+
const refState = React2.useRef({
|
|
403
403
|
itemKey: null,
|
|
404
404
|
value: null
|
|
405
405
|
});
|
|
406
|
-
const [_, setRenderNum] =
|
|
406
|
+
const [_, setRenderNum] = React2.useState(0);
|
|
407
407
|
const state = refState.current;
|
|
408
408
|
if (state.itemKey !== itemKey) {
|
|
409
409
|
state.itemKey = itemKey;
|
|
@@ -414,7 +414,7 @@ function useRecyclingState(valueOrFun) {
|
|
|
414
414
|
prevItem: void 0
|
|
415
415
|
}) : valueOrFun;
|
|
416
416
|
}
|
|
417
|
-
const setState =
|
|
417
|
+
const setState = React2.useCallback(
|
|
418
418
|
(newState) => {
|
|
419
419
|
state.value = isFunction(newState) ? newState(state.value) : newState;
|
|
420
420
|
setRenderNum((v) => v + 1);
|
|
@@ -425,7 +425,7 @@ function useRecyclingState(valueOrFun) {
|
|
|
425
425
|
return [state.value, setState];
|
|
426
426
|
}
|
|
427
427
|
function useIsLastItem() {
|
|
428
|
-
const { itemKey } =
|
|
428
|
+
const { itemKey } = React2.useContext(ContextContainer);
|
|
429
429
|
const isLast = useSelector$("lastItemKeys", (lastItemKeys) => (lastItemKeys == null ? void 0 : lastItemKeys.includes(itemKey)) || false);
|
|
430
430
|
return isLast;
|
|
431
431
|
}
|
|
@@ -437,7 +437,7 @@ var noop = () => {
|
|
|
437
437
|
};
|
|
438
438
|
function useSyncLayout() {
|
|
439
439
|
if (IsNewArchitecture) {
|
|
440
|
-
const { triggerLayout: syncLayout } =
|
|
440
|
+
const { triggerLayout: syncLayout } = React2.useContext(ContextContainer);
|
|
441
441
|
return syncLayout;
|
|
442
442
|
} else {
|
|
443
443
|
return noop;
|
|
@@ -447,14 +447,14 @@ function useSyncLayout() {
|
|
|
447
447
|
// src/components/Separator.tsx
|
|
448
448
|
function Separator({ ItemSeparatorComponent, leadingItem }) {
|
|
449
449
|
const isLastItem = useIsLastItem();
|
|
450
|
-
return isLastItem ? null : /* @__PURE__ */
|
|
450
|
+
return isLastItem ? null : /* @__PURE__ */ React2__namespace.createElement(ItemSeparatorComponent, { leadingItem });
|
|
451
451
|
}
|
|
452
452
|
function useOnLayoutSync({
|
|
453
453
|
ref,
|
|
454
454
|
onLayoutProp,
|
|
455
455
|
onLayoutChange
|
|
456
456
|
}, deps = []) {
|
|
457
|
-
const onLayout =
|
|
457
|
+
const onLayout = React2.useCallback(
|
|
458
458
|
(event) => {
|
|
459
459
|
onLayoutChange(event.nativeEvent.layout, false);
|
|
460
460
|
onLayoutProp == null ? void 0 : onLayoutProp(event);
|
|
@@ -462,7 +462,7 @@ function useOnLayoutSync({
|
|
|
462
462
|
[onLayoutChange]
|
|
463
463
|
);
|
|
464
464
|
if (IsNewArchitecture) {
|
|
465
|
-
|
|
465
|
+
React2.useLayoutEffect(() => {
|
|
466
466
|
if (ref.current) {
|
|
467
467
|
ref.current.measure((x, y, width, height) => {
|
|
468
468
|
onLayoutChange({ height, width, x, y }, true);
|
|
@@ -493,13 +493,13 @@ var Container = typedMemo(function Container2({
|
|
|
493
493
|
`containerSticky${id}`,
|
|
494
494
|
`containerStickyOffset${id}`
|
|
495
495
|
]);
|
|
496
|
-
const refLastSize =
|
|
497
|
-
const ref =
|
|
498
|
-
const [layoutRenderCount, forceLayoutRender] =
|
|
496
|
+
const refLastSize = React2.useRef();
|
|
497
|
+
const ref = React2.useRef(null);
|
|
498
|
+
const [layoutRenderCount, forceLayoutRender] = React2.useState(0);
|
|
499
499
|
const otherAxisPos = numColumns > 1 ? `${(column - 1) / numColumns * 100}%` : 0;
|
|
500
500
|
const otherAxisSize = numColumns > 1 ? `${1 / numColumns * 100}%` : void 0;
|
|
501
|
-
const didLayoutRef =
|
|
502
|
-
const style =
|
|
501
|
+
const didLayoutRef = React2.useRef(false);
|
|
502
|
+
const style = React2.useMemo(() => {
|
|
503
503
|
let paddingStyles;
|
|
504
504
|
if (columnWrapperStyle) {
|
|
505
505
|
const { columnGap, rowGap, gap } = columnWrapperStyle;
|
|
@@ -531,12 +531,12 @@ var Container = typedMemo(function Container2({
|
|
|
531
531
|
...paddingStyles || {}
|
|
532
532
|
};
|
|
533
533
|
}, [horizontal, otherAxisPos, otherAxisSize, columnWrapperStyle, numColumns]);
|
|
534
|
-
const renderedItemInfo =
|
|
534
|
+
const renderedItemInfo = React2.useMemo(
|
|
535
535
|
() => itemKey !== void 0 ? getRenderedItem2(itemKey) : null,
|
|
536
536
|
[itemKey, data, extraData]
|
|
537
537
|
);
|
|
538
538
|
const { index, renderedItem } = renderedItemInfo || {};
|
|
539
|
-
const contextValue =
|
|
539
|
+
const contextValue = React2.useMemo(() => {
|
|
540
540
|
ctx.viewRefs.set(id, ref);
|
|
541
541
|
return {
|
|
542
542
|
containerId: id,
|
|
@@ -577,7 +577,7 @@ var Container = typedMemo(function Container2({
|
|
|
577
577
|
[itemKey, layoutRenderCount]
|
|
578
578
|
);
|
|
579
579
|
if (!IsNewArchitecture) {
|
|
580
|
-
|
|
580
|
+
React2.useEffect(() => {
|
|
581
581
|
if (!isNullOrUndefined(itemKey)) {
|
|
582
582
|
const timeout = setTimeout(() => {
|
|
583
583
|
if (!didLayoutRef.current && refLastSize.current) {
|
|
@@ -592,7 +592,7 @@ var Container = typedMemo(function Container2({
|
|
|
592
592
|
}, [itemKey]);
|
|
593
593
|
}
|
|
594
594
|
const PositionComponent = isSticky ? PositionViewSticky : PositionView3;
|
|
595
|
-
return /* @__PURE__ */
|
|
595
|
+
return /* @__PURE__ */ React2__namespace.createElement(
|
|
596
596
|
PositionComponent,
|
|
597
597
|
{
|
|
598
598
|
animatedScrollY: isSticky ? animatedScrollY : void 0,
|
|
@@ -605,7 +605,7 @@ var Container = typedMemo(function Container2({
|
|
|
605
605
|
stickyOffset: isSticky ? stickyOffset : void 0,
|
|
606
606
|
style
|
|
607
607
|
},
|
|
608
|
-
/* @__PURE__ */
|
|
608
|
+
/* @__PURE__ */ React2__namespace.createElement(ContextContainer.Provider, { value: contextValue }, renderedItem, renderedItemInfo && ItemSeparatorComponent && /* @__PURE__ */ React2__namespace.createElement(Separator, { ItemSeparatorComponent, leadingItem: renderedItemInfo.item }))
|
|
609
609
|
);
|
|
610
610
|
});
|
|
611
611
|
|
|
@@ -634,7 +634,7 @@ var Containers = typedMemo(function Containers2({
|
|
|
634
634
|
const containers = [];
|
|
635
635
|
for (let i = 0; i < numContainers; i++) {
|
|
636
636
|
containers.push(
|
|
637
|
-
/* @__PURE__ */
|
|
637
|
+
/* @__PURE__ */ React2__namespace.createElement(
|
|
638
638
|
Container,
|
|
639
639
|
{
|
|
640
640
|
getRenderedItem: getRenderedItem2,
|
|
@@ -669,18 +669,18 @@ var Containers = typedMemo(function Containers2({
|
|
|
669
669
|
}
|
|
670
670
|
}
|
|
671
671
|
}
|
|
672
|
-
return /* @__PURE__ */
|
|
672
|
+
return /* @__PURE__ */ React2__namespace.createElement(reactNative.Animated.View, { style }, containers);
|
|
673
673
|
});
|
|
674
674
|
var LayoutView = ({ onLayoutChange, refView, ...rest }) => {
|
|
675
|
-
const ref = refView != null ? refView :
|
|
675
|
+
const ref = refView != null ? refView : React2.useRef();
|
|
676
676
|
const { onLayout } = useOnLayoutSync({ onLayoutChange, ref });
|
|
677
|
-
return /* @__PURE__ */
|
|
677
|
+
return /* @__PURE__ */ React2__namespace.createElement(reactNative.View, { ...rest, onLayout, ref });
|
|
678
678
|
};
|
|
679
679
|
function ScrollAdjust() {
|
|
680
680
|
const bias = 1e7;
|
|
681
681
|
const [scrollAdjust, scrollAdjustUserOffset] = useArr$(["scrollAdjust", "scrollAdjustUserOffset"]);
|
|
682
682
|
const scrollOffset = (scrollAdjust || 0) + (scrollAdjustUserOffset || 0) + bias;
|
|
683
|
-
return /* @__PURE__ */
|
|
683
|
+
return /* @__PURE__ */ React2__namespace.createElement(
|
|
684
684
|
reactNative.View,
|
|
685
685
|
{
|
|
686
686
|
style: {
|
|
@@ -695,26 +695,26 @@ function ScrollAdjust() {
|
|
|
695
695
|
}
|
|
696
696
|
function SnapWrapper({ ScrollComponent, ...props }) {
|
|
697
697
|
const [snapToOffsets] = useArr$(["snapToOffsets"]);
|
|
698
|
-
return /* @__PURE__ */
|
|
698
|
+
return /* @__PURE__ */ React2__namespace.createElement(ScrollComponent, { ...props, snapToOffsets });
|
|
699
699
|
}
|
|
700
700
|
|
|
701
701
|
// src/components/ListComponent.tsx
|
|
702
702
|
var getComponent = (Component) => {
|
|
703
|
-
if (
|
|
703
|
+
if (React2__namespace.isValidElement(Component)) {
|
|
704
704
|
return Component;
|
|
705
705
|
}
|
|
706
706
|
if (Component) {
|
|
707
|
-
return /* @__PURE__ */
|
|
707
|
+
return /* @__PURE__ */ React2__namespace.createElement(Component, null);
|
|
708
708
|
}
|
|
709
709
|
return null;
|
|
710
710
|
};
|
|
711
711
|
var Padding = () => {
|
|
712
712
|
const animPaddingTop = useValue$("alignItemsPaddingTop", { delay: 0 });
|
|
713
|
-
return /* @__PURE__ */
|
|
713
|
+
return /* @__PURE__ */ React2__namespace.createElement(reactNative.Animated.View, { style: { paddingTop: animPaddingTop } });
|
|
714
714
|
};
|
|
715
715
|
var PaddingDevMode = () => {
|
|
716
716
|
const animPaddingTop = useValue$("alignItemsPaddingTop", { delay: 0 });
|
|
717
|
-
return /* @__PURE__ */
|
|
717
|
+
return /* @__PURE__ */ React2__namespace.createElement(React2__namespace.Fragment, null, /* @__PURE__ */ React2__namespace.createElement(reactNative.Animated.View, { style: { paddingTop: animPaddingTop } }), /* @__PURE__ */ React2__namespace.createElement(
|
|
718
718
|
reactNative.Animated.View,
|
|
719
719
|
{
|
|
720
720
|
style: {
|
|
@@ -757,11 +757,11 @@ var ListComponent = typedMemo(function ListComponent2({
|
|
|
757
757
|
...rest
|
|
758
758
|
}) {
|
|
759
759
|
const ctx = useStateContext();
|
|
760
|
-
const ScrollComponent = renderScrollComponent ?
|
|
761
|
-
() =>
|
|
760
|
+
const ScrollComponent = renderScrollComponent ? React2.useMemo(
|
|
761
|
+
() => React2__namespace.forwardRef((props, ref) => renderScrollComponent({ ...props, ref })),
|
|
762
762
|
[renderScrollComponent]
|
|
763
763
|
) : reactNative.Animated.ScrollView;
|
|
764
|
-
|
|
764
|
+
React2__namespace.useEffect(() => {
|
|
765
765
|
if (canRender) {
|
|
766
766
|
setTimeout(() => {
|
|
767
767
|
scrollAdjustHandler.setMounted();
|
|
@@ -769,7 +769,7 @@ var ListComponent = typedMemo(function ListComponent2({
|
|
|
769
769
|
}
|
|
770
770
|
}, [canRender]);
|
|
771
771
|
const SnapOrScroll = snapToIndices ? SnapWrapper : ScrollComponent;
|
|
772
|
-
return /* @__PURE__ */
|
|
772
|
+
return /* @__PURE__ */ React2__namespace.createElement(
|
|
773
773
|
SnapOrScroll,
|
|
774
774
|
{
|
|
775
775
|
...rest,
|
|
@@ -788,11 +788,11 @@ var ListComponent = typedMemo(function ListComponent2({
|
|
|
788
788
|
ScrollComponent: snapToIndices ? ScrollComponent : void 0,
|
|
789
789
|
style
|
|
790
790
|
},
|
|
791
|
-
maintainVisibleContentPosition && /* @__PURE__ */
|
|
792
|
-
ENABLE_DEVMODE ? /* @__PURE__ */
|
|
793
|
-
ListHeaderComponent && /* @__PURE__ */
|
|
791
|
+
maintainVisibleContentPosition && /* @__PURE__ */ React2__namespace.createElement(ScrollAdjust, null),
|
|
792
|
+
ENABLE_DEVMODE ? /* @__PURE__ */ React2__namespace.createElement(PaddingDevMode, null) : /* @__PURE__ */ React2__namespace.createElement(Padding, null),
|
|
793
|
+
ListHeaderComponent && /* @__PURE__ */ React2__namespace.createElement(LayoutView, { onLayoutChange: onLayoutHeader, style: ListHeaderComponentStyle }, getComponent(ListHeaderComponent)),
|
|
794
794
|
ListEmptyComponent && getComponent(ListEmptyComponent),
|
|
795
|
-
canRender && !ListEmptyComponent && /* @__PURE__ */
|
|
795
|
+
canRender && !ListEmptyComponent && /* @__PURE__ */ React2__namespace.createElement(
|
|
796
796
|
Containers,
|
|
797
797
|
{
|
|
798
798
|
getRenderedItem: getRenderedItem2,
|
|
@@ -803,7 +803,7 @@ var ListComponent = typedMemo(function ListComponent2({
|
|
|
803
803
|
waitForInitialLayout
|
|
804
804
|
}
|
|
805
805
|
),
|
|
806
|
-
ListFooterComponent && /* @__PURE__ */
|
|
806
|
+
ListFooterComponent && /* @__PURE__ */ React2__namespace.createElement(
|
|
807
807
|
LayoutView,
|
|
808
808
|
{
|
|
809
809
|
onLayoutChange: (layout) => {
|
|
@@ -814,11 +814,11 @@ var ListComponent = typedMemo(function ListComponent2({
|
|
|
814
814
|
},
|
|
815
815
|
getComponent(ListFooterComponent)
|
|
816
816
|
),
|
|
817
|
-
__DEV__ && ENABLE_DEVMODE && /* @__PURE__ */
|
|
817
|
+
__DEV__ && ENABLE_DEVMODE && /* @__PURE__ */ React2__namespace.createElement(DevNumbers, null)
|
|
818
818
|
);
|
|
819
819
|
});
|
|
820
|
-
var DevNumbers = __DEV__ &&
|
|
821
|
-
return Array.from({ length: 100 }).map((_, index) => /* @__PURE__ */
|
|
820
|
+
var DevNumbers = __DEV__ && React2__namespace.memo(function DevNumbers2() {
|
|
821
|
+
return Array.from({ length: 100 }).map((_, index) => /* @__PURE__ */ React2__namespace.createElement(
|
|
822
822
|
reactNative.View,
|
|
823
823
|
{
|
|
824
824
|
key: index,
|
|
@@ -830,7 +830,7 @@ var DevNumbers = __DEV__ && React3__namespace.memo(function DevNumbers2() {
|
|
|
830
830
|
width: "100%"
|
|
831
831
|
}
|
|
832
832
|
},
|
|
833
|
-
/* @__PURE__ */
|
|
833
|
+
/* @__PURE__ */ React2__namespace.createElement(reactNative.Text, { style: { color: "red" } }, index * 100)
|
|
834
834
|
));
|
|
835
835
|
});
|
|
836
836
|
|
|
@@ -1889,7 +1889,6 @@ function calculateItemsInView(ctx, state, params = {}) {
|
|
|
1889
1889
|
const totalSize = peek$(ctx, "totalSize");
|
|
1890
1890
|
const topPad = peek$(ctx, "stylePaddingTop") + peek$(ctx, "headerSize");
|
|
1891
1891
|
const numColumns = peek$(ctx, "numColumns");
|
|
1892
|
-
const previousScrollAdjust = 0;
|
|
1893
1892
|
const { dataChanged, doMVCP } = params;
|
|
1894
1893
|
const speed = getScrollVelocity(state);
|
|
1895
1894
|
const scrollExtra = 0;
|
|
@@ -1903,7 +1902,7 @@ function calculateItemsInView(ctx, state, params = {}) {
|
|
|
1903
1902
|
);
|
|
1904
1903
|
scrollState = updatedOffset;
|
|
1905
1904
|
}
|
|
1906
|
-
const scrollAdjustPad = -
|
|
1905
|
+
const scrollAdjustPad = -topPad;
|
|
1907
1906
|
let scroll = scrollState + scrollExtra + scrollAdjustPad;
|
|
1908
1907
|
if (scroll + scrollLength > totalSize) {
|
|
1909
1908
|
scroll = Math.max(0, totalSize - scrollLength);
|
|
@@ -2415,13 +2414,6 @@ function onScroll(ctx, state, event) {
|
|
|
2415
2414
|
return;
|
|
2416
2415
|
}
|
|
2417
2416
|
const newScroll = event.nativeEvent.contentOffset[state.props.horizontal ? "x" : "y"];
|
|
2418
|
-
const ignoreScrollFromMVCP = state.ignoreScrollFromMVCP;
|
|
2419
|
-
if (ignoreScrollFromMVCP && !state.scrollingTo) {
|
|
2420
|
-
const { lt, gt } = ignoreScrollFromMVCP;
|
|
2421
|
-
if (lt && newScroll < lt || gt && newScroll > gt) {
|
|
2422
|
-
return;
|
|
2423
|
-
}
|
|
2424
|
-
}
|
|
2425
2417
|
state.scrollPending = newScroll;
|
|
2426
2418
|
updateScroll(ctx, state, newScroll);
|
|
2427
2419
|
onScrollProp == null ? void 0 : onScrollProp(event);
|
|
@@ -2431,9 +2423,17 @@ function updateScroll(ctx, state, newScroll) {
|
|
|
2431
2423
|
state.hasScrolled = true;
|
|
2432
2424
|
state.lastBatchingAction = Date.now();
|
|
2433
2425
|
const currentTime = Date.now();
|
|
2426
|
+
const adjust = state.scrollAdjustHandler.getAdjust();
|
|
2427
|
+
const lastHistoryAdjust = state.lastScrollAdjustForHistory;
|
|
2428
|
+
const adjustChanged = lastHistoryAdjust !== void 0 && Math.abs(adjust - lastHistoryAdjust) > 0.1;
|
|
2429
|
+
if (adjustChanged) {
|
|
2430
|
+
state.scrollHistory.length = 0;
|
|
2431
|
+
}
|
|
2432
|
+
state.lastScrollAdjustForHistory = adjust;
|
|
2434
2433
|
if (scrollingTo === void 0 && !(state.scrollHistory.length === 0 && newScroll === state.scroll)) {
|
|
2435
|
-
|
|
2436
|
-
|
|
2434
|
+
if (!adjustChanged) {
|
|
2435
|
+
state.scrollHistory.push({ scroll: newScroll, time: currentTime });
|
|
2436
|
+
}
|
|
2437
2437
|
}
|
|
2438
2438
|
if (state.scrollHistory.length > 5) {
|
|
2439
2439
|
state.scrollHistory.shift();
|
|
@@ -2442,8 +2442,15 @@ function updateScroll(ctx, state, newScroll) {
|
|
|
2442
2442
|
state.scrollPrevTime = state.scrollTime;
|
|
2443
2443
|
state.scroll = newScroll;
|
|
2444
2444
|
state.scrollTime = currentTime;
|
|
2445
|
+
const ignoreScrollFromMVCP = state.ignoreScrollFromMVCP;
|
|
2446
|
+
if (ignoreScrollFromMVCP && !state.scrollingTo) {
|
|
2447
|
+
const { lt, gt } = ignoreScrollFromMVCP;
|
|
2448
|
+
if (lt && newScroll < lt || gt && newScroll > gt) {
|
|
2449
|
+
return;
|
|
2450
|
+
}
|
|
2451
|
+
}
|
|
2445
2452
|
if (state.dataChangeNeedsScrollUpdate || Math.abs(state.scroll - state.scrollPrev) > 2) {
|
|
2446
|
-
calculateItemsInView(ctx, state);
|
|
2453
|
+
calculateItemsInView(ctx, state, { doMVCP: state.scrollingTo !== void 0 });
|
|
2447
2454
|
checkAtBottom(ctx, state);
|
|
2448
2455
|
checkAtTop(state);
|
|
2449
2456
|
state.dataChangeNeedsScrollUpdate = false;
|
|
@@ -2484,7 +2491,6 @@ function updateItemSize(ctx, state, itemKey, sizeObj) {
|
|
|
2484
2491
|
getFixedItemSize,
|
|
2485
2492
|
getItemType,
|
|
2486
2493
|
horizontal,
|
|
2487
|
-
maintainVisibleContentPosition,
|
|
2488
2494
|
suggestEstimatedItemSize,
|
|
2489
2495
|
onItemSizeChanged,
|
|
2490
2496
|
data,
|
|
@@ -2605,7 +2611,7 @@ function updateOneItemSize(state, itemKey, sizeObj) {
|
|
|
2605
2611
|
return 0;
|
|
2606
2612
|
}
|
|
2607
2613
|
var useCombinedRef = (...refs) => {
|
|
2608
|
-
const callback =
|
|
2614
|
+
const callback = React2.useCallback((element) => {
|
|
2609
2615
|
for (const ref of refs) {
|
|
2610
2616
|
if (!ref) {
|
|
2611
2617
|
continue;
|
|
@@ -2658,21 +2664,21 @@ function getRenderedItem(ctx, state, key) {
|
|
|
2658
2664
|
item,
|
|
2659
2665
|
type: getItemType ? (_a = getItemType(item, index)) != null ? _a : "" : ""
|
|
2660
2666
|
};
|
|
2661
|
-
renderedItem = isFunction(renderItem) ? renderItem(itemProps) :
|
|
2667
|
+
renderedItem = isFunction(renderItem) ? renderItem(itemProps) : React2__namespace.default.createElement(renderItem, itemProps);
|
|
2662
2668
|
}
|
|
2663
2669
|
return { index, item: data[index], renderedItem };
|
|
2664
2670
|
}
|
|
2665
2671
|
function useThrottleDebounce(mode) {
|
|
2666
|
-
const timeoutRef =
|
|
2667
|
-
const lastCallTimeRef =
|
|
2668
|
-
const lastArgsRef =
|
|
2672
|
+
const timeoutRef = React2.useRef(null);
|
|
2673
|
+
const lastCallTimeRef = React2.useRef(0);
|
|
2674
|
+
const lastArgsRef = React2.useRef(null);
|
|
2669
2675
|
const clearTimeoutRef = () => {
|
|
2670
2676
|
if (timeoutRef.current) {
|
|
2671
2677
|
clearTimeout(timeoutRef.current);
|
|
2672
2678
|
timeoutRef.current = null;
|
|
2673
2679
|
}
|
|
2674
2680
|
};
|
|
2675
|
-
const execute =
|
|
2681
|
+
const execute = React2.useCallback(
|
|
2676
2682
|
(callback, delay, ...args) => {
|
|
2677
2683
|
{
|
|
2678
2684
|
const now = Date.now();
|
|
@@ -2717,14 +2723,14 @@ var LegendList = typedMemo(
|
|
|
2717
2723
|
const isChildrenMode = children !== void 0 && dataProp === void 0;
|
|
2718
2724
|
const processedProps = isChildrenMode ? {
|
|
2719
2725
|
...restProps,
|
|
2720
|
-
data: (isArray(children) ? children :
|
|
2726
|
+
data: (isArray(children) ? children : React2__namespace.Children.toArray(children)).flat(1),
|
|
2721
2727
|
renderItem: ({ item }) => item
|
|
2722
2728
|
} : {
|
|
2723
2729
|
...restProps,
|
|
2724
2730
|
data: dataProp || [],
|
|
2725
2731
|
renderItem: renderItemProp
|
|
2726
2732
|
};
|
|
2727
|
-
return /* @__PURE__ */
|
|
2733
|
+
return /* @__PURE__ */ React2__namespace.createElement(StateProvider, null, /* @__PURE__ */ React2__namespace.createElement(LegendListInner, { ...processedProps, ref: forwardedRef }));
|
|
2728
2734
|
})
|
|
2729
2735
|
);
|
|
2730
2736
|
var LegendListInner = typedForwardRef(function LegendListInner2(props, forwardedRef) {
|
|
@@ -2782,21 +2788,21 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded
|
|
|
2782
2788
|
waitForInitialLayout = true,
|
|
2783
2789
|
...rest
|
|
2784
2790
|
} = props;
|
|
2785
|
-
const [renderNum, setRenderNum] =
|
|
2791
|
+
const [renderNum, setRenderNum] = React2.useState(0);
|
|
2786
2792
|
const initialScroll = initialScrollIndexProp || initialScrollOffsetProp ? typeof initialScrollIndexProp === "object" ? { index: initialScrollIndexProp.index || 0, viewOffset: initialScrollIndexProp.viewOffset || 0 } : { index: initialScrollIndexProp || 0, viewOffset: initialScrollOffsetProp || 0 } : void 0;
|
|
2787
|
-
const [canRender, setCanRender] =
|
|
2793
|
+
const [canRender, setCanRender] = React2__namespace.useState(!IsNewArchitecture);
|
|
2788
2794
|
const contentContainerStyle = { ...reactNative.StyleSheet.flatten(contentContainerStyleProp) };
|
|
2789
2795
|
const style = { ...reactNative.StyleSheet.flatten(styleProp) };
|
|
2790
2796
|
const stylePaddingTopState = extractPadding(style, contentContainerStyle, "Top");
|
|
2791
2797
|
const stylePaddingBottomState = extractPadding(style, contentContainerStyle, "Bottom");
|
|
2792
2798
|
const ctx = useStateContext();
|
|
2793
2799
|
ctx.columnWrapperStyle = columnWrapperStyle || (contentContainerStyle ? createColumnWrapperStyle(contentContainerStyle) : void 0);
|
|
2794
|
-
const refScroller =
|
|
2800
|
+
const refScroller = React2.useRef(null);
|
|
2795
2801
|
const combinedRef = useCombinedRef(refScroller, refScrollView);
|
|
2796
2802
|
const estimatedItemSize = estimatedItemSizeProp != null ? estimatedItemSizeProp : DEFAULT_ITEM_SIZE;
|
|
2797
2803
|
const scrollBuffer = (drawDistance != null ? drawDistance : DEFAULT_DRAW_DISTANCE) || 1;
|
|
2798
2804
|
const keyExtractor = keyExtractorProp != null ? keyExtractorProp : (_item, index) => index.toString();
|
|
2799
|
-
const refState =
|
|
2805
|
+
const refState = React2.useRef();
|
|
2800
2806
|
if (!refState.current) {
|
|
2801
2807
|
if (!ctx.internalState) {
|
|
2802
2808
|
const initialScrollLength = (estimatedListSize != null ? estimatedListSize : IsNewArchitecture ? { height: 0, width: 0 } : reactNative.Dimensions.get("window"))[horizontal ? "width" : "height"];
|
|
@@ -2893,13 +2899,13 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded
|
|
|
2893
2899
|
scrollBuffer,
|
|
2894
2900
|
snapToIndices,
|
|
2895
2901
|
stickyIndicesArr: stickyIndices != null ? stickyIndices : [],
|
|
2896
|
-
stickyIndicesSet:
|
|
2902
|
+
stickyIndicesSet: React2.useMemo(() => new Set(stickyIndices != null ? stickyIndices : []), [stickyIndices == null ? void 0 : stickyIndices.join(",")]),
|
|
2897
2903
|
stylePaddingBottom: stylePaddingBottomState,
|
|
2898
2904
|
stylePaddingTop: stylePaddingTopState,
|
|
2899
2905
|
suggestEstimatedItemSize: !!suggestEstimatedItemSize
|
|
2900
2906
|
};
|
|
2901
2907
|
state.refScroller = refScroller;
|
|
2902
|
-
const memoizedLastItemKeys =
|
|
2908
|
+
const memoizedLastItemKeys = React2.useMemo(() => {
|
|
2903
2909
|
if (!dataProp.length) return [];
|
|
2904
2910
|
return Array.from(
|
|
2905
2911
|
{ length: Math.min(numColumnsProp, dataProp.length) },
|
|
@@ -2929,7 +2935,7 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded
|
|
|
2929
2935
|
true
|
|
2930
2936
|
);
|
|
2931
2937
|
}
|
|
2932
|
-
const initialContentOffset =
|
|
2938
|
+
const initialContentOffset = React2.useMemo(() => {
|
|
2933
2939
|
if (initialScroll) {
|
|
2934
2940
|
const { index, viewOffset } = initialScroll;
|
|
2935
2941
|
let initialContentOffset2 = viewOffset || 0;
|
|
@@ -2961,7 +2967,7 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded
|
|
|
2961
2967
|
refState.current.positions.clear();
|
|
2962
2968
|
}
|
|
2963
2969
|
}
|
|
2964
|
-
const onLayoutHeader =
|
|
2970
|
+
const onLayoutHeader = React2.useCallback((rect, fromLayoutEffect) => {
|
|
2965
2971
|
const size = rect[horizontal ? "width" : "height"];
|
|
2966
2972
|
set$(ctx, "headerSize", size);
|
|
2967
2973
|
if ((initialScroll == null ? void 0 : initialScroll.index) !== void 0) {
|
|
@@ -2976,12 +2982,12 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded
|
|
|
2976
2982
|
}
|
|
2977
2983
|
}
|
|
2978
2984
|
}, []);
|
|
2979
|
-
|
|
2985
|
+
React2.useLayoutEffect(() => {
|
|
2980
2986
|
if (snapToIndices) {
|
|
2981
2987
|
updateSnapToOffsets(ctx, state);
|
|
2982
2988
|
}
|
|
2983
2989
|
}, [snapToIndices]);
|
|
2984
|
-
|
|
2990
|
+
React2.useLayoutEffect(() => {
|
|
2985
2991
|
const didAllocateContainers = dataProp.length > 0 && doInitialAllocateContainers(ctx, state);
|
|
2986
2992
|
if (!didAllocateContainers) {
|
|
2987
2993
|
checkResetContainers(
|
|
@@ -2993,16 +2999,16 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded
|
|
|
2993
2999
|
);
|
|
2994
3000
|
}
|
|
2995
3001
|
}, [dataProp, numColumnsProp]);
|
|
2996
|
-
|
|
3002
|
+
React2.useLayoutEffect(() => {
|
|
2997
3003
|
set$(ctx, "extraData", extraData);
|
|
2998
3004
|
}, [extraData]);
|
|
2999
|
-
|
|
3005
|
+
React2.useLayoutEffect(initializeStateVars, [
|
|
3000
3006
|
memoizedLastItemKeys.join(","),
|
|
3001
3007
|
numColumnsProp,
|
|
3002
3008
|
stylePaddingTopState,
|
|
3003
3009
|
stylePaddingBottomState
|
|
3004
3010
|
]);
|
|
3005
|
-
|
|
3011
|
+
React2.useEffect(() => {
|
|
3006
3012
|
const viewability = setupViewability({
|
|
3007
3013
|
onViewableItemsChanged,
|
|
3008
3014
|
viewabilityConfig,
|
|
@@ -3016,7 +3022,7 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded
|
|
|
3016
3022
|
doInitialAllocateContainers(ctx, state);
|
|
3017
3023
|
});
|
|
3018
3024
|
}
|
|
3019
|
-
const onLayoutChange =
|
|
3025
|
+
const onLayoutChange = React2.useCallback((layout) => {
|
|
3020
3026
|
handleLayout(ctx, state, layout, setCanRender);
|
|
3021
3027
|
}, []);
|
|
3022
3028
|
const { onLayout } = useOnLayoutSync({
|
|
@@ -3025,7 +3031,7 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded
|
|
|
3025
3031
|
ref: refScroller
|
|
3026
3032
|
// the type of ScrollView doesn't include measure?
|
|
3027
3033
|
});
|
|
3028
|
-
|
|
3034
|
+
React2.useImperativeHandle(forwardedRef, () => {
|
|
3029
3035
|
const scrollIndexIntoView = (options) => {
|
|
3030
3036
|
const state2 = refState.current;
|
|
3031
3037
|
if (state2) {
|
|
@@ -3108,13 +3114,13 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded
|
|
|
3108
3114
|
};
|
|
3109
3115
|
}, []);
|
|
3110
3116
|
if (reactNative.Platform.OS === "web") {
|
|
3111
|
-
|
|
3117
|
+
React2.useEffect(() => {
|
|
3112
3118
|
if (initialContentOffset) {
|
|
3113
3119
|
scrollTo(state, { animated: false, offset: initialContentOffset });
|
|
3114
3120
|
}
|
|
3115
3121
|
}, []);
|
|
3116
3122
|
}
|
|
3117
|
-
const fns =
|
|
3123
|
+
const fns = React2.useMemo(
|
|
3118
3124
|
() => ({
|
|
3119
3125
|
getRenderedItem: (key) => getRenderedItem(ctx, state, key),
|
|
3120
3126
|
onScroll: (event) => onScroll(ctx, state, event),
|
|
@@ -3122,7 +3128,7 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded
|
|
|
3122
3128
|
}),
|
|
3123
3129
|
[]
|
|
3124
3130
|
);
|
|
3125
|
-
const onScrollHandler =
|
|
3131
|
+
const onScrollHandler = React2.useMemo(() => {
|
|
3126
3132
|
const onScrollFn = fns.onScroll;
|
|
3127
3133
|
if (stickyIndices == null ? void 0 : stickyIndices.length) {
|
|
3128
3134
|
const { animatedScrollY } = ctx;
|
|
@@ -3133,7 +3139,7 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded
|
|
|
3133
3139
|
}
|
|
3134
3140
|
return onScrollFn;
|
|
3135
3141
|
}, [stickyIndices == null ? void 0 : stickyIndices.length, horizontal, scrollEventThrottle]);
|
|
3136
|
-
return /* @__PURE__ */
|
|
3142
|
+
return /* @__PURE__ */ React2__namespace.createElement(React2__namespace.Fragment, null, /* @__PURE__ */ React2__namespace.createElement(
|
|
3137
3143
|
ListComponent,
|
|
3138
3144
|
{
|
|
3139
3145
|
...rest,
|
|
@@ -3164,9 +3170,9 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded
|
|
|
3164
3170
|
},
|
|
3165
3171
|
onScroll: onScrollHandler,
|
|
3166
3172
|
recycleItems,
|
|
3167
|
-
refreshControl: refreshControl ? stylePaddingTopState > 0 ?
|
|
3173
|
+
refreshControl: refreshControl ? stylePaddingTopState > 0 ? React2__namespace.cloneElement(refreshControl, {
|
|
3168
3174
|
progressViewOffset: (refreshControl.props.progressViewOffset || 0) + stylePaddingTopState
|
|
3169
|
-
}) : refreshControl : onRefresh && /* @__PURE__ */
|
|
3175
|
+
}) : refreshControl : onRefresh && /* @__PURE__ */ React2__namespace.createElement(
|
|
3170
3176
|
reactNative.RefreshControl,
|
|
3171
3177
|
{
|
|
3172
3178
|
onRefresh,
|
|
@@ -3183,7 +3189,7 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded
|
|
|
3183
3189
|
updateItemSize: fns.updateItemSize,
|
|
3184
3190
|
waitForInitialLayout
|
|
3185
3191
|
}
|
|
3186
|
-
), __DEV__ && ENABLE_DEBUG_VIEW && /* @__PURE__ */
|
|
3192
|
+
), __DEV__ && ENABLE_DEBUG_VIEW && /* @__PURE__ */ React2__namespace.createElement(DebugView, { state: refState.current }));
|
|
3187
3193
|
});
|
|
3188
3194
|
|
|
3189
3195
|
exports.LegendList = LegendList;
|