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

recyclerlist

v1.0.1

Published

这是一款基于@tarojs/components/virtual-list组件实现的高性能列表组件,除性能优化之外,亦扩展了大量API以尽可能满足大部分应用场景。

Downloads

4

Readme

RecyclerListView

这是一款基于@tarojs/components/virtual-list组件实现的高性能列表组件,除性能优化之外,亦扩展了大量API以尽可能满足大部分应用场景。

npm install --save recyclerlist

简介

recyclerlist在@tarojs/components/virtual-list的基础上改造而来,整体思路为延续其展示可视区域,销毁非可视区域元素的思路,并结合recyclerlistview的内存复用机制对其性能进行调优,其中原理下面我会提到。当然做这些工作的前提是virtual-list组件对子组件绝对布局的支持。

实现了哪些功能

  • 多列自定义高度瀑布流
    • 瀑布流
    • item高度自定义
  • 支持渲染Header
  • 新增分页事件监听onEndReached
  • 内存复用
    原理一句话:将old dom的key赋值给new dom

Demo

// 引用
import RecyclerList from 'recyclerlist';

// props使用
<RecyclerList
  width={width}
  height={height}
  itemData={list}
  itemCount={list.length}
  itemHeight={({ item, index }) => itemHeight({ item, index })}
  itemKey={({item, index}) => itemKey({item, index})}
  itemType={({item, index}) => itemType({item, index})}
  renderHeader={renderHeader}
  makeHeaderHeight={123}
  numColumns={2}
  onEndReached={onEndReached}
>
  {props => renderItem(props)}
</RecyclerList>

Props

| Prop | Required | Params Type | Description | | --- | --- | --- | --- | | width | yes | number | 列表窗口宽度 | | height | yes | numer | 列表窗口高度 | | itemData | yes | array | 列表数据 | | itemCount | yes | number | 列表数据长度 | | itemHeight | yes | (params: { item: object, index: number }) => number | number | item高度 | | itemKey | yes | (params: { item: object, index: number }) => any | item唯一标识,内存复用机制关键参数,务必保持唯一性 | | itemType | yes | (params: { item: object, index: number }) => any | item类型,如1:文字、2:图片、3:视频,内存复用机制关键参数,务必谨慎对待 | | renderHeader | No | () => JSX.Element | 渲染Header | | makeHeaderHeight | No | number | renderHeader、makeHeaderHeight务必成对出现 | | numColumns | Yes | number | 列数,默认值为1 | | onEndReached | No | () => void | 监听分页事件 |

Note:详细api说明请参考源码。