react-native-wheel-picker-android
Advanced tools
Comparing version 0.1.6 to 0.1.7
{ | ||
"name": "react-native-wheel-picker-android", | ||
"version": "0.1.6", | ||
"version": "0.1.7", | ||
"description": "Simple Wheel Picker for Android to use with react-native", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -7,4 +7,2 @@ # ReactNativeWheelPicker | ||
![](./src/wheelPicker.gif) | ||
## Installation Android | ||
@@ -14,4 +12,8 @@ 1. `npm install react-native-wheel-picker-android --save` | ||
## Usage | ||
# Usage | ||
## Wheel Picker | ||
![](./src/wheelPicker.gif) | ||
```js | ||
@@ -35,2 +37,33 @@ | ||
## Props | ||
| Prop | Default | Type | Description | | ||
| :------------ |:---------------:| :---------------:| :-----| | ||
| onItemSelected | null | `func` | Callback when user select item {data: 'itemData', position: 'itemPosition'} | | ||
| data | default string array | `array` | Data array (string or number type) | | ||
| isCurved | false | `bool` | Make Wheel Picker curved | | ||
| isCyclic | false | `bool` | Make Wheel Picker cyclic | | ||
| isAtmospheric | false | `bool` | Design Wheel Picker's items | | ||
| selectedItemTextColor | grey | `string` | Wheel Picker's selected Item Text Color | | ||
| itemSpace | 20 | `number` | Wheel Picker's items spacing | | ||
| visibleItemCount | 7 | `number` | Wheel Picker's items max visible count | | ||
| renderIndicator | false | `bool` | Show Wheel Picker indicator | | ||
| indicatorColor | transparent | `string` | Indicator color | | ||
| isCurtain | false | `bool` | Wheel Picker curtain | | ||
| curtainColor | transparent | `string` | Wheel Picker curtain color | | ||
| itemTextColor | grey | `string` | Wheel Picker's items color | | ||
| itemTextSize | 20 | `number` | Wheel Picker's items text size | | ||
| selectedItemPosition | null | `number` | Select current item position | | ||
| backgroundColor | transparent | `string` | Wheel Picker background color | | ||
### data | ||
An array of options. This should be provided with an __array of strings__ or __array of numbers__. | ||
### onItemSelected(event) | ||
Callback with event in the form `event = { data: 1, position: 0 }` | ||
## Time Picker | ||
@@ -49,9 +82,9 @@ | ||
<TimePicker | ||
minutes={minutesArray} | ||
onDateSelected={(date)=>this.onDateSelected(date))} | ||
initDate={now.toISOString()}/> | ||
minutes={minutesArray} | ||
onTimeSelected={(date)=>this.onTimeSelected(date))} | ||
initDate={now.toISOString()}/> | ||
); | ||
} | ||
onDateSelected(date){ | ||
onTimeSelected(date){ | ||
// do something | ||
@@ -62,2 +95,12 @@ } | ||
## Props | ||
| Prop | Default | Type | Description | | ||
| :------------ |:---------------:| :---------------:| :-----| | ||
| onDateSelected | null | `func` | Callback when user select time {date: 'selectedDate'} | | ||
| initDate | current date | `ISOString` | Initial selected time | | ||
| hours | [1, 2, 3, .. 12] | `array` | hours array | | ||
| minutes | ['00', '05' ,'10', .. '55'] | `array` | minutes array | | ||
## Date Picker | ||
@@ -90,42 +133,2 @@ | ||
| :------------ |:---------------:| :---------------:| :-----| | ||
| onItemSelected | null | `func` | Callback when user select item {data: 'itemData', position: 'itemPosition'} | | ||
| data | default string array | `array` | Data array (string or number type) | | ||
| isCurved | false | `bool` | Make Wheel Picker curved | | ||
| isCyclic | false | `bool` | Make Wheel Picker cyclic | | ||
| isAtmospheric | false | `bool` | Design Wheel Picker's items | | ||
| selectedItemTextColor | grey | `string` | Wheel Picker's selected Item Text Color | | ||
| itemSpace | 20 | `number` | Wheel Picker's items spacing | | ||
| visibleItemCount | 7 | `number` | Wheel Picker's items max visible count | | ||
| renderIndicator | false | `bool` | Show Wheel Picker indicator | | ||
| indicatorColor | transparent | `string` | Indicator color | | ||
| isCurtain | false | `bool` | Wheel Picker curtain | | ||
| curtainColor | transparent | `string` | Wheel Picker curtain color | | ||
| itemTextColor | grey | `string` | Wheel Picker's items color | | ||
| itemTextSize | 20 | `number` | Wheel Picker's items text size | | ||
| selectedItemPosition | null | `number` | Select current item position | | ||
| backgroundColor | transparent | `string` | Wheel Picker background color | | ||
### data | ||
An array of options. This should be provided with an __array of strings__ or __array of numbers__. | ||
### onItemSelected(event) | ||
Callback with event in the form `event = { data: 1, position: 0 }` | ||
## Time Picker Props | ||
| Prop | Default | Type | Description | | ||
| :------------ |:---------------:| :---------------:| :-----| | ||
| onDateSelected | null | `func` | Callback when user select time {date: 'selectedDate'} | | ||
| initDate | current date | `ISOString` | Initial selected time | | ||
| hours | [1, 2, 3, .. 12] | `array` | hours array | | ||
| minutes | ['00', '05' ,'10', .. '55'] | `array` | minutes array | | ||
## Date Picker Props | ||
| Prop | Default | Type | Description | | ||
| :------------ |:---------------:| :---------------:| :-----| | ||
| onDateSelected | null | `func` | Callback when user select date {date: 'selectedDate'} | | ||
@@ -132,0 +135,0 @@ | initDate | current date | `ISOString` | Initial selected date | |
@@ -78,3 +78,3 @@ import React from 'react'; | ||
this.selectedDate.setHours(selectedHour24format); | ||
this.onDateSelected(); | ||
this.onTimeSelected(); | ||
} | ||
@@ -84,3 +84,3 @@ | ||
this.selectedDate.setMinutes(event.data); | ||
this.onDateSelected(); | ||
this.onTimeSelected(); | ||
} | ||
@@ -93,8 +93,8 @@ | ||
this.selectedDate.setHours(selectedHour24format); | ||
this.onDateSelected(); | ||
this.onTimeSelected(); | ||
} | ||
onDateSelected() { | ||
if (this.props.onDateSelected) { | ||
this.props.onDateSelected(this.selectedDate); | ||
onTimeSelected() { | ||
if (this.props.onTimeSelected) { | ||
this.props.onTimeSelected(this.selectedDate); | ||
} | ||
@@ -107,3 +107,3 @@ } | ||
initDate: React.PropTypes.string, | ||
onDateSelected: React.PropTypes.func, | ||
onTimeSelected: React.PropTypes.func, | ||
hours: React.PropTypes.array, | ||
@@ -110,0 +110,0 @@ minutes: React.PropTypes.array, |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
140