Skip to content

Commit 485c2da

Browse files
authored
docs: remove unneeded warning and calculate image widths to prevent overlapping (adobe#9866)
* docs: remove unneeded warning and calculate image widths to prevent overlapping * remove unused imports
1 parent 144befe commit 485c2da

File tree

1 file changed

+1
-7
lines changed

1 file changed

+1
-7
lines changed

packages/dev/s2-docs/pages/react-aria/Virtualizer.mdx

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ export default Layout;
33

44
import docs from 'docs:react-aria-components';
55
import {GroupedPropTable} from '../../src/PropTable';
6-
import {InlineAlert, Heading, Content} from '@react-spectrum/s2';
76

87
export const tags = ['windowing', 'list', 'grid', 'infinite'];
98
export const description = 'Renders a scrollable collection of data using customizable layouts.';
@@ -42,11 +41,6 @@ for (let i = 0; i < 5000; i++) {
4241

4342
Virtualizer uses <TypeLink links={docs.links} type={docs.exports.Layout} /> objects to determine the position and size of each item, and provide the list of currently visible items. When using a Virtualizer, all items are positioned by the `Layout`, and CSS layout properties such as flexbox and grid do not apply.
4443

45-
<InlineAlert variant="notice" maxWidth={600}>
46-
<Heading>Virtualized components must have a defined size</Heading>
47-
<Content>This may be an explicit CSS `width` and `height`, or an implicit size (e.g. percentage or `flex`) bounded by an ancestor element. Without a bounded size, all items will be rendered to the DOM, negating the performance benefits of virtualized scrolling.</Content>
48-
</InlineAlert>
49-
5044
### List
5145

5246
`ListLayout` places items along its orientation. Rows can be fixed or variable in size. When using a variable size, set the `estimatedRowSize` to a reasonable guess for how tall or wide the rows will be on average. This allows the size of the scrollbar to be calculated.
@@ -322,7 +316,7 @@ for (let i = 0; imageOptions.length < 500; i++) {
322316
items={imageOptions}
323317
style={{display: 'block', padding: 0, height: 250}}>
324318
{(item) => (
325-
<ListBoxItem textValue={item.title} aria-label={item.title} style={{height: '100%', padding: 12, overflow: 'hidden', boxSizing: 'border-box', border: '2px solid var(--border-color)', borderRadius: 8}}>
319+
<ListBoxItem textValue={item.title} aria-label={item.title} style={{width: Math.round(200 * Number(item.aspectRatio) + 24), height: '100%', padding: 12, overflow: 'hidden', boxSizing: 'border-box', border: '2px solid var(--border-color)', borderRadius: 8}}>
326320
<img src={item.image} alt="" style={{maxHeight: 200, aspectRatio: item.aspectRatio, borderRadius: 4}} />
327321
</ListBoxItem>
328322
)}

0 commit comments

Comments
 (0)