diff --git a/packages/react-router/src/ReactRouter/IonRouter.tsx b/packages/react-router/src/ReactRouter/IonRouter.tsx index 16b81d64e2..a21d53c045 100644 --- a/packages/react-router/src/ReactRouter/IonRouter.tsx +++ b/packages/react-router/src/ReactRouter/IonRouter.tsx @@ -244,11 +244,17 @@ class IonRouterInner extends React.PureComponent { if (routeInfo && routeInfo.pushedByRoute) { const prevInfo = this.locationHistory.findLastLocation(routeInfo); if (prevInfo) { + /** + * This needs to be passed to handleNavigate + * otherwise incomingRouteParams.routeAnimation + * will be overridden. + */ + const incomingAnimation = routeAnimation || routeInfo.routeAnimation; this.incomingRouteParams = { ...prevInfo, routeAction: 'pop', routeDirection: 'back', - routeAnimation: routeAnimation || routeInfo.routeAnimation, + routeAnimation: incomingAnimation, }; if ( routeInfo.lastPathname === routeInfo.pushedByRoute || @@ -270,7 +276,7 @@ class IonRouterInner extends React.PureComponent { const goBack = history.goBack || history.back; goBack(); } else { - this.handleNavigate(prevInfo.pathname + (prevInfo.search || ''), 'pop', 'back', routeAnimation); + this.handleNavigate(prevInfo.pathname + (prevInfo.search || ''), 'pop', 'back', incomingAnimation); } } else { this.handleNavigate(defaultHref as string, 'pop', 'back', routeAnimation);