Alon Burg
Alon Burg

Reputation: 2550

react-bootstrap modal unmounting with animation

I'm using react-bootstrap (0.28.3) with React embedded in a Backbone app.

In my Backbone view render I'm doing something like this: ReactDOM.render(React.createElement(MyModal, this.options}), this.el);

When destroying the Backbone view / Backbone router changes route, I have an onDestroyed() which unmounts the React component.

    onDestroyed() {
        ReactDOM.unmountComponentAtNode(this.el)
    }

However this causes the modal to disappear without the animation.

How can I unmount the react-bootstrap modal and gracefully wait for the animation?

Upvotes: 2

Views: 1941

Answers (1)

frontsideair
frontsideair

Reputation: 528

Modal takes a show prop, which will make modal fade if it's set to false. So if you can re-render the MyModal component with show set to false and put unmount logic in a setTimeout with required time, it should work.

Upvotes: 4

Related Questions