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

Commit

Permalink
fix: handle race conditions while ending transition
Browse files Browse the repository at this point in the history
  • Loading branch information
osdnk committed Sep 25, 2019
1 parent 677a873 commit 2eb5edb
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/views/Stack/StackView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -261,8 +261,11 @@ class StackView extends React.Component<Props, State> {
};

private handleCloseRoute = ({ route }: { route: NavigationRoute }) => {
const index = this.state.routes.findIndex(r => r.key === route.key);
// While closing route we need to point to the previous one assuming that
// this previous one in routes array
this.handleTransitionComplete({
route: this.state.routes[this.state.routes.length - 2],
route: this.state.routes[Math.max(index - 1, 0)],
});

// This event will trigger when the animation for closing the route ends
Expand Down

0 comments on commit 2eb5edb

Please sign in to comment.