Skip to content

Col - fix disabled width props from being passed to div#283

Merged
eddywashere merged 6 commits intoreactstrap:masterfrom
hosmelq:master
Jan 11, 2017
Merged

Col - fix disabled width props from being passed to div#283
eddywashere merged 6 commits intoreactstrap:masterfrom
hosmelq:master

Conversation

@hosmelq
Copy link
Copy Markdown
Contributor

@hosmelq hosmelq commented Jan 11, 2017

Sometimes you don't want the col class by default, and setting xs={false} works but i got this error

Unknown prop 'xs' on <div> tag. Remove this prop from the element.

This prop is not removed from attributes.

https://github.com/reactstrap/reactstrap/blob/master/src/Col.js#L63

Comment thread src/Col.js
cssModule: PropTypes.object,
};

const defaultProps = {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

defaultProps is used below

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

My bad, thanks.

Comment thread src/Col.js Outdated
}
});

if (attributes['xs']) {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I'd be happy to add back support for false as I think Col should have some sort of default that takes care of the typical use case. I recently and foolishly moved delete attributes[colWidth]; after the prop check, it should instead revert back to the following in colWidths.forEach(colWidth => {:

// always clear out width props from attributes
delete attributes[colWidth];

if (!columnProp) {
  return;
}

Copy link
Copy Markdown
Contributor Author

@hosmelq hosmelq Jan 11, 2017

Choose a reason for hiding this comment

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

Did you already moved this ?

Copy link
Copy Markdown
Member

@eddywashere eddywashere Jan 11, 2017

Choose a reason for hiding this comment

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

It was previously before the columnProp check, see commit

image

Comment thread src/Col.js Outdated

const defaultProps = {
xs: true
xs: true
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

nit: can you remove the extra spaces?

@eddywashere eddywashere changed the title remove xs from default props Col - fix disabled width props from being passed to div Jan 11, 2017
Copy link
Copy Markdown
Member

@eddywashere eddywashere left a comment

Choose a reason for hiding this comment

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

I appreciate the quick changes! lgtm

@eddywashere eddywashere merged commit 2a36601 into reactstrap:master Jan 11, 2017
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