You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
according to the document: "Will attempt to locate a matching item from the items array by checking each item's key property". but in my testing in IOS, it don't work, but when I change itemKey to value field, it works. (the key and value are same value in my data)
To Reproduce
Steps to reproduce the behavior:
set itemKey = 1 in code
in UI, open the picker, then select the second item, press done.
reopen the picker, found the selected item is still on the second item
Expected behavior
I expect the selected items in the above steps should be the first item(with key=1, also value=1).
when I change the itemKey to value field, it works, everytime reopen the picker, the selected item always be the first.
according to the document, in IOS we should use itemKey, but it seems the value property works and itemKey don't work.
Screenshots
Add screenshots to help explain your problem. If screenshots aren't applicable to this issue, write "n/a".
Additional details
Device: [e.g. iPhone12]
OS: iOS17.4
react-native-picker-select version: ^9.1.3
Reproduction and/or code sample
<RNPickerSelect onValueChange={(value) => setTimesADayValue(value)} itemKey={1} items={ BizType.getTimesADayArray() } ref={Platform.OS === 'ios' ? pickerRef2 : null} pickerProps={{ ref: Platform.OS === 'android' ? pickerRef2 : null }} style={pickerSelectStyles} useNativeAndroidPickerStyle={false} onDownArrow={()=>null} />
my data items like this: const timesADayArray = [{label: 'one time a day', value: 1, key: 1}]; for (let j = 2; j <= 12; j++) { timesADayArray.push({label: j+' times a day', value: j, key: j},); }
when I change itemKey field to 'value' field, it works.
The text was updated successfully, but these errors were encountered:
Describe the bug
according to the document: "Will attempt to locate a matching item from the items array by checking each item's key property". but in my testing in IOS, it don't work, but when I change itemKey to value field, it works. (the key and value are same value in my data)
To Reproduce
Steps to reproduce the behavior:
Expected behavior
I expect the selected items in the above steps should be the first item(with key=1, also value=1).
when I change the itemKey to value field, it works, everytime reopen the picker, the selected item always be the first.
according to the document, in IOS we should use itemKey, but it seems the value property works and itemKey don't work.
Screenshots
Add screenshots to help explain your problem. If screenshots aren't applicable to this issue, write "n/a".
Additional details
Reproduction and/or code sample
<RNPickerSelect
onValueChange={(value) => setTimesADayValue(value)}
itemKey={1}
items={ BizType.getTimesADayArray() }
ref={Platform.OS === 'ios' ? pickerRef2 : null}
pickerProps={{ ref: Platform.OS === 'android' ? pickerRef2 : null }}
style={pickerSelectStyles}
useNativeAndroidPickerStyle={false}
onDownArrow={()=>null}
/>
my data items like this:
const timesADayArray = [{label: 'one time a day', value: 1, key: 1}];
for (let j = 2; j <= 12; j++) {
timesADayArray.push({label: j+' times a day', value: j, key: j},);
}
when I change itemKey field to 'value' field, it works.
The text was updated successfully, but these errors were encountered: