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 751fad1
Show file tree
Hide file tree
Showing 2 changed files with 10 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
8 changes: 5 additions & 3 deletions src/FlashList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -173,10 +173,12 @@ 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 = !!(!prevState.layoutProvider?.hasExpired);

Check failure on line 180 in src/FlashList.tsx

View workflow job for this annotation

GitHub Actions / Lint Typescript

Replace `·!!(!prevState.layoutProvider?.hasExpired)` with `⏎······!!!prevState.layoutProvider?.hasExpired`

Check failure on line 180 in src/FlashList.tsx

View workflow job for this annotation

GitHub Actions / Lint Typescript

use `Boolean(!prevState.layoutProvider?.hasExpired)` instead

Check failure on line 180 in src/FlashList.tsx

View workflow job for this annotation

GitHub Actions / Lint Typescript

use `Boolean(prevState.layoutProvider?.hasExpired)` instead

Check failure on line 180 in src/FlashList.tsx

View workflow job for this annotation

GitHub Actions / Lint Typescript

Redundant double negation

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

0 comments on commit 751fad1

Please sign in to comment.