Merge pull request #1565 from virtuacoplenny/lenny/defensive-classnames
fix(toolbox): Defensively check classNames when mapping button attrib…
This commit is contained in:
commit
b7c57d306a
|
@ -21,13 +21,9 @@ export { abstractMapStateToProps } from './functions.native';
|
||||||
*/
|
*/
|
||||||
export function getButtonAttributesByProps(props: Object = {})
|
export function getButtonAttributesByProps(props: Object = {})
|
||||||
: MapOfAttributes {
|
: MapOfAttributes {
|
||||||
let classNames = props.classNames;
|
// XXX Make sure to not modify props.classNames because that'd be bad
|
||||||
|
// practice.
|
||||||
if (classNames) {
|
const classNames = (props.classNames && [ ...props.classNames ]) || [];
|
||||||
// XXX Make sure to not modify props.classNames because that'd be bad
|
|
||||||
// practice.
|
|
||||||
classNames = [ ...classNames ];
|
|
||||||
}
|
|
||||||
|
|
||||||
props.toggled && classNames.push('toggled');
|
props.toggled && classNames.push('toggled');
|
||||||
props.unclickable && classNames.push('unclickable');
|
props.unclickable && classNames.push('unclickable');
|
||||||
|
|
Loading…
Reference in New Issue