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: 1 addition & 1 deletion packages/react-aria/src/virtualizer/useVirtualizerItem.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ export function useVirtualizerItem(options: VirtualizerItemOptions): {updateSize
if (layoutInfo?.estimatedSize) {
updateSizeEvent();
}
}, [layoutInfo?.estimatedSize]);
});

// TODO: Consider using a MutationObserver in addition to ResizeObserver to detect
// when inner DOM structure changes cause an item's height to change.
Expand Down
8 changes: 0 additions & 8 deletions packages/react-stately/src/virtualizer/Layout.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import {InvalidationContext} from './types';
import {ItemDropTarget, Key, LayoutDelegate, Node} from '@react-types/shared';
import {LayoutInfo} from './LayoutInfo';
import {Rect} from './Rect';
import {ScrollAnchorInfo} from './ScrollAnchor';
import {Size} from './Size';
import {Virtualizer} from './Virtualizer';

Expand Down Expand Up @@ -74,13 +73,6 @@ export abstract class Layout<T extends object = Node<any>, O = any> implements L
return newOptions !== oldOptions;
}

/**
* Describes the edge-anchoring this layout wants, if any. Returning null (or omitting this
* method) disables scroll-anchoring entirely — the virtualizer's generic anchor-tracking logic
* is skipped.
*/
UNSTABLE_getScrollAnchorInfo?(_layoutOptions?: O): ScrollAnchorInfo | null;

/**
* This method allows the layout to perform any pre-computation
* it needs to in order to prepare LayoutInfos for retrieval.
Expand Down
1 change: 1 addition & 0 deletions packages/react-stately/src/virtualizer/Virtualizer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,7 @@ export class Virtualizer<T extends object, V> {
}

private relayout(context: InvalidationContext = {}) {
// @ts-ignore
let anchorInfo = this.layout.UNSTABLE_getScrollAnchorInfo?.(context.layoutOptions) ?? null;

// Capture scroll anchor from current (pre-layout) view positions.
Expand Down
Loading