react-native-wheel-picker-android
Advanced tools
Comparing version 2.0.1 to 2.0.2
{ | ||
"name": "react-native-wheel-picker-android", | ||
"version": "2.0.1", | ||
"version": "2.0.2", | ||
"description": "Simple Wheel Picker for Android to use with react-native", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -14,3 +14,4 @@ # ReactNativeWheelPicker WIP V2 | ||
![](./src/assets/wheelPicker.gif) | ||
![](./src/assets/pickerAndroid.gif) | ||
![](./src/assets/pickerIos.gif) | ||
@@ -27,39 +28,37 @@ # Usage | ||
Text, | ||
View | ||
View, | ||
Button | ||
} from 'react-native'; | ||
const wheelPickerData = ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday','Saturday']; | ||
const wheelPickerData = ['sunday', 'monday', 'tuesday', 'wednesday', 'thursday', 'friday']; | ||
class MyPicker extends Component { | ||
state = { | ||
selectedItem: 0, | ||
} | ||
onItemSelected = selectedItem => { | ||
this.setState({ selectedItem }) | ||
} | ||
onPress = () => { | ||
this.setState({ selectedItem: 3 }) | ||
} | ||
render() { | ||
return ( | ||
<View style={styles.container}> | ||
<WheelPicker | ||
onItemSelected={this.onItemSelected} | ||
data={wheelPickerData} | ||
style={styles.wheelPicker}/> | ||
<Button title={'Select third element'} onPress={this.onPress}/> | ||
<Text>Selected position: {this.state.selectedItem}</Text> | ||
<WheelPicker | ||
selectedItem={this.state.selectedItem} | ||
data={wheelPickerData} | ||
onItemSelected={this.onItemSelected}/> | ||
</View> | ||
); | ||
} | ||
onItemSelected(position){ | ||
// do something | ||
} | ||
} | ||
const styles = StyleSheet.create({ | ||
container: { | ||
flex: 1, | ||
alignItems: 'center', | ||
}, | ||
wheelPicker: { | ||
width: 200, | ||
height: 150 | ||
} | ||
}); | ||
module.exports = MyPicker; | ||
module.exports = MyPickers; | ||
``` | ||
@@ -66,0 +65,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
2062415
212
86