Skip to content

Commit

Permalink
fix: change single param to props object in onTransition callba… (fac…
Browse files Browse the repository at this point in the history
  • Loading branch information
tchayen authored and satya164 committed Aug 18, 2019
1 parent c0c17e9 commit 53f8ba9
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
8 changes: 6 additions & 2 deletions packages/stack/src/types.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,10 @@ export type HeaderProps = {
styleInterpolator: HeaderStyleInterpolator;
};

export type TransitionCallbackProps = {
closing: boolean;
};

export type NavigationStackOptions = HeaderOptions &
Partial<TransitionPreset> & {
title?: string;
Expand All @@ -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 = {
Expand Down
4 changes: 2 additions & 2 deletions packages/stack/src/views/Stack/Stack.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@ export default class Stack extends React.Component<Props, State> {

descriptor &&
descriptor.options.onTransitionStart &&
descriptor.options.onTransitionStart(closing);
descriptor.options.onTransitionStart({ closing });
};

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

descriptor &&
descriptor.options.onTransitionEnd &&
descriptor.options.onTransitionEnd(closing);
descriptor.options.onTransitionEnd({ closing });
};

render() {
Expand Down

0 comments on commit 53f8ba9

Please sign in to comment.