Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Antd Modal, clicking on Mask to not do anything

So by default, Antd Modal will trigger the onCancel property of Modal when the user clicks on the mask(area outside the modal).

But what i want is the program to not trigger anything when the user click mask (just close the modal and not change anything), because i have my own function in the onCancel. How do i make it so? Thanks in advance!

like image 696
Gerald Tambunan Avatar asked Dec 07 '22 12:12

Gerald Tambunan


1 Answers

Its so easy, you can delete onCancel line on your modal :D

      <Modal
          title="Basic Modal"
          visible={this.state.visible}
          onOk={this.handleOk}
          //onCancel={this.handleCancel}
        >
          <p>Some contents...</p>
          <p>Some contents...</p>
          <p>Some contents...</p>
       </Modal>
like image 50
EvilCaT Avatar answered Dec 11 '22 08:12

EvilCaT