Skip to content
This repository was archived by the owner on Feb 25, 2020. It is now read-only.

Commit b7275d6

Browse files
committed
fix: deliver toChildKey with StackAction
1 parent 32fb995 commit b7275d6

1 file changed

Lines changed: 12 additions & 4 deletions

File tree

src/views/Stack/StackView.tsx

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -230,9 +230,15 @@ class StackView extends React.Component<Props, State> {
230230
return <HeaderContainer {...props} />;
231231
};
232232

233-
private handleTransitionComplete = () => {
233+
private handleTransitionComplete = ({
234+
route,
235+
}: {
236+
route: NavigationRoute;
237+
}) => {
234238
// TODO: remove when the new event system lands
235-
this.props.navigation.dispatch(StackActions.completeTransition());
239+
this.props.navigation.dispatch(
240+
StackActions.completeTransition({ toChildKey: route.key })
241+
);
236242
};
237243

238244
private handleGoBack = ({ route }: { route: NavigationRoute }) => {
@@ -243,7 +249,7 @@ class StackView extends React.Component<Props, State> {
243249
};
244250

245251
private handleOpenRoute = ({ route }: { route: NavigationRoute }) => {
246-
this.handleTransitionComplete();
252+
this.handleTransitionComplete({ route });
247253
this.setState(state => ({
248254
routes: state.replacing.length
249255
? state.routes.filter(r => !state.replacing.includes(r.key))
@@ -255,7 +261,9 @@ class StackView extends React.Component<Props, State> {
255261
};
256262

257263
private handleCloseRoute = ({ route }: { route: NavigationRoute }) => {
258-
this.handleTransitionComplete();
264+
this.handleTransitionComplete({
265+
route: this.state.routes[this.state.routes.length - 1],
266+
});
259267

260268
// This event will trigger when the animation for closing the route ends
261269
// In this case, we need to clean up any state tracking the route and pop it immediately

0 commit comments

Comments
 (0)