From 31cfc7bdeb20b1d347b5cb53740ed64d0f11317c Mon Sep 17 00:00:00 2001 From: Andre Medeiros Date: Wed, 3 Oct 2018 14:47:58 -0400 Subject: [PATCH] Move from props to state --- .../containers/ApplicationPreviewContainer.js | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/embark-ui/src/containers/ApplicationPreviewContainer.js b/embark-ui/src/containers/ApplicationPreviewContainer.js index 443e4181..1b880ae5 100644 --- a/embark-ui/src/containers/ApplicationPreviewContainer.js +++ b/embark-ui/src/containers/ApplicationPreviewContainer.js @@ -1,11 +1,11 @@ -import PropTypes from 'prop-types'; import React from 'react'; class ApplicationPreviewContainer extends React.Component { constructor(props) { super(props); + this.state = { - previewUrl: props.previewUrl || 'http://localhost:8000' + previewUrl: 'http://localhost:8000' }; } @@ -13,7 +13,7 @@ class ApplicationPreviewContainer extends React.Component { return (
- this.locationInput = input} value={this.props.previewUrl} /> + this.handlePreviewUrlChange(e)} />
@@ -23,6 +23,10 @@ class ApplicationPreviewContainer extends React.Component { ); } + handlePreviewUrlChange(ev) { + this.setState({previewUrl: ev.target.value}); + } + handlePreviewChange(ev) { try { let url = ev.target.contentWindow.location.toString(); @@ -33,13 +37,9 @@ class ApplicationPreviewContainer extends React.Component { } handlePreviewGo() { - this.previewIframe.src = this.locationInput.value; + this.previewIframe.src = this.previewUrl; } } -ApplicationPreviewContainer.propTypes = { - previewUrl: PropTypes.string -}; - export default ApplicationPreviewContainer;