From 723e4d839ae1bc36844ef4332d2300f0674e236d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Morineau?= Date: Fri, 13 Oct 2017 00:52:00 +0200 Subject: [PATCH] Fixed a typo --- lib/SuperSelectField.js | 11 ++++++++++- src/SuperSelectField.js | 2 +- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/lib/SuperSelectField.js b/lib/SuperSelectField.js index 1a84938..fcb355f 100644 --- a/lib/SuperSelectField.js +++ b/lib/SuperSelectField.js @@ -484,6 +484,13 @@ var SelectField = function (_Component2) { }); } } + }, { + key: 'componentDidMount', + value: function componentDidMount() { + // Potential problem with Popover ? + // https://github.com/callemall/material-ui/blob/master/src/DropDownMenu/DropDownMenu.js#L237 + if (this.props.openImmediately) this.openMenu(); + } // Counts nodes with non-null value property without optgroups // noinspection JSMethodCanBeStatic @@ -540,7 +547,7 @@ var SelectField = function (_Component2) { value: function openMenu() { var _this4 = this; - if (!this.satte.isOpen) this.props.onMenuOpen(); + if (!this.state.isOpen) this.props.onMenuOpen(); if (this.state.itemsLength) this.setState({ isOpen: true }, function () { return _this4.focusTextField(); }); @@ -944,6 +951,7 @@ SelectField.propTypes = { menuCloseButton: _propTypes2.default.node, canAutoPosition: _propTypes2.default.bool, multiple: _propTypes2.default.bool, + openImmediately: _propTypes2.default.bool, disabled: _propTypes2.default.bool, onChange: _propTypes2.default.func, onMenuOpen: _propTypes2.default.func, @@ -958,6 +966,7 @@ SelectField.defaultProps = { menuCloseButton: null, canAutoPosition: true, multiple: false, + openImmediately: false, disabled: false, nb2show: 5, hintText: 'Click me', diff --git a/src/SuperSelectField.js b/src/SuperSelectField.js index e31b5c2..b13264c 100644 --- a/src/SuperSelectField.js +++ b/src/SuperSelectField.js @@ -296,7 +296,7 @@ class SelectField extends Component { } openMenu () { - if (!this.satte.isOpen) this.props.onMenuOpen() + if (!this.state.isOpen) this.props.onMenuOpen() if (this.state.itemsLength) this.setState({ isOpen: true }, () => this.focusTextField()) }