-
Notifications
You must be signed in to change notification settings - Fork 499
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
itemKey doesn't work #580
Comments
Please check this PR |
@athul-22 , thank you, I will try this new updates. (currently I am using 'value', it works well :) ) |
10 tasks
Is there is change we can apply with PactchPackage in the mean time until this fix is released please? |
Is there any update to this issue? |
since there is a PR, so close it. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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: