From 7fdabd8f14e0aefc4efb7b05c0cb5d019f2a699f Mon Sep 17 00:00:00 2001 From: Adrien Brault Date: Mon, 21 Mar 2016 19:18:29 -0700 Subject: [PATCH] Navigator: emit didFocus after routeStack reset Summary:Hi, I am using https://github.com/aksonov/react-native-router-flux / https://github.com/exponentjs/ex-navigator and I needed a way to update my redux store with the current route. I'm using the navigation context to do this: ```javascript if (navigationContext) { const handler = () => { updateCurrentRouteState(navigationContext.currentRoute); }; navigationContext.addListener('willfocus', handler); navigationContext.addListener('didfocus', handler); } ``` However, when the whole stack is replaced, no event is emitted. This PR aims to fix that. Closes https://github.com/facebook/react-native/pull/5596 Differential Revision: D3080004 Pulled By: ericvicenti fb-gh-sync-id: 0ef4ecebec7076275b6433c80aae6102cf28c039 shipit-source-id: 0ef4ecebec7076275b6433c80aae6102cf28c039 --- Libraries/CustomComponents/Navigator/Navigator.js | 1 + 1 file changed, 1 insertion(+) diff --git a/Libraries/CustomComponents/Navigator/Navigator.js b/Libraries/CustomComponents/Navigator/Navigator.js index e5a8a3a84..d37490a60 100644 --- a/Libraries/CustomComponents/Navigator/Navigator.js +++ b/Libraries/CustomComponents/Navigator/Navigator.js @@ -371,6 +371,7 @@ var Navigator = React.createClass({ }, () => { this._handleSpringUpdate(); this._navBar && this._navBar.immediatelyRefresh(); + this._emitDidFocus(this.state.routeStack[this.state.presentedIndex]); }); },