Giter Club home page Giter Club logo

react-native-wheel-pick's Introduction

react-native-wheel-pick

React native wheel picker for both iOS and android. (Support DatePicker)

This is not original but inspire by react-native-wheel-datepicker

How to use

npm install react-native-wheel-pick
react-native link react-native-wheel-pick

react-native-wheel-pick

Example code

import { Platform } from 'react-native';
import { Picker, DatePicker } from 'react-native-wheel-pick';

const isIos = Platform.OS === 'ios'

// use Picker
<Picker
  style={{ backgroundColor: 'white', width: 300, height: 215 }}
  selectedValue='item4'
  pickerData={['item1', 'item2', 'item3', 'item4', 'item5', 'item6', 'item7']}
  onValueChange={value => { }}
  itemSpace={30} // this only support in android
/>

// use DatePicker
<DatePicker
  style={{ backgroundColor: 'white', height: 215, width: isIos ? 300 : undefined }} 
  // android not support width
  onDateChange={date => { }}
/>

Note

  • For iOS use default PickerIOS / DatePickerIOS of React Native.
  • For Android use WheelPicker of WheelPicker
  • Line color is white in android. (Support Line style in future. Pull request welcome)
  • Line color is grey in IOS but it has bug line not show in Picker (iOS 11.4 not sure other version).

Pull request are welcome for more support in future (Text Style / Line Style / Line Bug)

More Example

// DatePicker set default choose date
<DatePicker
  style={{ height: 215, width: isIos ? 300 : undefined }}
  date={new Date('2018-06-27')} // Optional prop - default is Today
  onDateChange={date => { }}
/>

// DatePicker set min/max Date
<DatePicker
  style={{ height: 215, width: isIos ? 300 : undefined }}
  minimumDate={new Date('2000-01-01')}
  maximumDate={new Date('2050-12-31')}
  onDateChange={date => { }}
/>

Release Note

1.1.0 (January 14 2020)

  • Use react-native.config.js instead of rnpm section. @darkbluesun

[Android]

  • Add safeExtGet to get sdk version from root project.@darkbluesun

1.0.9 (June 27 2018)

[IOS]

  • Fix bug props date of DatePicker is not work right.

1.0.8 (June 27 2018)

  • Support props for date picker (date / minimumDate / maximumDate)

[IOS]

  • Fix bug cannot read property 'getTime' of null

1.0.7 (June 25 2018)

[Android]

  • Fix bug android value wrong from array

1.0.5 (June 24 2018)

  • Fix Lifecycle for support React 16 (Remove componentWillMount / componentWillReceiveProps)

[Android]

  • Fix bug onValueChange occur first time without change

1.0.4 (June 24 2018)

[Android]

  • Support compileSDKVersion 26

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.