反应Virtuoso。以相反的顺序渲染项目

时间:2020-06-04 09:20:03

标签: reactjs typescript

<Virtuoso
            ref={virt}
            style={{ width: '100%', height: '100%' }}
            totalCount={GlobalState.messages.length}
            item={index => <MessageRow index={index} />}
            initialItemCount={20}

            endReached={async () => {
              // await API.get('messages', { chatid: sc['id'] , offset : ++page }).then(msgs => {
              //   GlobalState.messages = (msgs.data as any[]).concat(GlobalState.messages);
              // })
            }}
          />

上面是用于在聊天页面上显示react-virtuoso组件的代码。我想启用列表中的“加载以前的消息”功能。我该怎么做。

0 个答案:

没有答案