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

@dfeidao/fd-m000019

v4.6.201907081542

Published

分组列表组件 SectionList

Downloads

4

Readme

Installation

yarn add --dev @dfeidao/fd-m000019

fd-m000019 分组列表组件SectionList

import SectionList from '@dfeidao/fd-m000019';

<SectionList
	renderItem={({ item, index }) => <Text key={index}>{item as ReactNode}</Text>}
	renderSectionHeader={({ section: { title } }) => (
		<Text style={{ fontWeight: 'bold' }}>{title}</Text>
	)}
	sections={[
		{ title: 'Title1', data: ['item1', 'item2'] },
		{ title: 'Title2', data: ['item3', 'item4'] },
		{ title: 'Title3', data: ['item5', 'item6'] }
	]}
	keyExtractor={(item, index) => (item as string) + index}
/>

Installation

yarn add --dev @dfeidao/fd-m000019

Attributes

sections

用来渲染的数据,类似于FlatList中的data属性。

renderItem

用来渲染每一个section中的每一个列表项的默认渲染器。可以在section级别上进行覆盖重写。必须返回一个react组件。

renderSectionHeader

在每个section的头部渲染。在iOS上,这些headers是默认粘接在ScrollView的顶部的.

ItemSeparatorComponent

行与行之间的分隔线组件不会出现在第一行之前和最后一行之后

ListEmptyComponent

列表为空时渲染该组件

ListFooterComponent

尾部组件

ListHeaderComponent

头部组件

initialNumToRender

指定一开始渲染的元素数量,最好刚刚够填满一个屏幕,这样保证了用最短的时间给用户呈现可见的内容。注意这第一批次渲染的元素不会在滑动过程中被卸载,这样是为了保证用户执行返回顶部的操作时,不需要重新渲染首批元素。

onEndReached

当列表被滚动到距离内容最底部不足onEndReachedThreshold的距离时调用。

onEndReachedThreshold

决定当距离内容最底部还有多远时触发onEndReached回调。注意此参数是一个比值而非像素单位。比如,0.5 表示距离内容最底部的距离为当前列表可见长度的一半时触发。

onRefresh

如果设置了此选项,则会在列表头部添加一个标准的RefreshControl控件,以便实现“下拉刷新”的功能。同时你需要正确设置refreshing属性。

refreshing

在等待加载新数据时将此属性设为 true,列表就会显示出一个正在加载的符号。

详细信息可以查看官方文档 https://reactnative.cn/docs/sectionlist/