react-infinite-scroller icon indicating copy to clipboard operation
react-infinite-scroller copied to clipboard

Is it possible to render it as a React Fragment with the element prop?

Open NinjaOnRails opened this issue 6 years ago • 3 comments

Is this possible right now? I've tried passing it in in different forms but can't get it to work. Rendering it as the default div element is breaking all of the styling

NinjaOnRails avatar Nov 14 '19 19:11 NinjaOnRails

Also need this....

rodrigograca31 avatar Nov 21 '19 12:11 rodrigograca31

Use element prop like this element='div' (default div tag, you can change it to anything else, ul for example). And apply style prop to the component:

<InfiniteScroll
            element='ul' // define element here
            style={{
                display: 'flex'
            }} // define custom styles
            pageStart={0}
            loadMore={loadFunc}
            hasMore={true || false}
            loader={<div className="loader" key={0}>Loading ...</div>}
            useWindow={false}
            getScrollParent={() => this.scrollParentRef}
        >
            {items}
        </InfiniteScroll>

ghost avatar Jun 21 '20 18:06 ghost

Same here, it completely breaks my styles, I'm using mui and I just can't add my styles on top, please add option to create fragment

ph1losof avatar Jun 27 '22 14:06 ph1losof