Skip to content

Commit 8ee8471

Browse files
authored
Fix bug where listbox rect wasnt updating in async case (#6724)
1 parent 844dd7a commit 8ee8471

File tree

4 files changed

+0
-15
lines changed

4 files changed

+0
-15
lines changed

packages/@react-aria/dnd/stories/VirtualizedListBox.tsx

-1
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,6 @@ export const VirtualizedListBox = React.forwardRef(function (props: any, ref) {
168168
{...mergeProps(collectionProps, listBoxProps)}
169169
ref={domRef}
170170
className={classNames(dndStyles, 'droppable-collection', 'is-virtualized', {'is-drop-target': isDropTarget})}
171-
sizeToFit="height"
172171
scrollDirection="vertical"
173172
layout={layout}
174173
collection={state.collection}

packages/@react-aria/virtualizer/src/ScrollView.tsx

-10
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@ interface ScrollViewProps extends HTMLAttributes<HTMLElement> {
3333
onVisibleRectChange: (rect: Rect) => void,
3434
children?: ReactNode,
3535
innerStyle?: CSSProperties,
36-
sizeToFit?: 'width' | 'height',
3736
onScrollStart?: () => void,
3837
onScrollEnd?: () => void,
3938
scrollDirection?: 'horizontal' | 'vertical' | 'both'
@@ -60,7 +59,6 @@ export function useScrollView(props: ScrollViewProps, ref: RefObject<HTMLElement
6059
contentSize,
6160
onVisibleRectChange,
6261
innerStyle,
63-
sizeToFit,
6462
onScrollStart,
6563
onScrollEnd,
6664
scrollDirection = 'both',
@@ -159,14 +157,6 @@ export function useScrollView(props: ScrollViewProps, ref: RefObject<HTMLElement
159157
let w = isTestEnv && !isClientWidthMocked ? Infinity : clientWidth;
160158
let h = isTestEnv && !isClientHeightMocked ? Infinity : clientHeight;
161159

162-
if (sizeToFit && contentSize.width > 0 && contentSize.height > 0) {
163-
if (sizeToFit === 'width') {
164-
w = Math.min(w, contentSize.width);
165-
} else if (sizeToFit === 'height') {
166-
h = Math.min(h, contentSize.height);
167-
}
168-
}
169-
170160
if (state.width !== w || state.height !== h) {
171161
state.width = w;
172162
state.height = h;

packages/@react-aria/virtualizer/src/Virtualizer.tsx

-3
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ interface VirtualizerProps<T extends object, V, O> extends Omit<HTMLAttributes<H
3030
layout: Layout<T, O>,
3131
collection: Collection<T>,
3232
persistedKeys?: Set<Key> | null,
33-
sizeToFit?: 'width' | 'height',
3433
scrollDirection?: 'horizontal' | 'vertical' | 'both',
3534
isLoading?: boolean,
3635
onLoadMore?: () => void,
@@ -43,7 +42,6 @@ function Virtualizer<T extends object, V extends ReactNode, O>(props: Virtualize
4342
renderWrapper,
4443
layout,
4544
collection,
46-
sizeToFit,
4745
scrollDirection,
4846
// eslint-disable-next-line @typescript-eslint/no-unused-vars
4947
isLoading,
@@ -81,7 +79,6 @@ function Virtualizer<T extends object, V extends ReactNode, O>(props: Virtualize
8179
contentSize={state.contentSize}
8280
onScrollStart={state.startScrolling}
8381
onScrollEnd={state.endScrolling}
84-
sizeToFit={sizeToFit}
8582
scrollDirection={scrollDirection}>
8683
{renderChildren(null, state.visibleViews, renderWrapper || defaultRenderWrapper)}
8784
</ScrollView>

packages/@react-spectrum/listbox/src/ListBoxBase.tsx

-1
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,6 @@ function ListBoxBase<T>(props: ListBoxBaseProps<T>, ref: RefObject<HTMLDivElemen
112112
ref={ref}
113113
persistedKeys={persistedKeys}
114114
autoFocus={!!props.autoFocus || undefined}
115-
sizeToFit="height"
116115
scrollDirection="vertical"
117116
className={
118117
classNames(

0 commit comments

Comments
 (0)