简体   繁体   中英

React Typescript: Antd Modal not opening

Hello Im trying to open an Modal after clicking on a Button but it just dont open for some reason. Even in the Browser Elements it dont show up.

Here is the Code of the Modal and the Button:

<Button type="primary" icon={<EditOutlined />} onClick={() => this._updateQuestion(record, true) } />


private _updateQuestion = (record, modalVisible: boolean): JSX.Element => {
        return (
            <Modal
                title="Bearbeitung"
                centered
                visible={modalVisible}
                onOk={() => false}
                onCancel={() => false}
                width={1000}
            >
                <p>some contents...</p>
                <p>some contents...</p>
                <p>some contents...</p>
            </Modal>
        )
    }
return (
  <>
     <Button type="primary" icon={<EditOutlined />} onClick={() => this.setState({modalVisible: true}) />
     <Modal
       title="Bearbeitung"
       centered
       visible={this.state.modalVisible}
       onOk={() => {this.setState({modalVisible: false})}}
       onCancel={() => {this.setState({modalVisible: false})}}
       width={1000}
     >
         <p>some contents...</p>
         <p>some contents...</p>
         <p>some contents...</p>
     </Modal>
</>
)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM