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

Addition of multi-select feature. #127

Open
wants to merge 15 commits into
base: master
Choose a base branch
from

Conversation

allroundexperts
Copy link

  • Added multi select option.
  • Added husky, making auto linting possible.
  • Upgraded RN to the latest version.

PS: Messed up the previous PR, so consider this please.

@peacechen
Copy link
Owner

Thanks @allroundexperts
This looks good, with issues from the previous PR addressed.

I would recommend against including react-native-vector-icons in this library because that requires native linking. Not everyone who uses this library may want to do that, or use that particular icon library. It would be better to design this so that the user can pass in a component (which could include an icon) instead of building that in.

@allroundexperts
Copy link
Author

Thanks @allroundexperts
This looks good, with issues from the previous PR addressed.

I would recommend against including react-native-vector-icons in this library because that requires native linking. Not everyone who uses this library may want to do that, or use that particular icon library. It would be better to design this so that the user can pass in a component (which could include an icon) instead of building that in.

@peacechen Fixed in the latest commit!

@peacechen
Copy link
Owner

👍
Did you update the sample app to reflect the latest changes? I'm not at my computer to test it

@allroundexperts
Copy link
Author

👍
Did you update the sample app to reflect the latest changes? I'm not at my computer to test it

Yup!

@peacechen
Copy link
Owner

I'll have time to test this soon. A few more items need to be addressed:

Some of the props/methods have changed names (getSelectedItem and selectedItem). This should be documented in the Readme under Breaking Changes.
Due to the above, the major version should get a bump to 2.0.0.

Tab spacing in some chunks of code have changed from 2 to 4 spaces. The eslintrc should specify tab size of 4 to prevent commits that only change tab spacing (and resultant swaths of diffs that have no functional changes).

index.js Outdated
Comment on lines 189 to 194
if (this.props.multiple)
checked
? selected.push(itemKey)
: selected.indexOf(itemKey) >= 0 &&
delete selected[selected.indexOf(itemKey)];
else selected = [itemKey];
Copy link
Owner

Choose a reason for hiding this comment

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

This conditional without braces makes the code harder to read at first glance. It will also be more prone to bugs if someone modifies it later. Please add braces for both the if and else sections.

Copy link
Author

Choose a reason for hiding this comment

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

Handled in 1d4d858

index.js Outdated
selectedKey: '',
initSelectedKeys: [],
multiple: false,
renderCheckbox: undefined,
Copy link
Owner

Choose a reason for hiding this comment

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

The Readme says that renderCheckbox is required (not optional). However it's not needed for single select mode, only multi select. Please provide a default empty method for renderCheckbox () => {}, update the Readme to reflect that the prop is optional, and in the description note that the user should provide a render method if they want checkboxes to display.

Copy link
Author

Choose a reason for hiding this comment

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

Handled in 1d4d858.

@peacechen
Copy link
Owner

@allroundexperts
Thank you for continuing to refine this PR. Apologies for the delay in processing this.

The sample app in master has been updated to a simpler Expo project. Please revert your changes in SampleApp, keeping only the changes in App.js and any dependencies added. You're using react-native-elements in the SampleApp which may need tweaks to the Expo project (or maybe not, most of that is automated now). It would be cleanest to revert everything in SampleApp, pull from master and rebase & squash your commits to the top of Head.

It's a bit difficult to see the big picture in this PR when there are ~20 commits. Would you mind squashing them into a single commit?

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.

3 participants