Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions documentation/docs/fundamentals/usage.md
Original file line number Diff line number Diff line change
Expand Up @@ -875,12 +875,12 @@ Param `offset` expects the offset to scroll to. In case of `horizontal` is true,

Param `animated` (`false` by default) defines whether the list should do an animation while scrolling.

### `getVisibleIndices()`
### `computeVisibleIndices()`

Returns an array of indices that are currently visible in the list.

```tsx
getVisibleIndices(): number[];
computeVisibleIndices(): number[];
```

### `getLayout()`
Expand Down
2 changes: 1 addition & 1 deletion documentation/docs/v2-changes.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ sidebar_position: 4
- FlashList does not ask for any estimates, which makes it much easier to use.
- Horizontal Lists are much improved, and items can also resize within the lists. We no longer render an extra item to measure list height.
- In Grid layout, if side-by-side items have different heights, then the shorter item will match the height of the tallest item. This wasn't possible in v1.
- The ref of FlashList has many more useful methods like `getVisibleIndices` and `getLayout`.
- The ref of FlashList has many more useful methods like `computeVisibleIndices` and `getLayout`.
- `contentContainerStyle` prop is fully supported now.

## New hooks
Expand Down
2 changes: 1 addition & 1 deletion src/FlashListRef.ts
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,7 @@ export interface FlashListRef<T> {
* @returns An object with startIndex and endIndex properties
*
* @example
* const { startIndex, endIndex } = listRef.current?.getVisibleIndices();
* const { startIndex, endIndex } = listRef.current?.computeVisibleIndices();
* console.log(`Visible items: ${startIndex} to ${endIndex}`);
*/
computeVisibleIndices: () => { startIndex: number; endIndex: number };
Expand Down