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 be9b605
Showing 1 changed file with 5 additions and 3 deletions.
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);

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

0 comments on commit be9b605

Please sign in to comment.