bvaughn / react-virtualized-auto-sizer

Standalone version of the AutoSizer component from react-virtualized
MIT License
603 stars 82 forks source link

Typings for conditional `disableHeight` and `disableWidth` #73

Closed DenizUgur closed 1 year ago

DenizUgur commented 1 year ago

These props should accept boolean and children props type can utilize Partial if there is no better option.

bvaughn commented 1 year ago

The types were intentionally chosen as explained in comments like this one https://github.com/bvaughn/react-virtualized-auto-sizer/pull/71#issuecomment-1638437808. It's okay if you don't agree, but I'm not going to change them based on a subjective assertion.

DenizUgur commented 1 year ago

I understand that you may not want to change it. It's just that following use case works without a problem but types indicate there is a problem. I see this as a reasonable use case for responsiveness. If you have any other suggestion, please let me know.

<AutoSizer disableHeight={mobile}>
    {({ height, width }) => {
        return (
            <List
                height={height || 500}
                itemCount={items.length}
                itemData={items}
                itemSize={26}
                width={width}
            >
                {Row}
            </List>
        );
    }}
</AutoSizer>