onbaording search visibility 89/73889/2
authorYarin Dekel <yarind@amdocs.com>
Thu, 29 Nov 2018 08:24:07 +0000 (10:24 +0200)
committerEinav Keidar <einavw@amdocs.com>
Sun, 2 Dec 2018 11:51:49 +0000 (11:51 +0000)
Issue-ID: SDC-1963
Change-Id: I2e40deb35970c848422c471114fccf2bb5c331e2
Signed-off-by: Yarin Dekel <yarind@amdocs.com>
openecomp-ui/src/nfvo-components/input/ExpandableInput.jsx

index 3973ae8..be0ebf2 100644 (file)
@@ -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 && (