@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/animated.d.ts CHANGED
@@ -91,13 +91,11 @@ interface DataModeProps<ItemT, TItemType extends string | undefined> {
91
91
  */
92
92
  data: ReadonlyArray<ItemT>;
93
93
  /**
94
- * Function or React component to render each item in the list.
95
- * Can be either:
96
- * - A function: (props: LegendListRenderItemProps<ItemT>) => ReactNode
97
- * - A React component: React.ComponentType<LegendListRenderItemProps<ItemT>>
94
+ * Callback to render each item in the list.
95
+ * To use hooks in an item component, return that component from this callback.
98
96
  * @required when using data mode
99
97
  */
100
- renderItem: ((props: LegendListRenderItemProps<ItemT, TItemType>) => React.ReactNode) | React.ComponentType<LegendListRenderItemProps<ItemT, TItemType>>;
98
+ renderItem: (props: LegendListRenderItemProps<ItemT, TItemType>) => React.ReactNode;
101
99
  children?: never;
102
100
  }
103
101
  interface ChildrenModeProps {
@@ -228,6 +226,13 @@ interface LegendListSpecificProps<ItemT, TItemType extends string | undefined> {
228
226
  * Style for the header component.
229
227
  */
230
228
  ListHeaderComponentStyle?: StyleProp<ViewStyle> | undefined;
229
+ /**
230
+ * Estimated height of the ListHeaderComponent. Provide this when the expected header height
231
+ * is known before layout so that only the items actually visible below the header are rendered
232
+ * on the initial frame, rather than a full screen's worth of items that are hidden behind it.
233
+ * The measured header size still replaces this value after layout.
234
+ */
235
+ estimatedHeaderSize?: number;
231
236
  /**
232
237
  * If true, auto-scrolls to end when new items are added.
233
238
  * Use an options object to opt into specific triggers and control whether that scroll is animated.
@@ -262,6 +267,12 @@ interface LegendListSpecificProps<ItemT, TItemType extends string | undefined> {
262
267
  * @default 1
263
268
  */
264
269
  numColumns?: number;
270
+ /**
271
+ * Force RTL mode for this list instance.
272
+ * When undefined, uses React Native's global I18nManager.isRTL.
273
+ * @default undefined
274
+ */
275
+ rtl?: boolean;
265
276
  /**
266
277
  * Called when scrolling reaches the end within onEndReachedThreshold.
267
278
  */
package/index.d.ts CHANGED
@@ -116,7 +116,7 @@ type BootstrapOwnedInitialScrollSession = InternalInitialScrollSessionBase & {
116
116
  type InternalInitialScrollSession = OffsetInitialScrollSession | BootstrapOwnedInitialScrollSession;
117
117
  type LegendListPropsInternal = LegendListPropsBase$1<any, Record<string, any>, string | undefined> & {
118
118
  data: readonly any[];
119
- renderItem: ((props: LegendListRenderItemProps$1<any, string | undefined>) => React.ReactNode) | React.ComponentType<LegendListRenderItemProps$1<any, string | undefined>>;
119
+ renderItem: (props: LegendListRenderItemProps$1<any, string | undefined>) => React.ReactNode;
120
120
  };
121
121
  interface PendingDataComparison {
122
122
  byIndex: Array<0 | 1 | 2 | undefined>;
@@ -147,6 +147,9 @@ interface InternalState$1 {
147
147
  endNoBuffer: number;
148
148
  endReachedSnapshot: ThresholdSnapshot$1 | undefined;
149
149
  firstFullyOnScreenIndex: number;
150
+ preservedEndAnchorCorrection?: {
151
+ lastRequestTime?: number;
152
+ };
150
153
  hasScrolled?: boolean;
151
154
  idCache: string[];
152
155
  idsInView: string[];
@@ -166,6 +169,8 @@ interface InternalState$1 {
166
169
  isStartReached: boolean | null;
167
170
  lastBatchingAction: number;
168
171
  lastLayout: LayoutRectangle$1 | undefined;
172
+ lastNativeScroll?: number;
173
+ lastNativeScrollTime?: number;
169
174
  lastScrollAdjustForHistory?: number;
170
175
  lastScrollDelta: number;
171
176
  loadStartTime: number;
@@ -210,6 +215,7 @@ interface InternalState$1 {
210
215
  time: number;
211
216
  }>;
212
217
  scrollingTo?: InternalScrollTarget | undefined;
218
+ horizontalRTLScrollType?: "normal" | "inverted" | "negative";
213
219
  scrollLastCalculate?: number;
214
220
  scrollLength: number;
215
221
  scrollPending: number;
@@ -254,6 +260,7 @@ interface InternalState$1 {
254
260
  getFixedItemSize: LegendListPropsInternal["getFixedItemSize"];
255
261
  getItemType: LegendListPropsInternal["getItemType"];
256
262
  horizontal: boolean;
263
+ rtl?: boolean;
257
264
  initialContainerPoolRatio: number;
258
265
  itemsAreEqual: LegendListPropsInternal["itemsAreEqual"];
259
266
  keyExtractor: LegendListPropsInternal["keyExtractor"];
@@ -279,6 +286,8 @@ interface InternalState$1 {
279
286
  stickyIndicesArr: number[];
280
287
  stickyIndicesSet: Set<number>;
281
288
  stylePaddingBottom: number | undefined;
289
+ stylePaddingLeft: number | undefined;
290
+ stylePaddingRight: number | undefined;
282
291
  stylePaddingTop: number | undefined;
283
292
  useWindowScroll: boolean;
284
293
  };
@@ -415,13 +424,11 @@ interface DataModeProps<ItemT, TItemType extends string | undefined> {
415
424
  */
416
425
  data: ReadonlyArray<ItemT>;
417
426
  /**
418
- * Function or React component to render each item in the list.
419
- * Can be either:
420
- * - A function: (props: LegendListRenderItemProps<ItemT>) => ReactNode
421
- * - A React component: React.ComponentType<LegendListRenderItemProps<ItemT>>
427
+ * Callback to render each item in the list.
428
+ * To use hooks in an item component, return that component from this callback.
422
429
  * @required when using data mode
423
430
  */
424
- renderItem: ((props: LegendListRenderItemProps$1<ItemT, TItemType>) => React.ReactNode) | React.ComponentType<LegendListRenderItemProps$1<ItemT, TItemType>>;
431
+ renderItem: (props: LegendListRenderItemProps$1<ItemT, TItemType>) => React.ReactNode;
425
432
  children?: never;
426
433
  }
427
434
  interface ChildrenModeProps {
@@ -552,6 +559,13 @@ interface LegendListSpecificProps<ItemT, TItemType extends string | undefined> {
552
559
  * Style for the header component.
553
560
  */
554
561
  ListHeaderComponentStyle?: StyleProp$1<ViewStyle$1> | undefined;
562
+ /**
563
+ * Estimated height of the ListHeaderComponent. Provide this when the expected header height
564
+ * is known before layout so that only the items actually visible below the header are rendered
565
+ * on the initial frame, rather than a full screen's worth of items that are hidden behind it.
566
+ * The measured header size still replaces this value after layout.
567
+ */
568
+ estimatedHeaderSize?: number;
555
569
  /**
556
570
  * If true, auto-scrolls to end when new items are added.
557
571
  * Use an options object to opt into specific triggers and control whether that scroll is animated.
@@ -586,6 +600,12 @@ interface LegendListSpecificProps<ItemT, TItemType extends string | undefined> {
586
600
  * @default 1
587
601
  */
588
602
  numColumns?: number;
603
+ /**
604
+ * Force RTL mode for this list instance.
605
+ * When undefined, uses React Native's global I18nManager.isRTL.
606
+ * @default undefined
607
+ */
608
+ rtl?: boolean;
589
609
  /**
590
610
  * Called when scrolling reaches the end within onEndReachedThreshold.
591
611
  */