rwp
rn-wheel-picker-china-region
npm i rn-wheel-picker-china-region
rwp

rn-wheel-picker-china-region

react-native版中国省-市-区选择组件(兼容Ios和安卓)

by theScoreONE

1.0.3 (see all)License:MITTypeScript:Not Found
npm i rn-wheel-picker-china-region
Readme

rn-wheel-picker-china-region

IOS & 安卓都兼容的中国地区选择器.

a modal picker(wheel) of china province & city & region.

propTypes

isVisible: PropTypes.bool,
selectedProvince: PropTypes.string,
selectedCity: PropTypes.string,
selectedArea: PropTypes.string,
navBtnColor: PropTypes.string,
animationType: PropTypes.string,
transparent: PropTypes.bool,
onSubmit: PropTypes.func,
onCancel: PropTypes.func,
androidPickerHeight: PropTypes.number   // 安卓手机下可以由该属性来设置picker区域的高度

Install

npm install rn-wheel-picker-china-region --save

Usage

import ChinaRegionWheelPicker from 'rn-wheel-picker-china-region';

// ios用法一
<ChinaRegionWheelPicker
  onSubmit={(params) => this.setState({ region1: `${params.province},${params.city},${params.area}` })}
  onCancel={() => console.log('cancel')}
>
  <TextInput
    editable={false}
    placeholder="点击去选择地区"
    value={this.state.region1}
  />
</ChinaRegionWheelPicker>

// android用法一
<ChinaRegionWheelPicker
  onSubmit={(params) => this.setState({ region1: `${params.province},${params.city},${params.area}` })}
  onCancel={() => console.log('cancel')}
>
  <Text
    style={{ backgroundColor: '#FFF', width: 200, paddingVertical: 20, textAlign: 'center', color: 'black' }}
  >{this.state.region1 || '点击去选择地区'}</Text>
</ChinaRegionWheelPicker>

// 用法二(参考Example目录index.ios.js/android.ios.js)
<ChinaRegionWheelPicker
  isVisible={this.state.isPickerVisible}
  navBtnColor={'red'}
  selectedProvince={'广东'}
  selectedCity={'深圳'}
  selectedArea={'福田区'}
  transparent
  animationType={'fade'}
  onSubmit={this._onPressSubmit.bind(this)} // 点击确认_onPressSubmit
  onCancel={this._onPressCancel.bind(this)} // 点击取消_onPressCancel
  androidPickerHeight={100}   // 安卓手机下可以设置picker区域的高度
/>

<TouchableOpacity
  onPress={this._onPress2Show.bind(this)}
>
  <Text style={{ color: 'white' }}>{this.state.region2 || '点击去选择地区' }</Text>
</TouchableOpacity>

Show

rn-wheel-picker-china-region1

rn-wheel-picker-china-region2

rn-wheel-picker-china-region3

rn-wheel-picker-china-region4

Downloads/wk

17

GitHub Stars

56

LAST COMMIT

4yrs ago

MAINTAINERS

1

CONTRIBUTORS

2

OPEN ISSUES

4

OPEN PRs

0
VersionTagPublished
1.0.3
latest
6yrs ago
No alternatives found
No tutorials found
Add a tutorial

Rate & Review

100
No reviews found
Be the first to rate