@legendapp/list 3.0.0-beta.38 → 3.0.0-beta.39

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/animated.d.ts CHANGED
@@ -417,6 +417,8 @@ type LegendListState = {
417
417
  endBuffered: number;
418
418
  isAtEnd: boolean;
419
419
  isAtStart: boolean;
420
+ isEndReached: boolean;
421
+ isStartReached: boolean;
420
422
  listen: <T extends LegendListListenerType>(listenerType: T, callback: (value: ListenerTypeValueMap[T]) => void) => () => void;
421
423
  listenToPosition: (key: string, callback: (value: number) => void) => () => void;
422
424
  positionAtIndex: (index: number) => number;
package/index.d.ts CHANGED
@@ -663,6 +663,8 @@ type LegendListState$1 = {
663
663
  endBuffered: number;
664
664
  isAtEnd: boolean;
665
665
  isAtStart: boolean;
666
+ isEndReached: boolean;
667
+ isStartReached: boolean;
666
668
  listen: <T extends LegendListListenerType>(listenerType: T, callback: (value: ListenerTypeValueMap[T]) => void) => () => void;
667
669
  listenToPosition: (key: string, callback: (value: number) => void) => () => void;
668
670
  positionAtIndex: (index: number) => number;
package/index.js CHANGED
@@ -4022,6 +4022,8 @@ function createImperativeHandle(ctx) {
4022
4022
  endBuffered: state.endBuffered,
4023
4023
  isAtEnd: state.isAtEnd,
4024
4024
  isAtStart: state.isAtStart,
4025
+ isEndReached: state.isEndReached,
4026
+ isStartReached: state.isStartReached,
4025
4027
  listen: (signalName, cb) => listen$(ctx, signalName, cb),
4026
4028
  listenToPosition: (key, cb) => listenPosition$(ctx, key, cb),
4027
4029
  positionAtIndex: (index) => state.positions[index],
package/index.mjs CHANGED
@@ -4001,6 +4001,8 @@ function createImperativeHandle(ctx) {
4001
4001
  endBuffered: state.endBuffered,
4002
4002
  isAtEnd: state.isAtEnd,
4003
4003
  isAtStart: state.isAtStart,
4004
+ isEndReached: state.isEndReached,
4005
+ isStartReached: state.isStartReached,
4004
4006
  listen: (signalName, cb) => listen$(ctx, signalName, cb),
4005
4007
  listenToPosition: (key, cb) => listenPosition$(ctx, key, cb),
4006
4008
  positionAtIndex: (index) => state.positions[index],
package/index.native.js CHANGED
@@ -3635,6 +3635,8 @@ function createImperativeHandle(ctx) {
3635
3635
  endBuffered: state.endBuffered,
3636
3636
  isAtEnd: state.isAtEnd,
3637
3637
  isAtStart: state.isAtStart,
3638
+ isEndReached: state.isEndReached,
3639
+ isStartReached: state.isStartReached,
3638
3640
  listen: (signalName, cb) => listen$(ctx, signalName, cb),
3639
3641
  listenToPosition: (key, cb) => listenPosition$(ctx, key, cb),
3640
3642
  positionAtIndex: (index) => state.positions[index],
package/index.native.mjs CHANGED
@@ -3614,6 +3614,8 @@ function createImperativeHandle(ctx) {
3614
3614
  endBuffered: state.endBuffered,
3615
3615
  isAtEnd: state.isAtEnd,
3616
3616
  isAtStart: state.isAtStart,
3617
+ isEndReached: state.isEndReached,
3618
+ isStartReached: state.isStartReached,
3617
3619
  listen: (signalName, cb) => listen$(ctx, signalName, cb),
3618
3620
  listenToPosition: (key, cb) => listenPosition$(ctx, key, cb),
3619
3621
  positionAtIndex: (index) => state.positions[index],
@@ -65,6 +65,8 @@ type LegendListState = {
65
65
  endBuffered: number;
66
66
  isAtEnd: boolean;
67
67
  isAtStart: boolean;
68
+ isEndReached: boolean;
69
+ isStartReached: boolean;
68
70
  listen: <T extends LegendListListenerType>(listenerType: T, callback: (value: ListenerTypeValueMap[T]) => void) => () => void;
69
71
  listenToPosition: (key: string, callback: (value: number) => void) => () => void;
70
72
  positionAtIndex: (index: number) => number;
package/keyboard.d.ts CHANGED
@@ -65,6 +65,8 @@ type LegendListState = {
65
65
  endBuffered: number;
66
66
  isAtEnd: boolean;
67
67
  isAtStart: boolean;
68
+ isEndReached: boolean;
69
+ isStartReached: boolean;
68
70
  listen: <T extends LegendListListenerType>(listenerType: T, callback: (value: ListenerTypeValueMap[T]) => void) => () => void;
69
71
  listenToPosition: (key: string, callback: (value: number) => void) => () => void;
70
72
  positionAtIndex: (index: number) => number;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@legendapp/list",
3
- "version": "3.0.0-beta.38",
3
+ "version": "3.0.0-beta.39",
4
4
  "description": "Legend List is a drop-in replacement for FlatList with much better performance and supporting dynamically sized items.",
5
5
  "sideEffects": false,
6
6
  "private": false,
package/react-native.d.ts CHANGED
@@ -664,6 +664,8 @@ type LegendListState$1 = {
664
664
  endBuffered: number;
665
665
  isAtEnd: boolean;
666
666
  isAtStart: boolean;
667
+ isEndReached: boolean;
668
+ isStartReached: boolean;
667
669
  listen: <T extends LegendListListenerType>(listenerType: T, callback: (value: ListenerTypeValueMap[T]) => void) => () => void;
668
670
  listenToPosition: (key: string, callback: (value: number) => void) => () => void;
669
671
  positionAtIndex: (index: number) => number;
package/react-native.js CHANGED
@@ -3635,6 +3635,8 @@ function createImperativeHandle(ctx) {
3635
3635
  endBuffered: state.endBuffered,
3636
3636
  isAtEnd: state.isAtEnd,
3637
3637
  isAtStart: state.isAtStart,
3638
+ isEndReached: state.isEndReached,
3639
+ isStartReached: state.isStartReached,
3638
3640
  listen: (signalName, cb) => listen$(ctx, signalName, cb),
3639
3641
  listenToPosition: (key, cb) => listenPosition$(ctx, key, cb),
3640
3642
  positionAtIndex: (index) => state.positions[index],
@@ -4416,8 +4418,10 @@ var internal = {
4416
4418
  getComponent,
4417
4419
  IsNewArchitecture,
4418
4420
  POSITION_OUT_OF_VIEW,
4421
+ peek$,
4419
4422
  useArr$,
4420
- useCombinedRef
4423
+ useCombinedRef,
4424
+ useStateContext
4421
4425
  };
4422
4426
 
4423
4427
  exports.LegendList = LegendList3;
package/react-native.mjs CHANGED
@@ -3614,6 +3614,8 @@ function createImperativeHandle(ctx) {
3614
3614
  endBuffered: state.endBuffered,
3615
3615
  isAtEnd: state.isAtEnd,
3616
3616
  isAtStart: state.isAtStart,
3617
+ isEndReached: state.isEndReached,
3618
+ isStartReached: state.isStartReached,
3617
3619
  listen: (signalName, cb) => listen$(ctx, signalName, cb),
3618
3620
  listenToPosition: (key, cb) => listenPosition$(ctx, key, cb),
3619
3621
  positionAtIndex: (index) => state.positions[index],
@@ -4395,8 +4397,10 @@ var internal = {
4395
4397
  getComponent,
4396
4398
  IsNewArchitecture,
4397
4399
  POSITION_OUT_OF_VIEW,
4400
+ peek$,
4398
4401
  useArr$,
4399
- useCombinedRef
4402
+ useCombinedRef,
4403
+ useStateContext
4400
4404
  };
4401
4405
 
4402
4406
  export { LegendList3 as LegendList, internal, typedForwardRef, typedMemo2 as typedMemo, useIsLastItem, useListScrollSize, useRecyclingEffect, useRecyclingState, useSyncLayout, useViewability, useViewabilityAmount };
package/react.d.ts CHANGED
@@ -683,6 +683,8 @@ type LegendListState$1 = {
683
683
  endBuffered: number;
684
684
  isAtEnd: boolean;
685
685
  isAtStart: boolean;
686
+ isEndReached: boolean;
687
+ isStartReached: boolean;
686
688
  listen: <T extends LegendListListenerType>(listenerType: T, callback: (value: ListenerTypeValueMap[T]) => void) => () => void;
687
689
  listenToPosition: (key: string, callback: (value: number) => void) => () => void;
688
690
  positionAtIndex: (index: number) => number;
package/react.js CHANGED
@@ -4022,6 +4022,8 @@ function createImperativeHandle(ctx) {
4022
4022
  endBuffered: state.endBuffered,
4023
4023
  isAtEnd: state.isAtEnd,
4024
4024
  isAtStart: state.isAtStart,
4025
+ isEndReached: state.isEndReached,
4026
+ isStartReached: state.isStartReached,
4025
4027
  listen: (signalName, cb) => listen$(ctx, signalName, cb),
4026
4028
  listenToPosition: (key, cb) => listenPosition$(ctx, key, cb),
4027
4029
  positionAtIndex: (index) => state.positions[index],
package/react.mjs CHANGED
@@ -4001,6 +4001,8 @@ function createImperativeHandle(ctx) {
4001
4001
  endBuffered: state.endBuffered,
4002
4002
  isAtEnd: state.isAtEnd,
4003
4003
  isAtStart: state.isAtStart,
4004
+ isEndReached: state.isEndReached,
4005
+ isStartReached: state.isStartReached,
4004
4006
  listen: (signalName, cb) => listen$(ctx, signalName, cb),
4005
4007
  listenToPosition: (key, cb) => listenPosition$(ctx, key, cb),
4006
4008
  positionAtIndex: (index) => state.positions[index],
package/reanimated.d.ts CHANGED
@@ -418,6 +418,8 @@ type LegendListState = {
418
418
  endBuffered: number;
419
419
  isAtEnd: boolean;
420
420
  isAtStart: boolean;
421
+ isEndReached: boolean;
422
+ isStartReached: boolean;
421
423
  listen: <T extends LegendListListenerType>(listenerType: T, callback: (value: ListenerTypeValueMap[T]) => void) => () => void;
422
424
  listenToPosition: (key: string, callback: (value: number) => void) => () => void;
423
425
  positionAtIndex: (index: number) => number;
package/reanimated.js CHANGED
@@ -30,6 +30,7 @@ var Reanimated__default = /*#__PURE__*/_interopDefault(Reanimated);
30
30
 
31
31
  // src/integrations/reanimated.tsx
32
32
  var { POSITION_OUT_OF_VIEW, IsNewArchitecture, useArr$, useCombinedRef, getComponent } = reactNative.internal;
33
+ var { peek$, useStateContext } = reactNative.internal;
33
34
  var typedMemo = React.memo;
34
35
  var ReanimatedScrollBridge = typedMemo(function ReanimatedScrollBridgeComponent({
35
36
  forwardedRef,
@@ -85,18 +86,21 @@ var ReanimatedPositionViewSticky = typedMemo(function ReanimatedPositionViewStic
85
86
  return /* @__PURE__ */ React__namespace.createElement(Reanimated__default.default.View, { ref: refView, style: viewStyle, ...rest }, /* @__PURE__ */ React__namespace.createElement(StickyOverlay, { stickyHeaderConfig }), children);
86
87
  });
87
88
  var ReanimatedPositionView = typedMemo(function ReanimatedPositionViewComponent(props) {
89
+ const ctx = useStateContext();
88
90
  const { id, horizontal, style, refView, children, recycleItems, layoutTransition, ...rest } = props;
89
- const [positionValue = POSITION_OUT_OF_VIEW, itemKey] = useArr$([
90
- `containerPosition${id}`,
91
- `containerItemKey${id}`
92
- ]);
91
+ const [positionValue = POSITION_OUT_OF_VIEW] = useArr$([`containerPosition${id}`]);
93
92
  const prevItemKeyRef = React__namespace.useRef(void 0);
94
- const shouldSkipTransitionForRecycleReuse = !!recycleItems && itemKey !== void 0 && prevItemKeyRef.current !== void 0 && prevItemKeyRef.current !== itemKey;
95
- React__namespace.useEffect(() => {
93
+ let shouldSkipTransitionForRecycleReuse = false;
94
+ if (recycleItems && layoutTransition) {
95
+ const itemKeySignal = `containerItemKey${id}`;
96
+ const itemKey = peek$(ctx, itemKeySignal);
97
+ shouldSkipTransitionForRecycleReuse = itemKey !== void 0 && prevItemKeyRef.current !== void 0 && prevItemKeyRef.current !== itemKey;
96
98
  if (itemKey !== void 0) {
97
99
  prevItemKeyRef.current = itemKey;
98
100
  }
99
- }, [itemKey]);
101
+ } else {
102
+ prevItemKeyRef.current = void 0;
103
+ }
100
104
  const viewStyle = React__namespace.useMemo(
101
105
  () => [style, horizontal ? { left: positionValue } : { top: positionValue }],
102
106
  [horizontal, positionValue, style]
@@ -170,6 +174,7 @@ var LegendListForwardedRef = typedMemo(
170
174
  const legendListProps = {
171
175
  ...rest,
172
176
  positionComponentInternal,
177
+ recycleItems,
173
178
  ...shouldUseReanimatedScrollView ? {
174
179
  renderScrollComponent: renderReanimatedScrollComponent,
175
180
  stickyPositionComponentInternal
package/reanimated.mjs CHANGED
@@ -6,6 +6,7 @@ import { internal, LegendList } from '@legendapp/list/react-native';
6
6
 
7
7
  // src/integrations/reanimated.tsx
8
8
  var { POSITION_OUT_OF_VIEW, IsNewArchitecture, useArr$, useCombinedRef, getComponent } = internal;
9
+ var { peek$, useStateContext } = internal;
9
10
  var typedMemo = memo;
10
11
  var ReanimatedScrollBridge = typedMemo(function ReanimatedScrollBridgeComponent({
11
12
  forwardedRef,
@@ -61,18 +62,21 @@ var ReanimatedPositionViewSticky = typedMemo(function ReanimatedPositionViewStic
61
62
  return /* @__PURE__ */ React.createElement(Reanimated.View, { ref: refView, style: viewStyle, ...rest }, /* @__PURE__ */ React.createElement(StickyOverlay, { stickyHeaderConfig }), children);
62
63
  });
63
64
  var ReanimatedPositionView = typedMemo(function ReanimatedPositionViewComponent(props) {
65
+ const ctx = useStateContext();
64
66
  const { id, horizontal, style, refView, children, recycleItems, layoutTransition, ...rest } = props;
65
- const [positionValue = POSITION_OUT_OF_VIEW, itemKey] = useArr$([
66
- `containerPosition${id}`,
67
- `containerItemKey${id}`
68
- ]);
67
+ const [positionValue = POSITION_OUT_OF_VIEW] = useArr$([`containerPosition${id}`]);
69
68
  const prevItemKeyRef = React.useRef(void 0);
70
- const shouldSkipTransitionForRecycleReuse = !!recycleItems && itemKey !== void 0 && prevItemKeyRef.current !== void 0 && prevItemKeyRef.current !== itemKey;
71
- React.useEffect(() => {
69
+ let shouldSkipTransitionForRecycleReuse = false;
70
+ if (recycleItems && layoutTransition) {
71
+ const itemKeySignal = `containerItemKey${id}`;
72
+ const itemKey = peek$(ctx, itemKeySignal);
73
+ shouldSkipTransitionForRecycleReuse = itemKey !== void 0 && prevItemKeyRef.current !== void 0 && prevItemKeyRef.current !== itemKey;
72
74
  if (itemKey !== void 0) {
73
75
  prevItemKeyRef.current = itemKey;
74
76
  }
75
- }, [itemKey]);
77
+ } else {
78
+ prevItemKeyRef.current = void 0;
79
+ }
76
80
  const viewStyle = React.useMemo(
77
81
  () => [style, horizontal ? { left: positionValue } : { top: positionValue }],
78
82
  [horizontal, positionValue, style]
@@ -146,6 +150,7 @@ var LegendListForwardedRef = typedMemo(
146
150
  const legendListProps = {
147
151
  ...rest,
148
152
  positionComponentInternal,
153
+ recycleItems,
149
154
  ...shouldUseReanimatedScrollView ? {
150
155
  renderScrollComponent: renderReanimatedScrollComponent,
151
156
  stickyPositionComponentInternal
package/section-list.d.ts CHANGED
@@ -474,6 +474,8 @@ type LegendListState = {
474
474
  endBuffered: number;
475
475
  isAtEnd: boolean;
476
476
  isAtStart: boolean;
477
+ isEndReached: boolean;
478
+ isStartReached: boolean;
477
479
  listen: <T extends LegendListListenerType>(listenerType: T, callback: (value: ListenerTypeValueMap[T]) => void) => () => void;
478
480
  listenToPosition: (key: string, callback: (value: number) => void) => () => void;
479
481
  positionAtIndex: (index: number) => number;