Trigger modal shown for React Bootstrap

前端 未结 3 980
死守一世寂寞
死守一世寂寞 2020-12-21 05:20

http://react-bootstrap.github.io/components.html#modals - I am looking for a way to find the trigger event for \'shown.bs.modal\' and not \'show.bs.modal\'.

I don\'t

3条回答
  •  萌比男神i
    2020-12-21 05:55

    I also had this same issue and this is what I tried...

    Class Modal extends React.Component {
    
            showModal(){
            let obj = this.refs.modal;
            //write the required code here
          }
    render() {
        return (
          
    ); } }

    As I am using ES6 so I went with the class approach. I created a container div for modal contents and gave a ref attribute for reference. Then on click of tag I attached a handler which will trigger when the modal shows up. With the help of this.refs you can access the modal. Hope it helps you.

提交回复
热议问题