render label

This commit is contained in:
Belen Curcio
2017-10-13 08:03:47 -03:00
parent c98cb02a4a
commit be6b1466c6
+5 -5
View File
@@ -68,11 +68,11 @@ class Dropdown extends React.Component {
renderLabel() {
const options = React.Children.toArray(this.props.children);
const option = options.find((option) => option.props.value === this.props.value);
if (option.props.label) {
return option.props.label;
} else if(option.props.value) {
return option.props.value;
if (option) {
return option.props.label ? option.props.label : option.props.value;
} else if (this.props.value) {
return this.props.value;
} else {
return this.props.placeholder;
}