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

Wc 106 redux form toggle #310

Merged
merged 4 commits into from
Oct 5, 2017
Merged

Wc 106 redux form toggle #310

merged 4 commits into from
Oct 5, 2017

Conversation

unjust
Copy link
Contributor

@unjust unjust commented Oct 5, 2017

Related issues

Fixes https://meetup.atlassian.net/browse/WC-106

Description

The problem: Redux Form's implementation for checkboxes sets the value as true or false, unlike expected html behavior that separates name, value, and checked.
redux-form/redux-form#2922

If we want our TogglePill's to be checked, we need to read the input.value prop from Redux Form (which is true or false), and pass that to isActive.

Screenshots (if applicable)

@unjust unjust self-assigned this Oct 5, 2017
...other
} = props;

return <TogglePill {...input} isActive={input.value == 'true' && !other.useRadio} {...other} />;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

reading other.useRadio since I do not know if there are similar idiosyncracies for Redux Form radio values. I think if we come up against the same thing for the radios, we can remove this check.

Copy link
Contributor

@burrata burrata left a comment

Choose a reason for hiding this comment

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

LGTM

* @return {Component} TogglePill
*/
const ReduxFormTogglePill = props => {
// not adding meta error to TogglePill prop for now
Copy link
Contributor

Choose a reason for hiding this comment

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

👍

@unjust unjust merged commit 1018623 into master Oct 5, 2017
@chenrui333 chenrui333 deleted the WC-106_redux_form_toggle branch September 16, 2019 21:59
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.

2 participants