Fixed device name input

This commit is contained in:
Claudio Maggioni 2020-03-23 21:03:16 +01:00
parent 557d18dfc1
commit 5d3a6fe99e

View file

@ -9,8 +9,8 @@ export default class ModalWindow extends Component {
this.state = {
id : "",
selectedIcon: "",
name: "",
img: "",
name: this.props.type === 'new' ? '' : this.props.idRoom.name,
img: this.props.type === 'new' ? '' : this.props.idRoom.images,
openModal: false
}
@ -48,6 +48,7 @@ export default class ModalWindow extends Component {
let nam = event.target.name;
let val = event.target.value;
this.setState({[nam]: val});
console.log(this.state);
}
closeModal = (e) => {
@ -108,12 +109,12 @@ export default class ModalWindow extends Component {
<p>Insert the name of the room:</p>
<Form.Field>
<Input label='Room name' placeholder='Room Name' name="name" type='text' onChange={this.changeSomething}
value={this.props.type === "new" ? "" : this.props.idRoom.name }/>
value={this.state.name}/>
</Form.Field>
<p>Insert an image of the room:</p>
<Form.Field>
<Input label='Room image' type='file' name="img" onChange={this.changeSomething}
value={this.props.type === "new" ? "" : this.props.idRoom.images }/>
value={this.state.img}/>
</Form.Field>
</Form>