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-ui-kit-picker

v0.1.6

Published

Native selector for Android and ios

Downloads

13

Readme

react-native-ui-kit-picker

Native selector for Android and ios

功能介绍

基于已有的第三方框架来实现Android和iOS的时间、城市、普通选择器,适用于 React Native App。

原生框架依赖

功能特点

  • 支持Android和iOS
  • 支持时间选择
  • 支持城市选择
  • 支持普通选择
  • 支持二级联动选择

安装

npm install react-native-ui-kit-picker
or
yarn add react-native-ui-kit-picker

Example

yarn example

效果演示

Usage

import { ShowTimePicker,ShowNormalPicker,ShowCityPicker,ShowLinkagePicker } from 'react-native-ui-kit-picker';

let defaultArray  = [
  {
      "label":'主标题一',
      'value':[
          {
              "label":'石家庄市',
              'value':'1'
          },
          {
              "label":'唐山市',
              'value':'2'
          },
          {
              "label":'秦皇岛市',
              'value':'3'
          }
      ]
  },
  {
      "label":'主标题二',
      'value':[
          {
              "label":'太原市',
              'value':'1'
          },
          {
              "label":'大同市',
              'value':'2'
          },
          {
              "label":'阳泉市',
              'value':'3'
          }
      ]
  }
]

export default function App() {

  const [time,setTime] = React.useState('')
  const [sex,setSex] = React.useState<{label?:string,value?:string}>({})
  const [city,setCity] = React.useState({
    province:'',
    city:'',
    area:''
  })
  const [label,setLabel] = React.useState('')

  console.log('new Date',new Date('2020-01-01'))

  return (
    <View style={styles.container}>
      <Button title={'时间选择器'}  onPress={()=>{
                ShowTimePicker({
                    pattern:'yyyy-MM-dd',
                    title:'请选择时间',
                    mixDate:'2020-01-01',
                    maxDate:'2024-12-31',
                    selectDate : time
                }).then(res=>{
                    console.log('res',res)
                    setTime(res)
                })
            }}/>
     <Text>选择的时间:{time}</Text>
     <Button title={'普通选择器'} onPress={()=>{
                ShowNormalPicker({
                    array:[
                        {label:'男',value:'1'},
                        {label:'女',value:'2'},
                    ],
                    selectItem:sex
                }).then(res=>{
                    console.log('res',res.label)
                    setSex(res)
                })
            }}/>
    <Text>选择的性别:{sex.label}</Text>
    <Button title={'城市选择器'} onPress={()=>{
                ShowCityPicker({
                  title:'城市选择器',
                  selcetCity:city
                }).then(res=>{
                    console.log('res',res)
                    setCity({
                        province:res.province,
                        city:res.city,
                        area:res.area
                    })
                })
            }}/>
    <Text>城市选择器:{city.province + city.city + city.area}</Text>
    <Button title={'多级联动选择器'} onPress={()=>{
                ShowLinkagePicker({
                    array:defaultArray
                }).then(res=>{
                    console.log('res',res)
                    setLabel(`${res.label}-${res.value.label}`)
                }).catch(err=>{
                    console.log('err',err)
                })
            }}/>
        <Text>二级联动选择的内容{label}</Text>
    </View>
  );
}

License

MIT


Made with create-react-native-library