react-native-picker icon indicating copy to clipboard operation
react-native-picker copied to clipboard

Get index of select value

Open KaysonTan94 opened this issue 6 years ago • 5 comments

How do i get the index of selected value?

KaysonTan94 avatar May 02 '18 11:05 KaysonTan94

+1

mingca avatar Jun 07 '18 03:06 mingca

https://blog.csdn.net/qq_15744297/article/details/80252280 这有方法

           onPickerConfirm: (pickedValue, pickedIndex) => {
                selectData=pickedValue
                this.setState({
                    selectPosition:pickedValue[0]+"  "+pickedValue[1]+"  "+pickedValue[2]
                })

            }

Kevin088 avatar Jun 16 '18 07:06 Kevin088

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 avatar Jul 10 '18 15:07 onsensei

@onsensei You are right, I'm in the same situation, need to find a solution.

congshengwu avatar Jul 30 '19 07:07 congshengwu

image

this work

t407289575 avatar Feb 22 '23 11:02 t407289575