Skip to content

Commit 464a199

Browse files
committed
Add note about animation timing in the docs
Closes #284
1 parent c3279b5 commit 464a199

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

src/Transition.js

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,10 +55,10 @@ export const EXITING = 'exiting';
5555
* component (such as by adding styles or classes) when it changes states.
5656
*
5757
* There are 4 main states a Transition can be in:
58-
* - `entering`
59-
* - `entered`
60-
* - `exiting`
61-
* - `exited`
58+
* - `'entering'`
59+
* - `'entered'`
60+
* - `'exiting'`
61+
* - `'exited'`
6262
*
6363
* Transition state is toggled via the `in` prop. When `true` the component begins the
6464
* "Enter" stage. During this stage, the component will shift from its current transition state,
@@ -87,6 +87,14 @@ export const EXITING = 'exiting';
8787
*
8888
* When `in` is `false` the same thing happens except the state moves from `'exiting'` to `'exited'`.
8989
*
90+
* ## Timing
91+
*
92+
* Timing is often the trickiest part of animation, mistakes can result in slight delays
93+
* that are hard to pin down. A common example is when you want to add an exit transition,
94+
* you should set the desired final styles when the state is `'exiting'`. That's when the
95+
* transition to those styles will start and, if you matched the `timeout` prop with the
96+
* CSS Transition duration, it will end exactly when the state changes to `'exited'`.
97+
*
9098
* > **Note**: For simpler transitions the `Transition` component might be enough, but
9199
* > take into account that it's platform-agnostic, while the `CSSTransition` component
92100
* > [forces reflows](https://github.com/reactjs/react-transition-group/blob/5007303e729a74be66a21c3e2205e4916821524b/src/CSSTransition.js#L208-L215)

0 commit comments

Comments
 (0)