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 🙏

© 2026 – Pkg Stats / Ryan Hefner

react-native-show-picker

v1.0.24

Published

A React Native pure JavaScript picker component for iOS and Android.

Readme

react-native-show-picker

English

轻量的 React Native Picker集合 纯js实现,包含:

  • 地址选择器(省市区)
  • 日期时间选择器(支持 11 种 mode)
  • 通用级联选择器

安装

npm install react-native-show-picker --save

yarn add react-native-show-picker

快速开始

下面示例基于页面内直接调用,包含地址、时间、级联三个入口。

示例截图

| DatePicker | CascaderPicker | | ---------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------ | | | |

code

import { useScreenOptions } from '@aks-dev/react-navigation-helper';
import React from 'react';
import {
  Dimensions,
  StyleSheet,
  TouchableOpacity,
  View,
  Text,
} from 'react-native';
import {
  Picker,
  showAddressPicker,
  showDatePicker,
  DatePickerModal,
  DatePickerModalImperativeHandle,
  showCascaderPicker,
} from 'react-native-show-picker';
import data from './components/province-city-area.json';
console.log('data', data);
export default ({ navigation, route }) => {
  useScreenOptions(
    {
      title: 'animateView',
    },
    [],
  );
  const [address, setAddress] = React.useState({
    provinceIndex: 2,
    cityIndex: 1,
    areaIndex: 0,
  });

  // const datePickerRef = React.useRef<DatePickerModalImperativeHandle>(null);

  return (
    <View style={styles.container}>
      <TouchableOpacity
        style={styles.complete}
        onPress={async () => {
          let value = await showAddressPicker({
            provinceIndex: 5,
            cityIndex: 2,
            areaIndex: 2,
          });
          console.log(value);
        }}
      >
        <Text>地址</Text>
      </TouchableOpacity>
      <TouchableOpacity
        style={[styles.complete, { left: 100 }]}
        onPress={async () => {
          let value = await showDatePicker({
            mode: 'YYYY-MM-DD A',
            value: '2026-04-07 16:10:01',
          });

          // let value = await datePickerRef.current?.showDatePicker({
          //   mode: 'YYYY-MM-DD hh:mm:ss',
          //   value: '2026-04-07 16:10:01',
          // });
          console.log(value);
        }}
      >
        <Text>时间</Text>
      </TouchableOpacity>
      <TouchableOpacity
        style={[styles.complete, { left: 200 }]}
        onPress={async () => {
          let value = await showCascaderPicker({
            data,
          });
          console.log(value);
        }}
      >
        <Text>级联选择器</Text>
      </TouchableOpacity>

      <Picker />
      {/* <DatePickerModal ref={datePickerRef}></DatePickerModal> */}
    </View>
  );
};
const styles = StyleSheet.create({
  ...
});

API 简述

showAddressPicker(options)

  • 入参:provinceIndexcityIndexareaIndex
  • 返回:Promise<AddressValue | undefined>

用户点击确定返回地址结果;取消时返回 undefined

showDatePicker(options)

  • 常用入参:modevalueyearsBeforeyearsAfter
  • 返回:Promise<string | undefined>

支持 showDatePicker(options) 直接调用,也支持 DatePickerModal + ref 命令式调用。

  • 支持的 mode 如下:

| 日期相关 | 时间相关 | 组合模式 | | ------------ | ---------- | --------------------- | | YYYY | hh:mm | YYYY-MM-DD hh:mm:ss | | YYYY-MM | hh:mm:ss | YYYY-MM-DD hh:mm | | YYYY-MM-DD | | YYYY-MM-DD hh | | MM-DD | | YYYY-MM-DD A | | | | A hh:mm |

showCascaderPicker(options)

  • 常用入参:datavaluelevelitemKey
  • 返回:Promise<CascaderPickerValue | undefined>

CascaderPickerValue 结构:

  • indices: 当前选中路径的索引数组
  • selectedOptions: 当前选中路径节点数组(已移除 children 字段)

建议

  • 在页面根部保留 <Picker />,用于挂载全局弹层。
  • 如需复用时间弹窗,推荐使用 <DatePickerModal ref={...} />
  • 级联数据建议保证每一层节点结构一致(通过 itemKey 映射)。