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-native-waterfall-layout

v1.0.3

Published

React Native 瀑布流组件

Downloads

4

Readme

react-native-waterfall-layout

基于react-native官方组件封装的瀑布流组件

Preview

iOS

iOS

Android

Android

Getting started

1.安装

$ npm i react-native-waterfall-layout --save

2.导入

import Waterfall from 'react-native-waterfall-layout';

Properties

| Prop | Default | Type | Description | |:-----------------:|:--------------:|:-----------------:|:------------------------------:| | columns | 2 | Number | 瀑布流的列数 | | space | 10 | Number | 瀑布流每列之间的间隔 | | renderIte | null | Function | 用于自定义瀑布流中每一项的内容 | |keyExtractor | null | Function | 为给定的item生成一个不重复的key。若不指定此函数,则默认抽取item.key作为key值。若item.key也不存在,则使用数组下标index| |refresh | true | Boolean | 是否启用下拉刷新| |refreshing | (done) =>{} | Function | 下拉刷新触发该函数,接收一个done函数用于结束刷新| |refreshConf | | Object | 下拉刷新参数,配置详见RefreshControl| |infinite | true | Boolean | 是否启用滚动加载| |infiniting | (done) => {} | Function | 滚动到列表底部触发该函数,接收参数同refreshing| |hasMore | true | Boolean | 设置为false滚动到列表底部后将不触发infiniting| |renderInfinite | | Function | 用于自定义滚动加载组件及样式,接收一个loading用于判断是否正在加载|

Methods

addItems

添加Items到瀑布流中,其中Item的高度自动计算出来,将Item添加到最矮的列中,所以会导致Items依次渲染。

this.refs.waterfall.addItems([

    {name: 'Item1'}, 

    {name: 'Item2'}

])
addItemWithHeight

添加 items 到瀑布流组件中,item的高度也将自动确定,但需要在每个item对象的数据中添加height属性,该属性不是item渲染后的实际高度,而是作为item分配列的算法参考值。和addItems不一样的是,是批量渲染的

this.refs.waterfall.addItemsWithHeight([

      {name:"Item1", height: 210 },

      {name:"Item2", height: 150 }

]);
clear

清除瀑布流中的所有项

this.refs.waterfall.clear();

Example

点击Demo查看