1.0.3 • Published 2 years ago

chat-virtualized-list v1.0.3

Weekly downloads
-
License
ISC
Repository
github
Last release
2 years ago

INSTALL

npm install chat-virtualized-list

or

yarn add chat-virtualized-list

Using

import { VirtualizedList } from 'chat-virtualized-list';

<VirtualizedList
    data={data}
    dataLength={data.length}
    height="100%"
    inverse={true}
    hasMorePrev={canUpdatePrev}
    prev={requestPrevChunk}
    hasMoreNext={canUpdateNext}
    next={requestNextChunk}
>
    {(message, index) => {
        <div>
            {message.text}
        </div>
    }
</VirtualizedList>

Properties

ProptypeDescriptionDefault value
heightCSSCSS heightrequired
dataArray\<T>data array for render messagesrequired
dataLengthnumbernumber of items in the listrequired
children(item: T, index: number) => React.ReactNodea function that returns a node for rendering an elementrequired
classNamestringadd any custom class you want""
styleCSSPropertiesadd any custom styles you want{}
hasMoreNextboolean or undefinedtells the VirtualizedList component whether it can call the next function when it reaches the bottom of the scrollundefined
next() => anycalled when the bottom of the scroll is reached if hasMoreNext === trueundefined
hasMorePrevboolean or undefinedtells the VirtualizedList component whether it can call the prev function when it reaches the top of the scrollundefined
prev() => anycalled when the top of the scroll is reached if hasMorePrev === trueundefined
getKey(item: T, index: number) => stringget react key for list itemundefined
thresholdnumberA threshold value that determines when infinite scrolling will trigger the next call0.8
inversebooleanexpand the scroll from the topfalse
idForScrollstringscrolls to the specified id. the id must be specified in the dom elementundefined
1.0.3

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago