react-native-picker
react-native-picker copied to clipboard
Get index of select value
How do i get the index of selected value?
+1
https://blog.csdn.net/qq_15744297/article/details/80252280 这有方法
onPickerConfirm: (pickedValue, pickedIndex) => {
selectData=pickedValue
this.setState({
selectPosition:pickedValue[0]+" "+pickedValue[1]+" "+pickedValue[2]
})
}
I just try to get index on array that have same value (ex. ['ABC', 'ABC', 'ABC', 'ABC', 'ABC']
) but it alway return 0. It should return actually selected index.
I know this case not occur in usually use case but I just try and it return wrong index.
@onsensei You are right, I'm in the same situation, need to find a solution.

this work