react-component / react-component/virtual-list

Dynamic line height

Open
#59 0 comments 9 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
814
Forks
171
Avg merge
1h 3m
Merged PRs (30d)
3

Description

Is it possible to have a dynamic line height or am I overlooking the feature?

What I would like to have:

const dynLineHeight = (row: any, index: number) => {
	if(index % 2 === 0){
		return 50;
	} else {
		return 25;
	}
}

<List data={[0, 1, 2]} height={200} itemHeight={this.dynLineHeight} itemKey="id">
  {index => <div>{index}</div>}
</List>;

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the List component's itemHeight API and the provided TSX example using alternating 50 and 25 pixel rows. Determine whether variable item heights are supported and what behavior is required for scrolling and rendering; done means the requested dynamic-height case is supported or its limitation is clearly documented and verified.

Written by the indexing model from the issue text.

Assessment

Tech stack
react, typescript
Domain
frontend
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.