Socket
Book a DemoInstallSign in
Socket

rnlist

Package Overview
Dependencies
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

rnlist

react native list

latest
Source
npmnpm
Version
0.0.12
Version published
Maintainers
1
Created
Source

RNList

基础列表模板

使用

import RNList from 'rnlist'

// 与 FlatList 使用
<FlatList
    data={list}
    renderItem={({item, index}) => 
        <RNList data={item} style={listStyle}/>
    }
    keyExtractor={(item, index) => index}
>
</FlatList>

// 列表自定义样式
const listStyle = StyleSheet.create({
	list: {
		height: 52,
	},
    // 文字主体
    txtBox: {
        flex: 1,
    },
    // 标题
    title: {
        fontSize: 14,
		color: '#666',
		fontWeight: 'normal'
	},
	// 附件信息
	accessoryBox: {
		flex: 3,
	},
	// 文字附件
	accessoryTxt: {
		fontSize: 14,
		color: '#333'
	}	
})

样式参数

参数类型说明
dataObject显示内容
styleStyle自定义样式
thatObject原对象 this
callbackFunction自定义函数,返回 this

data 参数内容

参数类型说明
iconString图标
titleString标题
subTitleString副标题
previewString预览信息
accessoryObject附件信息
separatorList箭头

preview 预览

参数类型说明
lineNumber用于规定显示的行数
innerString显示的内容

accessory 附件

参数类型说明
typeList用于规定显示的类型,可选 ['text','img','Image']
innerString显示的内容

type: "Image" 的图片引用为 inner: require('./img/yourImg.png')

separator 箭头

参数类型说明
upString显示向上的箭头
downString显示向下的箭头
leftString显示向左的箭头
rightString显示向右的箭头

Style 自定义样式

参数说明
list盒子
line下划线
body主体
iconBox图标盒子
icon图标
txtBox文字主体
title标题
subTitle副标题
preview预览信息
accessoryBox附件信息
accessoryImg图片附件
accessoryTxt文字附件

具体可以查看 index.js 的样式部分

Keywords

react

FAQs

Package last updated on 09 Feb 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts