Skip to content

Commit

Permalink
Move shouldRefreshWithAnchoring configuration so it is possible to di…
Browse files Browse the repository at this point in the history
…sable it from outside FlashList by invalidating layout.
  • Loading branch information
mauriciomeirelles committed Oct 19, 2023
1 parent 0ad7903 commit 56ab0d2
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@ and adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).

## [Unreleased]

## [1.6.2] - 2023-10-19

- Move shouldRefreshWithAnchoring configuration so it is possible to disable it from outside FlashList by invalidating layout
- https://github.com/Shopify/flash-list/pull/935

## [1.6.1] - 2023-09-14

- Prevent an expired layout provider from being used again
Expand Down
10 changes: 7 additions & 3 deletions src/FlashList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -173,10 +173,14 @@ class FlashList<T> extends React.PureComponent<
newState.numColumns,
nextProps
);
// RLV retries to reposition the first visible item on layout provider change.
// It's not required in our case so we're disabling it
newState.layoutProvider.shouldRefreshWithAnchoring = false;
}

// RLV retries to reposition the first visible item on layout provider change.
// It's not required in our case so we're disabling it
newState.layoutProvider.shouldRefreshWithAnchoring = Boolean(
!prevState.layoutProvider?.hasExpired
);

if (nextProps.data !== prevState.data) {
newState.data = nextProps.data;
newState.dataProvider = prevState.dataProvider.cloneWithRows(
Expand Down

0 comments on commit 56ab0d2

Please sign in to comment.