Skip to content

Commit 3e1b205

Browse files
committed
Merge remote-tracking branch 'tylerthomasallen/master' into antd-3
2 parents 056ce2c + 5be6ce0 commit 3e1b205

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

modules/components/Field.js

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -55,15 +55,19 @@ export default class Field extends Component {
5555
}
5656

5757
filterOption = (input, option) => {
58-
const isInChildren = option.props.children.toLowerCase().indexOf(input.toLowerCase()) >= 0
59-
const isInValue = option.props.value.toLowerCase().indexOf(input.toLowerCase()) >= 0
60-
let isInGroupLabel = false
58+
const { value, groupLabel } = option.props;
6159

62-
if (option.props.groupLabel) {
63-
isInGroupLabel = option.props.groupLabel.toLowerCase().indexOf(input.toLowerCase()) >= 0
60+
let isInValue = false;
61+
if (typeof value === 'string') {
62+
isInValue = value.toLowerCase().indexOf(input.toLowerCase()) >= 0;
6463
}
6564

66-
return(isInChildren || isInValue || isInGroupLabel)
65+
let isInGroupLabel = false;
66+
if (typeof groupLabel === 'string') {
67+
isInGroupLabel = groupLabel.toLowerCase().indexOf(input.toLowerCase()) >= 0;
68+
}
69+
70+
return isInValue || isInGroupLabel;
6771
}
6872

6973
getFieldDisplayLabel(field, fieldKey) {

0 commit comments

Comments
 (0)