Skip to content

Commit 49ea644

Browse files
authored
fix undefined value (#1328)
1 parent fe17748 commit 49ea644

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/components/picker/index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -249,12 +249,12 @@ class Picker extends Component {
249249

250250
const {getItemLabel = _.noop} = this.props;
251251
return _.chain(value)
252-
.map(item => (_.isPlainObject(item) ? getItemLabel(item) || item.label : itemsByValue[item].label))
252+
.map(item => (_.isPlainObject(item) ? getItemLabel(item) || item?.label : itemsByValue[item]?.label))
253253
.join(', ')
254254
.value();
255255
};
256256

257-
getLabel(value) {
257+
getLabel = value => {
258258
const {getLabel} = this.props;
259259

260260
if (_.isFunction(getLabel) && !_.isUndefined(getLabel(value))) {

0 commit comments

Comments
 (0)