Skip to content

Commit

Permalink
Update doc to inform v3 users about close transition
Browse files Browse the repository at this point in the history
  • Loading branch information
hoodwink73 authored and diasbruno committed Aug 28, 2018
1 parent 1e349c0 commit 3d74c1b
Showing 1 changed file with 40 additions and 2 deletions.
42 changes: 40 additions & 2 deletions docs/styles/transitions.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,49 @@ and fade out when it is closed:
}
```

In order for the close transition to take effect, you will also need to pass
the `closeTimeoutMS={150}` prop to each of your modals.

The above example will apply the fade transition globally, affecting all modals
whose `afterOpen` and `beforeClose` classes have not been set via the
`className` prop. To apply the transition to one modal only, you can change
the above class names and pass an object to your modal's `className` prop as
described in the [previous section](classes.md).

In order for the close transition to take effect, you will also need to pass
the `closeTimeoutMS={150}` prop to each of your modals.

Also, if you are using `v3` which supports **React 16**, the close transition works [only if you use](https://github.com/reactjs/react-modal/issues/530#issuecomment-335208533) the `isOpen` prop to toggle the visibility of the modal.

Do not conditionally render the `<Modal />`.

Instead of this

```javascript
{
this.state.showModal ?
<Modal
closeTimeoutMS={200}
isOpen
contentLabel="modal"
onRequestClose={() => this.toggleModal()}
>
<h2>Add modal content here</h2>
</Modal>
: null
}
```

*Do this*

```javascript
{
<Modal
closeTimeoutMS={200}
isOpen={this.state.showModal}
contentLabel="modal"
onRequestClose={() => this.toggleModal()}
>
<h2>Add modal content here</h2>
</Modal>
: null
}
```

0 comments on commit 3d74c1b

Please sign in to comment.