From 53f8ba97dfe56b404fe9c6f630e8979af2072bf9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tomasz=20Czaj=C4=99cki?= Date: Tue, 30 Jul 2019 15:05:05 +0200 Subject: [PATCH] =?UTF-8?q?fix:=20change=20single=20param=20to=20props=20o?= =?UTF-8?q?bject=20in=20onTransition=20callba=E2=80=A6=20(#171)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/stack/src/types.tsx | 8 ++++++-- packages/stack/src/views/Stack/Stack.tsx | 4 ++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/packages/stack/src/types.tsx b/packages/stack/src/types.tsx index eb6978982ddbe7..7e5ddec665ef48 100644 --- a/packages/stack/src/types.tsx +++ b/packages/stack/src/types.tsx @@ -93,6 +93,10 @@ export type HeaderProps = { styleInterpolator: HeaderStyleInterpolator; }; +export type TransitionCallbackProps = { + closing: boolean; +}; + export type NavigationStackOptions = HeaderOptions & Partial & { title?: string; @@ -107,8 +111,8 @@ export type NavigationStackOptions = HeaderOptions & vertical?: number; horizontal?: number; }; - onTransitionStart?: (closing: boolean) => void; - onTransitionEnd?: (closing: boolean) => void; + onTransitionStart?: (props: TransitionCallbackProps) => void; + onTransitionEnd?: (props: TransitionCallbackProps) => void; }; export type NavigationStackConfig = { diff --git a/packages/stack/src/views/Stack/Stack.tsx b/packages/stack/src/views/Stack/Stack.tsx index 8e64cebc0f0729..820e243c19833a 100755 --- a/packages/stack/src/views/Stack/Stack.tsx +++ b/packages/stack/src/views/Stack/Stack.tsx @@ -263,7 +263,7 @@ export default class Stack extends React.Component { descriptor && descriptor.options.onTransitionStart && - descriptor.options.onTransitionStart(closing); + descriptor.options.onTransitionStart({ closing }); }; private handleTransitionEnd = ( @@ -274,7 +274,7 @@ export default class Stack extends React.Component { descriptor && descriptor.options.onTransitionEnd && - descriptor.options.onTransitionEnd(closing); + descriptor.options.onTransitionEnd({ closing }); }; render() {