react-native-wheel-picker-android
Advanced tools
Comparing version 0.1.7 to 0.1.8
{ | ||
"name": "react-native-wheel-picker-android", | ||
"version": "0.1.7", | ||
"version": "0.1.8", | ||
"description": "Simple Wheel Picker for Android to use with react-native", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -5,3 +5,4 @@ # ReactNativeWheelPicker | ||
A simple Wheel Picker for Android | ||
A simple Wheel Picker for Android based on https://github.com/AigeStudio/WheelPicker | ||
Also you can use multiple pickers, such as DatePicker or TimePicker | ||
@@ -14,2 +15,64 @@ ## Installation Android | ||
```js | ||
import {WheelPicker, DatePicker, TimePicker} from 'react-native-wheel-picker-android' | ||
import React, { Component } from 'react'; | ||
import { | ||
AppRegistry, | ||
StyleSheet, | ||
Text, | ||
View | ||
} from 'react-native'; | ||
class MyPickers extends Component { | ||
render() { | ||
let now = new Date() | ||
let wheelPickerData = ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday']; | ||
return ( | ||
<View style={styles.container}> | ||
<WheelPicker | ||
onItemSelected={(event)=>this.onItemSelected(event)} | ||
isCurved | ||
data={wheelPickerData} | ||
style={styles.wheelPicker}/> | ||
<DatePicker | ||
initDate={now.toISOString()} | ||
onDateSelected={(date)=>this.onDateSelected(date)}/> | ||
<TimePicker | ||
initDate={now.toISOString()} | ||
onTimeSelected={(date)=>this.onTimeSelected(date)}/> | ||
</View> | ||
); | ||
} | ||
onItemSelected(event){ | ||
// do something | ||
} | ||
onDateSelected(date){ | ||
// do something | ||
} | ||
onTimeSelected(date){ | ||
// do something | ||
} | ||
} | ||
const styles = StyleSheet.create({ | ||
container: { | ||
flex: 1, | ||
alignItems: 'center', | ||
}, | ||
wheelPicker: { | ||
width:200, | ||
height: 150 | ||
} | ||
}); | ||
module.exports = MyPickers; | ||
``` | ||
## Wheel Picker | ||
@@ -97,3 +160,3 @@ | ||
| :------------ |:---------------:| :---------------:| :-----| | ||
| onDateSelected | null | `func` | Callback when user select time {date: 'selectedDate'} | | ||
| onTimeSelected | null | `func` | Callback when user select time {date: 'selectedTime'} | | ||
| initDate | current date | `ISOString` | Initial selected time | | ||
@@ -100,0 +163,0 @@ | hours | [1, 2, 3, .. 12] | `array` | hours 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
311575
203