Closed harshan89 closed 5 years ago
Hi @harshan89 ,
I think you did a typo or something similar. For me, this code works correctly. Check if this code works for you as well.
import React, { Component } from "react";
import {
MDBContainer,
MDBBtn,
MDBModal,
MDBModalBody,
MDBModalHeader,
MDBModalFooter,
MDBTimePicker
} from "mdbreact";
class ModalPage extends Component {
state = {
modal: false
};
toggle = () => {
this.setState({
modal: !this.state.modal
});
};
getPickerValue = value => {
console.log(value);
};
render() {
return (
<MDBContainer>
<MDBBtn onClick={this.toggle}>Modal</MDBBtn>
<MDBModal isOpen={this.state.modal} toggle={this.toggle}>
<MDBModalHeader toggle={this.toggle}>MDBModal title</MDBModalHeader>
<MDBModalBody>
<MDBTimePicker
id="timePicker"
label="12hrs format"
getValue={this.getPickerValue}
/>
</MDBModalBody>
<MDBModalFooter>
<MDBBtn color="secondary" onClick={this.toggle}>
Close
</MDBBtn>
<MDBBtn color="primary">Save changes</MDBBtn>
</MDBModalFooter>
</MDBModal>
</MDBContainer>
);
}
}
export default ModalPage;