react-native-wheel-picker-android
Advanced tools
Comparing version 1.1.0 to 1.1.1
{ | ||
"name": "react-native-wheel-picker-android", | ||
"version": "1.1.0", | ||
"version": "1.1.1", | ||
"description": "Simple Wheel Picker for Android to use with react-native", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -8,8 +8,7 @@ # ReactNativeWheelPicker | ||
For IOS you can use a [good Picker for IOS](https://facebook.github.io/react-native/docs/pickerios.html#onvaluechange) | ||
[and DatePicker for IOS](https://facebook.github.io/react-native/docs/datepickerios.html) | ||
For IOS you can use a [good Picker for IOS](https://facebook.github.io/react-native/docs/pickerios.html) | ||
and [DatePicker for IOS](https://facebook.github.io/react-native/docs/datepickerios.html) | ||
## Installation Android | ||
1. `yarn add react-native-wheel-picker-android` | ||
2. `react-native link react-native-wheel-picker-android` | ||
`yarn add react-native-wheel-picker-android` | ||
@@ -16,0 +15,0 @@ # Usage |
@@ -86,3 +86,3 @@ /** | ||
render() { | ||
const { startDate, days, daysCount, hours, minutes } = this.props | ||
const { startDate, days, daysCount, hours, minutes, format24 } = this.props | ||
const { initHourInex, initDayInex, initMinuteInex } = this.state | ||
@@ -107,3 +107,3 @@ return ( | ||
visibleItemCount={8} | ||
data={hours || getHoursArray()} | ||
data={hours || getHoursArray(format24)} | ||
selectedItemTextColor={'black'} | ||
@@ -110,0 +110,0 @@ onItemSelected={this.onHourSelected} |
@@ -45,13 +45,9 @@ /** | ||
super(props) | ||
const selectedDate = this.props.initDate | ||
? new Date(this.props.initDate) | ||
: new Date() | ||
const { initDate, format24, minutes } = props | ||
const selectedDate = initDate ? new Date(initDate) : new Date() | ||
const time12format = hourTo12Format(selectedDate.getHours()) | ||
const time24format = selectedDate.getHours() | ||
const hours = this.props.hours ? this.props.hours : getHoursArray() | ||
const minutes = this.props.minutes || getFiveMinutesArray() | ||
const initHourInex = this.props.format24 | ||
? time24format | ||
: Number(time12format[0]) - 1 | ||
const minutesCount = this.props.minutes ? this.props.minutes.length : 12 | ||
const hours = this.props.hours || getHoursArray(format24) | ||
const initHourInex = format24 ? time24format : Number(time12format[0]) - 1 | ||
const minutesCount = minutes ? minutes.length : 12 | ||
@@ -65,3 +61,3 @@ const initMinuteInex = Math.round( | ||
hours, | ||
minutes, | ||
minutes: minutes || getFiveMinutesArray(), | ||
initHourInex, | ||
@@ -68,0 +64,0 @@ initMinuteInex, |
@@ -66,6 +66,7 @@ /** | ||
export function getHoursArray() { | ||
export function getHoursArray(format24: boolean) { | ||
const hours = format24 ? { min: 0, max: 23 } : { min: 1, max: 12 } | ||
const arr = [] | ||
for (let i = 1; i < 13; i++) { | ||
arr.push(i) | ||
for (let i = hours.min; i <= hours.max; i++) { | ||
arr.push(`00${i}`.slice(-2)) | ||
} | ||
@@ -72,0 +73,0 @@ return arr |
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
0
310151
496
207