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-m000025

v4.6.201909291817

Published

滚轮选择器

Downloads

8

Readme

滚轮选择器

  1. 当data数组的长度小于3时,isCyclic循环滚动将不会生效.
  2. 当本列数组中数据重复时,重复数据的选中项下标相同.
  3. ios系统原生picker没有循环滚动属性.
  4. 如果项目之前在package.json里的导入了@taoqf/react-native-wheel-picker版本需删除,删除node_models并重装依赖.不会对项目代码造成影响.

一、安装

yarn add --dev @dfeidao/fd-m000025

二、属性

属性|描述 --|--|--|-- onItemSelected|返回所有列选中项的下标 data|数据源数组 selectedItem|初始化选中项默认为第一个,传具体的字符串 style|选择器css样式 visible|模态框是否显示 title|模态框标题 isCyclic|设置循环滚动,ios不支持该属性 selectedItemTextColor|滚轮选中项的字体颜色,ios不支持 selectedItemTextSize|滚轮选中项的字体尺寸,ios不支持 selectedItemTextFontFamily|滚轮选中项的字体样式,ios不支持 itemTextColor|滚轮每一项的字体颜色 itemTextSize|滚轮每一项的字体尺寸 itemTextFontFamily|滚轮每一项的字体样式 indicatorColor|指示器颜色 hideIndicator|隐藏指示器 indicatorWidth|隐藏宽度 backgroundColor|滚路选择器的背景颜色

三、滚轮选择器示例

3.1 tpl.tsx示例1

import M025 from '@dfeidao/fd-m000025';
import { Text, View } from 'react-native';

export default function tpl(...){
	return (
	<View>
			{/* <Text onPress={(() => {
				this.setState({
					show:true
				});
			})}> */}
			<Text onPress={a('a002')}>点击</Text> 
			<M025
				title={'滚轮选择器'}
				{/* (() => {
					this.setState({
						show:false
					});
				})*/}
				onCancel={a('a003')}
				visible={d('show')}
		    	data={[['0','1','2'], ['a','b','c'], ['33','22','11']]}
				onItemSelected={((result) => {
						console.log(result);
					})}
				selectedItem={['0', 'b', '11']}
				/>
		</View>
	);
}

3.2 tpl.tsx示例2

当使用d('data')方式传递数据时需要如下做判断.

import M025 from '@dfeidao/fd-m000025';
import { Text, View } from 'react-native';

export default function tpl(...){
	return (
	<View>
			{/* <Text onPress={(() => {
				this.setState({
					show:true
				});
			})}> */}
			<Text onPress={a('a002')}>点击</Text> 
			    {(() => {
        			if (d('data')) {
          				return (
            			<M025
              				title={'滚轮选择器'}
              				onCancel={a('a003')}
              				visible={d('show')}
              				data={d('data')}
              				onItemSelected={((result) => {
                				console.log(result);
              				})}
              				selectedItem={['0', 'b', '11']}
            			/>
          					);
						}
      			})()}
		</View>
	);
}

result

onItemSelected回调返回值

属性|描述 --|--|--|-- extra|用户当前的选中项的数据 name|当前选中项的名称 index|当前选中项的下标 row|当前选中项,选择器的列

[
	{
	"extra": {
		"name": "0",  "index": 0
	},
	"index": 0,
		"row": 0
},
{
	"extra": {
		"name": "b", "index": 1
	},
	"index": 0,
	    "row": 1
},
{
	"extra": {
		"name": "11", "index": 2
	},
	"index": 0,
		"row": 2
}
]