react-native-wheel-picker-android
Advanced tools
Comparing version
@@ -1,1 +0,1 @@ | ||
[{"name":"resources","index":0,"scopes":["PROJECT"],"types":["NATIVE_LIBS"],"format":"DIRECTORY","present":false}] | ||
[{"name":"resources","index":1,"scopes":["PROJECT"],"types":["NATIVE_LIBS"],"format":"DIRECTORY","present":false}] |
{ | ||
"name": "react-native-wheel-picker-android", | ||
"version": "2.0.0", | ||
"version": "2.0.1", | ||
"description": "Simple Wheel Picker for Android to use with react-native", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -31,3 +31,3 @@ # ReactNativeWheelPicker WIP V2 | ||
class MyPickers extends Component { | ||
class MyPicker extends Component { | ||
render() { | ||
@@ -79,3 +79,3 @@ return ( | ||
| itemTextFontFamily | - | `font-family` | Wheel Picker's Item font | | ||
| initPosition | 0 | `number` | Initial item position | | ||
| selectedItem | 0 | `number` | Current item position | | ||
| indicatorColor | black | `string` | Indicator color | | ||
@@ -82,0 +82,0 @@ | hideIndicator | - | `func` | Hide indicator | |
@@ -21,3 +21,3 @@ /** | ||
itemTextSize?: number, | ||
initPosition?: number, | ||
selectedItem?: number, | ||
backgroundColor?: string, | ||
@@ -24,0 +24,0 @@ onItemSelected?: number => void |
@@ -11,3 +11,3 @@ /** | ||
data: Array<string>, | ||
initPosition?: number, | ||
selectedItem?: number, | ||
onItemSelected?: number => void | ||
@@ -17,3 +17,3 @@ } | ||
type State = { | ||
initPosition: number | ||
selectedItem: number | ||
} | ||
@@ -32,5 +32,11 @@ | ||
this.state = { | ||
initPosition: props.initPosition | ||
selectedItem: props.selectedItem | ||
} | ||
} | ||
componentDidUpdate(prevProps: Props, prevState: State){ | ||
if (prevState.selectedItem !== this.props.selectedItem){ | ||
this.setState({ selectedItem: this.props.selectedItem }) | ||
} | ||
} | ||
@@ -41,3 +47,3 @@ onItemSelected = (value: any, index: number) => { | ||
} | ||
this.setState({initPosition: index}) | ||
this.setState({selectedItem: index}) | ||
} | ||
@@ -51,3 +57,3 @@ | ||
{...this.props} | ||
selectedValue={data[this.state.initPosition]} | ||
selectedValue={data[this.state.selectedItem]} | ||
onValueChange={this.onItemSelected}> | ||
@@ -54,0 +60,0 @@ {this.props.data.map((i, index) => <Picker.Item key={index} label={i} value={i} />)} |
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
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
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
1432193
0.07%7481
0.21%0
-100%