diff options
Diffstat (limited to 'openecomp-ui/src/nfvo-components/input/ExpandableInput.jsx')
-rw-r--r-- | openecomp-ui/src/nfvo-components/input/ExpandableInput.jsx | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/openecomp-ui/src/nfvo-components/input/ExpandableInput.jsx b/openecomp-ui/src/nfvo-components/input/ExpandableInput.jsx index 3973ae8c5d..be0ebf2bdd 100644 --- a/openecomp-ui/src/nfvo-components/input/ExpandableInput.jsx +++ b/openecomp-ui/src/nfvo-components/input/ExpandableInput.jsx @@ -95,11 +95,16 @@ class ExpandableInput extends React.Component { value: PropTypes.string }; - state = { showInput: false }; + constructor(props) { + super(props); + this.state = { + showInput: !!props.value || false + }; + } - closeInput() { - if (!this.props.value) { - this.setState({ showInput: false }); + showInputChange() { + if (this.props.value) { + this.setState({ showInput: true }); } } @@ -118,7 +123,7 @@ class ExpandableInput extends React.Component { onChange={onChange} value={value} handleKeyDown={e => this.handleKeyDown(e)} - handleBlur={() => this.closeInput()} + handleBlur={() => this.showInputChange()} /> )} {!this.state.showInput && ( |