From 21cab20b26ec0afe37667455d242bc491cd8b2c7 Mon Sep 17 00:00:00 2001 From: jquense Date: Mon, 16 Nov 2015 11:37:30 -0500 Subject: [PATCH] [changed] dropdown props are passed through to the dropdown Button fixes #1497 --- src/DropdownButton.js | 21 ++++++++++++++++----- src/SplitButton.js | 32 ++++++++++++++++++-------------- 2 files changed, 34 insertions(+), 19 deletions(-) diff --git a/src/DropdownButton.js b/src/DropdownButton.js index e0de69b99f..3ac511adc1 100644 --- a/src/DropdownButton.js +++ b/src/DropdownButton.js @@ -1,22 +1,31 @@ import React from 'react'; import Dropdown from './Dropdown'; import omit from 'lodash-compat/object/omit'; +import pick from 'lodash-compat/object/pick'; import Button from './Button'; class DropdownButton extends React.Component { render() { - let { title, ...props } = this.props; + let { bsStyle, bsSize, disabled } = this.props; + let { title, children, ...props } = this.props; - let toggleProps = omit(props, Dropdown.ControlledComponent.propTypes); + let dropdownProps = pick(props, Object.keys(Dropdown.ControlledComponent.propTypes)); + let toggleProps = omit(props, Object.keys(Dropdown.ControlledComponent.propTypes)); return ( - - + + {title} - {this.props.children} + {children} ); @@ -24,6 +33,7 @@ class DropdownButton extends React.Component { } DropdownButton.propTypes = { + disabled: React.PropTypes.bool, bsStyle: Button.propTypes.bsStyle, bsSize: Button.propTypes.bsSize, @@ -37,6 +47,7 @@ DropdownButton.propTypes = { }; DropdownButton.defaultProps = { + disabled: false, pullRight: false, dropup: false, navItem: false, diff --git a/src/SplitButton.js b/src/SplitButton.js index df599394ca..6f68052c41 100644 --- a/src/SplitButton.js +++ b/src/SplitButton.js @@ -2,6 +2,8 @@ import React from 'react'; import Button from './Button'; import Dropdown from './Dropdown'; import SplitToggle from './SplitToggle'; +import omit from 'lodash-compat/object/omit'; +import pick from 'lodash-compat/object/pick'; class SplitButton extends React.Component { @@ -12,30 +14,32 @@ class SplitButton extends React.Component { onClick, target, href, + bsSize, bsStyle, ...props } = this.props; let { disabled } = props; - let button = ( - - ); + let dropdownProps = pick(props, Object.keys(Dropdown.ControlledComponent.propTypes)); + let buttonProps = omit(props, Object.keys(Dropdown.ControlledComponent.propTypes)); return ( - - {button} - + +