Skip to content

Commit 53f8ba9

Browse files
tchayensatya164
authored andcommitted
fix: change single param to props object in onTransition callba… (facebook#171)
1 parent c0c17e9 commit 53f8ba9

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

packages/stack/src/types.tsx

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,10 @@ export type HeaderProps = {
9393
styleInterpolator: HeaderStyleInterpolator;
9494
};
9595

96+
export type TransitionCallbackProps = {
97+
closing: boolean;
98+
};
99+
96100
export type NavigationStackOptions = HeaderOptions &
97101
Partial<TransitionPreset> & {
98102
title?: string;
@@ -107,8 +111,8 @@ export type NavigationStackOptions = HeaderOptions &
107111
vertical?: number;
108112
horizontal?: number;
109113
};
110-
onTransitionStart?: (closing: boolean) => void;
111-
onTransitionEnd?: (closing: boolean) => void;
114+
onTransitionStart?: (props: TransitionCallbackProps) => void;
115+
onTransitionEnd?: (props: TransitionCallbackProps) => void;
112116
};
113117

114118
export type NavigationStackConfig = {

packages/stack/src/views/Stack/Stack.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -263,7 +263,7 @@ export default class Stack extends React.Component<Props, State> {
263263

264264
descriptor &&
265265
descriptor.options.onTransitionStart &&
266-
descriptor.options.onTransitionStart(closing);
266+
descriptor.options.onTransitionStart({ closing });
267267
};
268268

269269
private handleTransitionEnd = (
@@ -274,7 +274,7 @@ export default class Stack extends React.Component<Props, State> {
274274

275275
descriptor &&
276276
descriptor.options.onTransitionEnd &&
277-
descriptor.options.onTransitionEnd(closing);
277+
descriptor.options.onTransitionEnd({ closing });
278278
};
279279

280280
render() {

0 commit comments

Comments
 (0)