Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/FlatButton/FlatButton.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import EnhancedButton from '../internal/EnhancedButton';
import FlatButtonLabel from './FlatButtonLabel';

function validateLabel(props, propName, componentName) {
if (!props.children && !props.label && !props.icon) {
if (!props.children && (!props.label && props.label !== 0) && !props.icon) {
Copy link
Copy Markdown
Member

@oliviertassinari oliviertassinari May 17, 2016

Choose a reason for hiding this comment

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

I'm wondering if we couldn't

  • use the warning module to remove some of the code in production
  • use React.PropTypes.node to improve this validation method.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

@oliviertassinari

  • I don't think any warning is needed here. I am wondering to know, warning message for what ? Component user has not done any mistake if he passed 0 as label.
  • Actually, Label validation doesn't depends on single property. We need to check presence of anyone property out of children, label, and icon. So we can't.

return new Error(`Required prop label or children or icon was not specified in ${componentName}.`);
}
}
Expand Down