From 074a37879eb35ff017a520ca93606c45e110cbaf Mon Sep 17 00:00:00 2001 From: rgoldiez Date: Tue, 19 Jan 2016 16:20:58 -0600 Subject: [PATCH] Added popToTop() in the onReplace method Added `this.refs.nav.popToTop()` to the onReplace method of `ExRouter.js` so that the components **unmount** when replacing the current route with another route. I was having an issue where one of my child routes that requires an event listener wasn't having it's `componentWillUnmount` called when replacing the route. This change is working for my use case. I'm new to this package so there may be a better way to solve this. --- ExRouter.js | 1 + 1 file changed, 1 insertion(+) diff --git a/ExRouter.js b/ExRouter.js index e30e75c21..cf39428fe 100644 --- a/ExRouter.js +++ b/ExRouter.js @@ -202,6 +202,7 @@ export default class ExRouter extends React.Component { return false; } } + this.refs.nav.popToTop(); this.refs.nav.replace(new ExRouteAdapter(route, props)); return true; }