Skip to content

Commit c357414

Browse files
committed
add moveTo
1 parent be4f99a commit c357414

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

index.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ class PickerAndroidItem extends React.Component{
1515

1616
static propTypes = {
1717
value: PropTypes.any,
18-
label: PropTypes.string,
18+
label: PropTypes.any
1919
}
2020

2121
constructor(props, context){
@@ -94,6 +94,10 @@ export default class PickerAndroid extends React.Component{
9494
this._onValueChange();
9595
}
9696
}
97+
//cascade mode will reset the wheel position
98+
moveTo(index){
99+
this._moveTo(index);
100+
}
97101

98102
moveUp(){
99103
this._moveTo(Math.max(this.index - 1, 0));
@@ -231,6 +235,7 @@ let ratio = PixelRatio.get();
231235
let styles = StyleSheet.create({
232236

233237
container: {
238+
flex: 1,
234239
justifyContent: 'center',
235240
alignItems: 'center',
236241
//this is very important
@@ -256,6 +261,7 @@ let styles = StyleSheet.create({
256261
},
257262
middle: {
258263
height: 40,
264+
width: width,
259265
overflow: 'hidden',
260266
borderColor: '#aaa',
261267
borderTopWidth: 1/ratio,

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "react-native-picker-android",
3-
"version": "0.3.1",
3+
"version": "0.3.2",
44
"description": "react-native-picker-android",
55
"main": "index.js",
66
"scripts": {

0 commit comments

Comments
 (0)