Skip to content
Merged
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
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ and adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).

- Update internal dependency and fixture app to `[email protected]`.
- https://github.com/Shopify/flash-list/pull/1076
- Fix stale reference to onScroll and onLoad
- https://github.com/Shopify/flash-list/pull/1112

## [1.6.4] - 2024-03-18

Expand Down
7 changes: 5 additions & 2 deletions src/MasonryFlashList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,9 @@ const MasonryFlashListComponent = React.forwardRef(

const totalColumnFlex = useTotalColumnFlex(dataSet, props);

const propsRef = useRef(props);
propsRef.current = props;

const onScrollRef = useRef<OnScrollCallback[]>([]);
const emptyScrollEvent = useRef(getEmptyScrollEvent())
.current as NativeSyntheticEvent<MasonryFlashListScrollEvent>;
Expand All @@ -135,7 +138,7 @@ const MasonryFlashListComponent = React.forwardRef(
onScrollCallback?.(emptyScrollEvent);
});
if (!scrollEvent.nativeEvent.doNotPropagate) {
props.onScroll?.(scrollEvent);
propsRef.current.onScroll?.(scrollEvent);
}
}
).current;
Expand All @@ -151,7 +154,7 @@ const MasonryFlashListComponent = React.forwardRef(
onScrollProxy?.(emptyScrollEvent);
emptyScrollEvent.nativeEvent.doNotPropagate = false;
}, 32);
props.onLoad?.(args);
propsRef.current.onLoad?.(args);
}).current;

const [parentFlashList, getFlashList] =
Expand Down