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-province-city-area

v1.0.1

Published

ReactNative版的省区市三级联动组件

Downloads

6

Readme

react-native-province-city-area

这是一个ReactNative版的省市区三级联动地址选择组件,在开发RN地址簿的时候用到地址选择,本来觉得这应该是一个很常用的功能,应该不用重复造轮子。但是几番搜索都没找到想要的,眼看找轮子的时间都快要超过新造轮子的时间了,于是果断放弃,自己写了一个,分享出来给需要的人。

使用说明

导入

import ProvinceCityArea from 'react-native-province-city-area';

在组件引用并传入参数

/**
 * 组件接受四个参数
 * color string,非必填,表示选择文本的颜色,默认浅蓝
 * callback 方法,必填,在组件内选择了地址后将选择的结果回调给父组件
 * initData 对象,非必填,默认为空
 * openProvinceCityArea 布尔,是否显示,非必填,默认false
 * */
<ProvinceCityArea
  color={"#ff6600"}
  callback={(x)=>{console.log(x)}}
  initData={{province:"浙江省",city:"衢州市",area:"柯城区"}}
  openProvinceCityArea={false}
 />

举个例子

import React, {Component} from 'react';
import {View,Text,TouchableOpacity} from 'react-native';
import { ProvinceCityArea } from 'react-native-province-city-area';

class Example extends Component {
  constructor(props) {
        super(props);
        this.state={
            openProvinceCityArea:false,
        };
        this.updata=this.updata.bind(this);
        this.openAddressRegion=this.openAddressRegion.bind(this);
    }
    updata(x){
        console.log(x);
    }
    openProvinceCityArea(){
        this.setState({openProvinceCityArea:true});
    }
    render(){
        let initData={province:"浙江省",city:"衢州市",area:"柯城区"};
        return (<View>
            <TouchableOpacity onPress={()=>{this.openProvinceCityArea()}}>
              <Text>打开地址</Text>
            </TouchableOpacity>
            <ProvinceCityArea callback={this.updata} initData={initData} openProvinceCityArea={this.state.openProvinceCityArea} />
        </View>);
    }
}
export default Example;

如有任何问题,欢迎在issues页面中提出。