Skip to content
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

Fix error on empty items array #173

Closed
wants to merge 2 commits into from

Conversation

cvarley100
Copy link

If you pass an empty array to the items prop, the component will throw an error. This is due to getSelectedItem method returning undefined for selectedItem.

@lfkwtz
Copy link
Collaborator

lfkwtz commented May 9, 2019

Closes #161

Copy link
Collaborator

@lfkwtz lfkwtz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will take a look at this once I return from vacation

@@ -106,7 +106,7 @@ export default class RNPickerSelect extends PureComponent {
idx = 0;
}
return {
selectedItem: items[idx],
selectedItem: items[idx] || '',
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

make this || {} to more closely match the signature of an individual item

@lfkwtz
Copy link
Collaborator

lfkwtz commented Jun 5, 2019

@cvarley100 want to make this change?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants