I have the following Modal (TestModal) in a separate component:
<Modal
title="title"
centered={true}
visible={this.props.isOpen}
okText="Close"
onOk={this.props.onClose}
>
Test
</Modal>
Then within another component I have this:
class ModalContainer extends React.Component {
state = {
isModalOpen: false,
}
render() {
return (
<div onClick={() => this.setState({ isModalOpen: true })}>
<TestModal isOpen={this.state.isModalOpen} onClose={() => this.setState({ isModalOpen: false })} />
</div>
);
}
}
Now when I click the container the isOpen prop changes to true and its passed into the Modal which then shows it. Now when I click the isOk button it should close the modal (isModalOpen = false) However nothing happens. When I console.log the value of isModalOpen when I click the "close" button it keeps showing true. For some reason it does not change to false.
Any idea if its a react issue or antd issue?
React: 16.13.1 antd: 4.1.0