@legendapp/list 3.0.0-beta.54 → 3.0.0-beta.56

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/reanimated.d.ts CHANGED
@@ -92,13 +92,11 @@ interface DataModeProps<ItemT, TItemType extends string | undefined> {
92
92
  */
93
93
  data: ReadonlyArray<ItemT>;
94
94
  /**
95
- * Function or React component to render each item in the list.
96
- * Can be either:
97
- * - A function: (props: LegendListRenderItemProps<ItemT>) => ReactNode
98
- * - A React component: React.ComponentType<LegendListRenderItemProps<ItemT>>
95
+ * Callback to render each item in the list.
96
+ * To use hooks in an item component, return that component from this callback.
99
97
  * @required when using data mode
100
98
  */
101
- renderItem: ((props: LegendListRenderItemProps<ItemT, TItemType>) => React.ReactNode) | React.ComponentType<LegendListRenderItemProps<ItemT, TItemType>>;
99
+ renderItem: (props: LegendListRenderItemProps<ItemT, TItemType>) => React.ReactNode;
102
100
  children?: never;
103
101
  }
104
102
  interface ChildrenModeProps {
@@ -229,6 +227,13 @@ interface LegendListSpecificProps<ItemT, TItemType extends string | undefined> {
229
227
  * Style for the header component.
230
228
  */
231
229
  ListHeaderComponentStyle?: StyleProp<ViewStyle> | undefined;
230
+ /**
231
+ * Estimated height of the ListHeaderComponent. Provide this when the expected header height
232
+ * is known before layout so that only the items actually visible below the header are rendered
233
+ * on the initial frame, rather than a full screen's worth of items that are hidden behind it.
234
+ * The measured header size still replaces this value after layout.
235
+ */
236
+ estimatedHeaderSize?: number;
232
237
  /**
233
238
  * If true, auto-scrolls to end when new items are added.
234
239
  * Use an options object to opt into specific triggers and control whether that scroll is animated.
@@ -263,6 +268,12 @@ interface LegendListSpecificProps<ItemT, TItemType extends string | undefined> {
263
268
  * @default 1
264
269
  */
265
270
  numColumns?: number;
271
+ /**
272
+ * Force RTL mode for this list instance.
273
+ * When undefined, uses React Native's global I18nManager.isRTL.
274
+ * @default undefined
275
+ */
276
+ rtl?: boolean;
266
277
  /**
267
278
  * Called when scrolling reaches the end within onEndReachedThreshold.
268
279
  */
package/reanimated.js CHANGED
@@ -36,6 +36,8 @@ var {
36
36
  typedMemo,
37
37
  useArr$,
38
38
  useCombinedRef,
39
+ useLatestRef,
40
+ useStableRenderComponent,
39
41
  getComponent
40
42
  } = reactNative.internal;
41
43
  var { peek$, useStateContext } = reactNative.internal;
@@ -48,12 +50,12 @@ var ReanimatedScrollBridge = typedMemo(function ReanimatedScrollBridgeComponent(
48
50
  const animatedScrollRef = Reanimated.useAnimatedRef();
49
51
  Reanimated.useScrollViewOffset(animatedScrollRef, scrollOffset);
50
52
  const combinedRef = useCombinedRef(animatedScrollRef, forwardedRef);
51
- const ScrollComponent = React__namespace.useMemo(
52
- () => renderScrollComponent ? React__namespace.forwardRef(
53
- (scrollViewProps, ref) => renderScrollComponent({ ...scrollViewProps, ref, scrollEventThrottle: 1 })
54
- ) : Reanimated__default.default.ScrollView,
55
- [renderScrollComponent]
56
- );
53
+ const CustomScrollComponent = useStableRenderComponent(renderScrollComponent, (scrollViewProps, ref) => ({
54
+ ...scrollViewProps,
55
+ ref,
56
+ scrollEventThrottle: 1
57
+ }));
58
+ const ScrollComponent = renderScrollComponent ? CustomScrollComponent : Reanimated__default.default.ScrollView;
57
59
  return /* @__PURE__ */ React__namespace.createElement(ScrollComponent, { ...props, ref: combinedRef });
58
60
  });
59
61
  var StickyOverlay = typedMemo(function StickyOverlayComponent({ stickyHeaderConfig }) {
@@ -218,8 +220,7 @@ var LegendListForwardedRef = typedMemo(
218
220
  },
219
221
  [scrollOffset]
220
222
  );
221
- const itemLayoutAnimationRef = React__namespace.useRef(itemLayoutAnimation);
222
- itemLayoutAnimationRef.current = itemLayoutAnimation;
223
+ const itemLayoutAnimationRef = useLatestRef(itemLayoutAnimation);
223
224
  const hasItemLayoutAnimation = !!itemLayoutAnimation;
224
225
  const positionComponentInternal = React__namespace.useMemo(() => {
225
226
  if (!hasItemLayoutAnimation) {
package/reanimated.mjs CHANGED
@@ -12,6 +12,8 @@ var {
12
12
  typedMemo,
13
13
  useArr$,
14
14
  useCombinedRef,
15
+ useLatestRef,
16
+ useStableRenderComponent,
15
17
  getComponent
16
18
  } = internal;
17
19
  var { peek$, useStateContext } = internal;
@@ -24,12 +26,12 @@ var ReanimatedScrollBridge = typedMemo(function ReanimatedScrollBridgeComponent(
24
26
  const animatedScrollRef = useAnimatedRef();
25
27
  useScrollViewOffset(animatedScrollRef, scrollOffset);
26
28
  const combinedRef = useCombinedRef(animatedScrollRef, forwardedRef);
27
- const ScrollComponent = React.useMemo(
28
- () => renderScrollComponent ? React.forwardRef(
29
- (scrollViewProps, ref) => renderScrollComponent({ ...scrollViewProps, ref, scrollEventThrottle: 1 })
30
- ) : Reanimated.ScrollView,
31
- [renderScrollComponent]
32
- );
29
+ const CustomScrollComponent = useStableRenderComponent(renderScrollComponent, (scrollViewProps, ref) => ({
30
+ ...scrollViewProps,
31
+ ref,
32
+ scrollEventThrottle: 1
33
+ }));
34
+ const ScrollComponent = renderScrollComponent ? CustomScrollComponent : Reanimated.ScrollView;
33
35
  return /* @__PURE__ */ React.createElement(ScrollComponent, { ...props, ref: combinedRef });
34
36
  });
35
37
  var StickyOverlay = typedMemo(function StickyOverlayComponent({ stickyHeaderConfig }) {
@@ -194,8 +196,7 @@ var LegendListForwardedRef = typedMemo(
194
196
  },
195
197
  [scrollOffset]
196
198
  );
197
- const itemLayoutAnimationRef = React.useRef(itemLayoutAnimation);
198
- itemLayoutAnimationRef.current = itemLayoutAnimation;
199
+ const itemLayoutAnimationRef = useLatestRef(itemLayoutAnimation);
199
200
  const hasItemLayoutAnimation = !!itemLayoutAnimation;
200
201
  const positionComponentInternal = React.useMemo(() => {
201
202
  if (!hasItemLayoutAnimation) {
package/section-list.d.ts CHANGED
@@ -148,13 +148,11 @@ interface DataModeProps<ItemT, TItemType extends string | undefined> {
148
148
  */
149
149
  data: ReadonlyArray<ItemT>;
150
150
  /**
151
- * Function or React component to render each item in the list.
152
- * Can be either:
153
- * - A function: (props: LegendListRenderItemProps<ItemT>) => ReactNode
154
- * - A React component: React.ComponentType<LegendListRenderItemProps<ItemT>>
151
+ * Callback to render each item in the list.
152
+ * To use hooks in an item component, return that component from this callback.
155
153
  * @required when using data mode
156
154
  */
157
- renderItem: ((props: LegendListRenderItemProps<ItemT, TItemType>) => React.ReactNode) | React.ComponentType<LegendListRenderItemProps<ItemT, TItemType>>;
155
+ renderItem: (props: LegendListRenderItemProps<ItemT, TItemType>) => React.ReactNode;
158
156
  children?: never;
159
157
  }
160
158
  interface ChildrenModeProps {
@@ -285,6 +283,13 @@ interface LegendListSpecificProps<ItemT, TItemType extends string | undefined> {
285
283
  * Style for the header component.
286
284
  */
287
285
  ListHeaderComponentStyle?: StyleProp<ViewStyle> | undefined;
286
+ /**
287
+ * Estimated height of the ListHeaderComponent. Provide this when the expected header height
288
+ * is known before layout so that only the items actually visible below the header are rendered
289
+ * on the initial frame, rather than a full screen's worth of items that are hidden behind it.
290
+ * The measured header size still replaces this value after layout.
291
+ */
292
+ estimatedHeaderSize?: number;
288
293
  /**
289
294
  * If true, auto-scrolls to end when new items are added.
290
295
  * Use an options object to opt into specific triggers and control whether that scroll is animated.
@@ -319,6 +324,12 @@ interface LegendListSpecificProps<ItemT, TItemType extends string | undefined> {
319
324
  * @default 1
320
325
  */
321
326
  numColumns?: number;
327
+ /**
328
+ * Force RTL mode for this list instance.
329
+ * When undefined, uses React Native's global I18nManager.isRTL.
330
+ * @default undefined
331
+ */
332
+ rtl?: boolean;
322
333
  /**
323
334
  * Called when scrolling reaches the end within onEndReachedThreshold.
324
335
  */