From 42b83b0b7a51849671cfa4718b55cbf7fe2df8a2 Mon Sep 17 00:00:00 2001 From: Yarin Dekel Date: Thu, 29 Nov 2018 10:24:07 +0200 Subject: [PATCH] onbaording search visibility Issue-ID: SDC-1963 Change-Id: I2e40deb35970c848422c471114fccf2bb5c331e2 Signed-off-by: Yarin Dekel --- .../src/nfvo-components/input/ExpandableInput.jsx | 15 ++++++++++----- 1 file 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 && ( -- 2.16.6