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

@legendapp/list

v0.5.8

Published

legend-list

Downloads

2,669

Readme

Legend List

Legend List aims to be a drop-in replacement for FlatList with much better performance and supporting dynamically sized items.

Caution: Experimental

This is an early release to test and gather feedback. It's not used in production yet and needs more work to reach parity with FlatList features.

Features

In addition to normal FlatList features:

  • Dynamic layouts supported. Just use the estimatedItemSize prop to give a close estimate so that layouts aren't too far off, and positions will adjust while rendering.
  • maintainScrollAtEnd: If true and scroll is within maintainScrollAtEndThreshold * screen height then changing items or heights will scroll to the bottom. This can be useful for chat interfaces.
  • recycleItems prop enables toggling recycling of list items. If enabled it will reuse item components for improved performance, but it will reuse any local state in items. So if you have local state in items you likely want this disabled.

Usage

Install

bun add @legendapp/list or npm install @legendapp/list or yarn add @legendapp/list

Props

We suggest using all of the required props and additionally keyExtractor to improve performance when adding/removing items.

Required

interface PropsRequired {
    data: ArrayLike<any> & T[];
    renderItem: (props: LegendListRenderItemInfo<T>) => ReactNode;
    estimatedItemSize: number;
}

Optional

interface PropsOptional {
    initialScrollOffset?: number;
    initialScrollIndex?: number;
    drawDistance?: number;
    initialContainers?: number;
    recycleItems?: boolean;
    onEndReachedThreshold?: number | null | undefined;
    maintainScrollAtEnd?: boolean;
    maintainScrollAtEndThreshold?: number;
    onEndReached?: ((info: { distanceFromEnd: number }) => void) | null | undefined;
    keyExtractor?: (item: T, index: number) => string;
}

How to build

npm run build will build the package to the dist folder.

How to run example

  1. cd example
  2. npm i
  3. npm run bootstrap-start

PRs gladly accepted!

There's not a lot of code here so hopefully it's easy to contribute. If you want to add a missing feature or fix a bug please post an issue to see if development is already in progress so we can make sure to not duplicate work 😀.

TODO list

  • onViewableItemsChanged
  • Adjust scroll when item heights change above the viewable area so they don't jump
  • A prop to start with items at the bottom like a chat interface, just needs to pad the top with screen height - items height
  • Other important missing features from FlatList or other lists libraries
  • Optimizations:
    • Loop over only potentially changed items when adjusting heights rather than data array

Community

Join us on Discord to get involved with the Legend community.

👩‍⚖️ License

MIT