-
Notifications
You must be signed in to change notification settings - Fork 24.8k
Closed
Labels
BugComponent: PickerIOSPlatform: iOSiOS applications.iOS applications.StaleThere has been a lack of activity on this issue and it may be closed soon.There has been a lack of activity on this issue and it may be closed soon.
Description
When I change selected option, it resets to first.
For example if this.props.center is C and i have:
A
B
C <-
D
E
I start with C selected, i change to E for example, state on console.log is E but it shows A selected.
React Native version:
0.57.1
Here is my code:
constructor(props) {
super(props);
this.state = {
selectedCenter: this.props.center
};
}
render() {
if (this.props.centers) {
return (
<View style={{backgroundColor: '#008590d9'}}>
<PickerIOS
selectedValue={this.state.selectedCenter}
style={styles.select}
itemIndex) => {
console.log(itemValue);
this.setState({selectedCenter: itemValue});
}}>
{
this.props.centers.map((center) => {
console.log(this.state.selectedCenter);
return <PickerIOS.Item key={center.id} title={center.name} label={center.name}
value={center}/>
})
}
</PickerIOS>
</View>
)
}
}
Metadata
Metadata
Assignees
Labels
BugComponent: PickerIOSPlatform: iOSiOS applications.iOS applications.StaleThere has been a lack of activity on this issue and it may be closed soon.There has been a lack of activity on this issue and it may be closed soon.