Skip to content

Commit 5744025

Browse files
authored
Add the onStart callback to the Flipper interface & document it (#198)
Fixes #197
1 parent 2749804 commit 5744025

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -321,6 +321,7 @@ staggerConfig={{
321321
| decisionData | - | `any` | Sometimes, you'll want the animated children of `Flipper` to behave differently depending on the state transition — maybe only certain `Flipped` elements should animate in response to a particular change. By providing the `decisionData` prop to the `Flipper` component, you'll make that data available to the `shouldFlip` and `shouldInvert` methods of each child `Flipped` component, so they can decided for themselves whether to animate or not. |
322322
| debug | `false` | `boolean` | This experimental prop will pause your animation right at the initial application of FLIP-ped styles. That will allow you to inspect the state of the animation at the very beginning, when it should look similar or identical to the UI before the animation began. |
323323
| portalKey | - | `string` | In general, the `Flipper` component will only apply transitions to its descendents. This allows multiple `Flipper` elements to coexist on the same page, but it will prevent animations from working if you use [portals](https://reactjs.org/docs/portals.html). You can provide a unique `portalKey` prop to `Flipper` to tell it to scope element selections to the entire document, not just to its children, so that elements in portals can be transitioned. |
324+
| onStart | - | `function` | This callback prop will be called before any of the individual FLIP animations have started. It receives as arguments the HTMLElement of the Flipper and the decisionData object described elsewhere. |
324325
| onComplete | - | `function` | This callback prop will be called when all individual FLIP animations have completed. Its single argument is a list of `flipId`s for the `Flipped` components that were activated during the animation. If an animation is interrupted, `onComplete` will be still called right before the in-progress animation is terminated. |
325326
| handleEnterUpdateDelete | - | `function` | By default, `react-flip-toolkit` finishes animating out exiting elements before animating in new elements, with updating elements transforming immediately. You might want to have more control over the sequence of transitions — say, if you wanted to hide elements, pause, update elements, pause again, and finally animate in new elements. Or you might want transitions to happen simultaneously. If so, provide the function `handleEnterUpdateDelete` as a prop. [The best way to understand how this works is to check out this interactive example.](https://codesandbox.io/s/4q7qpkn8q0) `handleEnterUpdateDelete` receives the following arguments every time a transition occurs: |
326327

packages/flip-toolkit/src/Flipper.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@ interface Options {
2121
applyTransformOrigin?: boolean
2222
handleEnterUpdateDelete?: HandleEnterUpdateDelete
2323
debug?: boolean
24-
onComplete?: OnFlipperComplete
24+
onStart?: OnFlipperStart
25+
onComplete?: OnFlipperComplete
2526
}
2627

2728
class Flipper {

0 commit comments

Comments
 (0)