First of all, I apologize for my bad English.I am using the select component of the UI Kitten. Every item fails when I change it.
This is the mistake;
"Warning cannot update during an existing state react native"
I am sharing sample codes with you.
const data = [
"test 1",
"test 2"
];
constructor(props) {
super(props);
this.state = {
selectedIndex: new IndexPath(0),
displayValue: null
};
}
componentDidMount() {
this._handleSetSelectedIndex = this._handleSetSelectedIndex.bind(this);
}
_handleSetSelectedIndex(value) {
this.setState({selectedIndex: value});
}
in Render function;
<Select
style={{ width: 300 }}
placeholder='Default'
value={data[this.state.selectedIndex.row]}
selectedIndex={this.state.selectedIndex}
onSelect={index => this._handleSetSelectedIndex(index)}>
{data.map((key, value) => {
return (
<SelectItem key={value} title={key}/>
);
})}
</Select>
componentDidMount