@shopify/flash-list 2.0.0-rc.4 → 2.0.0-rc.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (32) hide show
  1. package/dist/index.d.ts +1 -1
  2. package/dist/index.d.ts.map +1 -1
  3. package/dist/index.js +2 -2
  4. package/dist/index.js.map +1 -1
  5. package/dist/recyclerview/RecyclerView.d.ts.map +1 -1
  6. package/dist/recyclerview/RecyclerView.js +20 -5
  7. package/dist/recyclerview/RecyclerView.js.map +1 -1
  8. package/dist/recyclerview/RecyclerViewContextProvider.d.ts +37 -3
  9. package/dist/recyclerview/RecyclerViewContextProvider.d.ts.map +1 -1
  10. package/dist/recyclerview/RecyclerViewContextProvider.js +4 -0
  11. package/dist/recyclerview/RecyclerViewContextProvider.js.map +1 -1
  12. package/dist/recyclerview/RecyclerViewManager.d.ts +3 -1
  13. package/dist/recyclerview/RecyclerViewManager.d.ts.map +1 -1
  14. package/dist/recyclerview/RecyclerViewManager.js +12 -3
  15. package/dist/recyclerview/RecyclerViewManager.js.map +1 -1
  16. package/dist/recyclerview/components/StickyHeaders.js +1 -1
  17. package/dist/recyclerview/components/StickyHeaders.js.map +1 -1
  18. package/dist/recyclerview/hooks/useRecyclerViewController.d.ts.map +1 -1
  19. package/dist/recyclerview/hooks/useRecyclerViewController.js +5 -2
  20. package/dist/recyclerview/hooks/useRecyclerViewController.js.map +1 -1
  21. package/dist/recyclerview/hooks/useUnmountFlag.d.ts.map +1 -1
  22. package/dist/recyclerview/hooks/useUnmountFlag.js +1 -0
  23. package/dist/recyclerview/hooks/useUnmountFlag.js.map +1 -1
  24. package/dist/tsconfig.tsbuildinfo +1 -1
  25. package/package.json +1 -1
  26. package/src/index.ts +1 -1
  27. package/src/recyclerview/RecyclerView.tsx +19 -6
  28. package/src/recyclerview/RecyclerViewContextProvider.ts +42 -3
  29. package/src/recyclerview/RecyclerViewManager.ts +10 -4
  30. package/src/recyclerview/components/StickyHeaders.tsx +1 -1
  31. package/src/recyclerview/hooks/useRecyclerViewController.tsx +7 -2
  32. package/src/recyclerview/hooks/useUnmountFlag.ts +1 -0
@@ -171,7 +171,7 @@ export const StickyHeaders = <TItem,>({
171
171
  transform: [{ translateY }],
172
172
  }}
173
173
  >
174
- {currentStickyIndex !== -1 ? (
174
+ {currentStickyIndex !== -1 && currentStickyIndex < data.length ? (
175
175
  <ViewHolder
176
176
  index={currentStickyIndex}
177
177
  item={data[currentStickyIndex]}
@@ -167,7 +167,11 @@ export function useRecyclerViewController<T>(
167
167
  firstVisibleItemLayout.current = {
168
168
  ...recyclerViewManager.getLayout(currentIndexOfFirstVisibleItem),
169
169
  };
170
- if (diff !== 0 && !pauseOffsetCorrection.current) {
170
+ if (
171
+ diff !== 0 &&
172
+ !pauseOffsetCorrection.current &&
173
+ !recyclerViewManager.animationOptimizationsEnabled
174
+ ) {
171
175
  // console.log("diff", diff, firstVisibleItemKey.current);
172
176
  if (PlatformConfig.supportsOffsetCorrection) {
173
177
  // console.log("scrollBy", diff);
@@ -386,6 +390,7 @@ export function useRecyclerViewController<T>(
386
390
  const performScrollStep = (currentStep: number) => {
387
391
  // Check if component is unmounted or we've completed all steps
388
392
  if (isUnmounted.current) {
393
+ resolve();
389
394
  return;
390
395
  } else if (currentStep >= steps) {
391
396
  // All steps completed, perform final scroll
@@ -542,7 +547,7 @@ export function useRecyclerViewController<T>(
542
547
  * Disables item recycling in preparation for layout animations.
543
548
  */
544
549
  prepareForLayoutAnimationRender: () => {
545
- recyclerViewManager.disableRecycling(true);
550
+ recyclerViewManager.animationOptimizationsEnabled = true;
546
551
  },
547
552
  };
548
553
  }, [
@@ -16,6 +16,7 @@ export const useUnmountFlag = () => {
16
16
  // Use layoutEffect to set up cleanup on unmount
17
17
  // This ensures the flag is set before any other cleanup effects run
18
18
  useLayoutEffect(() => {
19
+ isUnmounted.current = false;
19
20
  // Cleanup function that runs when the component unmounts
20
21
  return () => {
21
22
  isUnmounted.current = true;