From e1be8c17365522c38271005a939e0c6e9ac504bb Mon Sep 17 00:00:00 2001 From: Arno Fortelny Date: Wed, 4 Mar 2015 19:39:57 -0500 Subject: [PATCH] Col Push/Pull/Offset value zero support According to the Bootstrap documentation (and my own experience), column offsets must be reset to zero for other sizes if not used. "In addition to column clearing at responsive breakpoints, you may need to reset offsets, pushes, or pulls. See this in action in the grid example." For example `...` when viewed in 'sm/md/lg' does not produce the expected result of having a column width of '4'. It looks only correct when viewed in 'xs'. The example would have to be rewritten as `...` to render correctly in all views. However, Offset/Push/Pull property values were ran through a "truthy" check in Col.jsx. So when the property value was `0` the column would not render. This has been fixed by doing a `>= 0` check instead which ensures that the property value is simply a non-negative number. --- src/Col.jsx | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Col.jsx b/src/Col.jsx index 23f564c598..d7523ea6a7 100644 --- a/src/Col.jsx +++ b/src/Col.jsx @@ -46,19 +46,19 @@ var Col = React.createClass({ prop = size + 'Offset'; classPart = size + '-offset-'; - if (this.props[prop]) { + if (this.props[prop] >= 0) { classes['col-' + classPart + this.props[prop]] = true; } prop = size + 'Push'; classPart = size + '-push-'; - if (this.props[prop]) { + if (this.props[prop] >= 0) { classes['col-' + classPart + this.props[prop]] = true; } prop = size + 'Pull'; classPart = size + '-pull-'; - if (this.props[prop]) { + if (this.props[prop] >= 0) { classes['col-' + classPart + this.props[prop]] = true; } }, this); @@ -71,4 +71,4 @@ var Col = React.createClass({ } }); -module.exports = Col; \ No newline at end of file +module.exports = Col;