npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

react-list-any-height

v0.3.0

Published

react-list-any-height

Downloads

4

Readme

react-list-any-height

React scroll list for item with any height.

Example: https://wangtao0101.github.io/react-list-any-height/

Motivation

react virtualized and react-infinite can only handle list with fixed height, but that may not always be the case.

Install

npm install react-list-any-height --save
yarn add react-list-any-height

Basic Use

Elements of Any Height

As we don't know the height of all row before the row had been rendered, we figure out the height of contianer by using minRowHeight.

<AnyHeight
    dataSource={dataSource}
    minRowHeight={100}
    rowRender={(index, style) => (
        <div className="hover-row" style={style)}></div>
    )}
/>

How to work

We figure out the origin height of contianer by using minRowHeight. After you scroll and the more row will be rendered, we using new heights to update component in next scrolling.

Note on Smooth Scrolling

minRowHeight should be set reasonable, otherwise if you scroll to end fastly and then you scroll to up slowly, then page will jump.

Api

dataSource

the data array, isRequired

minRowHeight

The minimum height of all rows, isRequired

height

The height of scrolling contianer, default to 300.

preloadBatchSize

The items rendered out of contianer, default to 5.

style

The style of contianer, default to style: { width: '100%' }.

rowStyle

The style of row

rowRender

A function for rendering a row, isRequired

timeScrollStateLastsForAfterUserScrolls(same as react-infinite)

Defaults to 150 (in milliseconds). On Apple and some other devices, scroll is inertial. This means that the window continues to scroll for several hundred milliseconds after an onScroll event is fired. To prevent janky behavior, we do not want pointer-events to reactivate before the window has finished moving. Setting this parameter causes the Infinite component to think that the user is still scrolling for the specified number of milliseconds after the last onScroll event is received.

Thanks

Some code from react-infinite

Roadmap

  • [ ] full test
  • [ ] Using the Window to Scroll