Skip to content

Commit

Permalink
Merge pull request react-bootstrap#1155 from AlexKVal/booleans
Browse files Browse the repository at this point in the history
Explicitly set default values for boolean properties
  • Loading branch information
taion committed Aug 13, 2015
2 parents df01f05 + c7e3f07 commit defe43a
Show file tree
Hide file tree
Showing 24 changed files with 119 additions and 15 deletions.
6 changes: 6 additions & 0 deletions src/Badge.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,12 @@ const Badge = React.createClass({
pullRight: React.PropTypes.bool
},

getDefaultProps() {
return {
pullRight: false
};
},

hasContent() {
return ValidComponentChildren.hasValidComponent(this.props.children) ||
(React.Children.count(this.props.children) > 1) ||
Expand Down
7 changes: 6 additions & 1 deletion src/Button.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,13 @@ const Button = React.createClass({

getDefaultProps() {
return {
active: false,
block: false,
bsClass: 'button',
bsStyle: 'default'
bsStyle: 'default',
disabled: false,
navItem: false,
navDropdown: false
};
},

Expand Down
5 changes: 4 additions & 1 deletion src/ButtonGroup.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,10 @@ const ButtonGroup = React.createClass({

getDefaultProps() {
return {
bsClass: 'button-group'
block: false,
bsClass: 'button-group',
justified: false,
vertical: false
};
},

Expand Down
4 changes: 3 additions & 1 deletion src/CarouselItem.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,9 @@ const CarouselItem = React.createClass({

getDefaultProps() {
return {
animation: true
active: false,
animateIn: false,
animateOut: false
};
},

Expand Down
6 changes: 6 additions & 0 deletions src/CollapsibleNav.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,12 @@ const CollapsibleNav = React.createClass({
eventKey: React.PropTypes.any
},

getDefaultProps() {
return {
collapsible: false,
expanded: false
};
},

render() {
/*
Expand Down
9 changes: 9 additions & 0 deletions src/DropdownButton.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,15 @@ const DropdownButton = React.createClass({
children: React.PropTypes.node
},

getDefaultProps() {
return {
pullRight: false,
dropup: false,
navItem: false,
noCaret: false
};
},

render() {
let renderMethod = this.props.navItem ?
'renderNavItem' : 'renderButtonGroup';
Expand Down
6 changes: 6 additions & 0 deletions src/DropdownMenu.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,12 @@ const DropdownMenu = React.createClass({
onSelect: React.PropTypes.func
},

getDefaultProps() {
return {
pullRight: false
};
},

render() {
let classes = {
'dropdown-menu': true,
Expand Down
1 change: 1 addition & 0 deletions src/FormGroup.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ class FormGroup extends React.Component {
}

FormGroup.defaultProps = {
hasFeedback: false,
standalone: false
};

Expand Down
3 changes: 2 additions & 1 deletion src/Grid.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ const Grid = React.createClass({

getDefaultProps() {
return {
componentClass: 'div'
componentClass: 'div',
fluid: false
};
},

Expand Down
6 changes: 6 additions & 0 deletions src/InputBase.js
Original file line number Diff line number Diff line change
Expand Up @@ -228,4 +228,10 @@ InputBase.propTypes = {
value: React.PropTypes.any
};

InputBase.defaultProps = {
disabled: false,
hasFeedback: false,
multiple: false
};

export default InputBase;
5 changes: 4 additions & 1 deletion src/Interpolate.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,10 @@ const Interpolate = React.createClass({
},

getDefaultProps() {
return { component: 'span' };
return {
component: 'span',
unsafe: false
};
},

render() {
Expand Down
3 changes: 2 additions & 1 deletion src/ListGroupItem.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ const ListGroupItem = React.createClass({

getDefaultProps() {
return {
bsClass: 'list-group-item'
bsClass: 'list-group-item',
listItem: false
};
},

Expand Down
5 changes: 4 additions & 1 deletion src/MenuItem.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,10 @@ const MenuItem = React.createClass({

getDefaultProps() {
return {
active: false
active: false,
divider: false,
disabled: false,
header: false
};
},

Expand Down
8 changes: 7 additions & 1 deletion src/Nav.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,13 @@ const Nav = React.createClass({
getDefaultProps() {
return {
bsClass: 'nav',
expanded: true
collapsible: false,
expanded: true,
justified: false,
navbar: false,
pullRight: false,
right: false,
stacked: false
};
},

Expand Down
7 changes: 7 additions & 0 deletions src/NavItem.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,13 @@ const NavItem = React.createClass({
'aria-controls': React.PropTypes.string
},

getDefaultProps() {
return {
active: false,
disabled: false
};
},

render() {
let {
role,
Expand Down
8 changes: 7 additions & 1 deletion src/Navbar.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,13 @@ const Navbar = React.createClass({
bsClass: 'navbar',
bsStyle: 'default',
role: 'navigation',
componentClass: 'nav'
componentClass: 'nav',
fixedTop: false,
fixedBottom: false,
staticTop: false,
inverse: false,
fluid: false,
defaultNavExpanded: false
};
},

Expand Down
4 changes: 3 additions & 1 deletion src/Overlay.js
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,9 @@ Overlay.propTypes = {
};

Overlay.defaultProps = {
animation: Fade
animation: Fade,
rootClose: false,
show: false
};

export default Overlay;
4 changes: 2 additions & 2 deletions src/OverlayTrigger.js
Original file line number Diff line number Diff line change
Expand Up @@ -95,14 +95,14 @@ const OverlayTrigger = React.createClass({

getDefaultProps() {
return {
defaultOverlayShown: false,
trigger: ['hover', 'focus']
};
},

getInitialState() {
return {
isOverlayShown: this.props.defaultOverlayShown == null ?
false : this.props.defaultOverlayShown
isOverlayShown: this.props.defaultOverlayShown
};
},

Expand Down
8 changes: 8 additions & 0 deletions src/PageItem.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,14 @@ const PageItem = React.createClass({
eventKey: React.PropTypes.any
},

getDefaultProps() {
return {
disabled: false,
previous: false,
next: false
};
},

render() {
let classes = {
'disabled': this.props.disabled,
Expand Down
1 change: 1 addition & 0 deletions src/PanelGroup.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ const PanelGroup = React.createClass({

getDefaultProps() {
return {
accordion: false,
bsClass: 'panel-group'
};
},
Expand Down
9 changes: 8 additions & 1 deletion src/ProgressBar.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ const ProgressBar = React.createClass({
children: onlyProgressBar,
className: React.PropTypes.string,
interpolateClass: PropTypes.node,
/**
* @private
*/
isChild: PropTypes.bool
},

Expand All @@ -29,7 +32,11 @@ const ProgressBar = React.createClass({
return {
bsClass: 'progress-bar',
min: 0,
max: 100
max: 100,
active: false,
isChild: false,
srOnly: false,
striped: false
};
},

Expand Down
5 changes: 4 additions & 1 deletion src/SplitButton.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,10 @@ const SplitButton = React.createClass({

getDefaultProps() {
return {
dropdownTitle: 'Toggle dropdown'
dropdownTitle: 'Toggle dropdown',
disabled: false,
dropup: false,
pullRight: false
};
},

Expand Down
4 changes: 3 additions & 1 deletion src/SubNav.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,9 @@ const SubNav = React.createClass({

getDefaultProps() {
return {
bsClass: 'nav'
bsClass: 'nav',
active: false,
disabled: false
};
},

Expand Down
10 changes: 10 additions & 0 deletions src/Table.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,16 @@ const Table = React.createClass({
responsive: React.PropTypes.bool
},

getDefaultProps() {
return {
bordered: false,
condensed: false,
hover: false,
responsive: false,
striped: false
};
},

render() {
let classes = {
'table': true,
Expand Down

0 comments on commit defe43a

Please sign in to comment.