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

Commit

Permalink
Navigator: emit didFocus after routeStack reset
Browse files Browse the repository at this point in the history
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 facebook#5596

Differential Revision: D3080004

Pulled By: ericvicenti

fb-gh-sync-id: 0ef4ecebec7076275b6433c80aae6102cf28c039
shipit-source-id: 0ef4ecebec7076275b6433c80aae6102cf28c039
  • Loading branch information
adrienbrault authored and Facebook Github Bot 1 committed Mar 22, 2016
1 parent 7035ada commit 7fdabd8
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions Libraries/CustomComponents/Navigator/Navigator.js
Original file line number Diff line number Diff line change
Expand Up @@ -371,6 +371,7 @@ var Navigator = React.createClass({
}, () => {
this._handleSpringUpdate();
this._navBar && this._navBar.immediatelyRefresh();
this._emitDidFocus(this.state.routeStack[this.state.presentedIndex]);
});
},

Expand Down

0 comments on commit 7fdabd8

Please sign in to comment.