overscanRowCount - Number of rows to render above/below the visible bounds of the list. This can help reduce flickering during scrolling on certain browsers/devices.

オープン
#171 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
3/5
見積もり時間
1〜2日
初心者へのやさしさ
25/100
issue の種類
機能追加
明瞭さ
おおむね明確
活発さ
停滞
技術スタック
react, typescript
領域
frontend

調査の方向性

例に示されている VirtualList のエントリポイントから始め、表示される行と動的なアイテムの高さがどのように処理されているかを調べてください。Issue にはファイルもテストも指定されていません。完了条件は、overscanRowCount オプションを公開し、コンテンツに依存して高さが決まるチャットメッセージのちらつきを減らすことです。

索引モデルが issue の本文から書いたものです。

説明

I have a list of chat messages. The message height depends on the content.

My code is below. And everything seems to work well, but there is one moment, I can’t find the "overscanRowCount" property. Number of rows to render above/below the visible bounds of the list. This can help reduce flickering during scrolling on certain browsers/devices.

Can you do something about the flicker?

const Message = ({ i }: any, ref: any) => {
    return (
        <div
            ref={ref}
            style={{
                border: "1px solid gray",
            }}
        >
            <Avatar />
            message {i}
            // Dynamic height by content
            {i % 2 ? <div style={{ height: 100 }} /> : null}
        </div>
    );
};
const ForwardMessage = React.forwardRef(Message);

const Chat = () => {
      const listRef = React.useRef<any>(null);
      const size = useSize();
  
      // Infinite scroll
      const onScroll = (e: any) => {
          if (e.target.scrollHeight - e.target.scrollTop === size?.height) {
              appendData();
          }
      };
    
        <VirtualList
            ref={listRef}
            data={data}
            height={size?.height}
            itemHeight={30}
            itemKey="email"
            onScroll={onScroll}
        >
            {(item: any, i: any) => <ForwardMessage i={i} {...item} />}
        </VirtualList>
  }
主要言語
TypeScript
スター
815
フォーク
175
平均マージ
1日 13時間
マージ済み PR(30日)
2

環境構築

このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

react-component/virtual-list のほかの issue

react-component/virtual-list の issue をすべて見る

似ている issue

TypeScript の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。