Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -165,8 +165,8 @@ The functions **`this.props.setRightProps`**, **`this.props.setLeftProps`** and

As of 0.7.0 the router acts as a relay for events emitted by the navigator, and extends these to the following list:

- `willFocus`: Emitted when a route will focus. Emits the route name as a string.
- `didFocus`: Emitted when a route did focus. Emits the route name as a string.
- `willFocus`: Emitted when a route will focus. Emits route object.
- `didFocus`: Emitted when a route did focus. Emits route object.
- `willPop`: Emitted when a route stack will be popped. Triggered by `Navigator.pop();`
- `didPop`: Emitted when a route stack did pop. Triggered by `Navigator.pop();`
- `willPush`: Emitted when a new route will be pushed to the route stack. Emits the new route object. Triggered by `Navigator.push(route);`
Expand All @@ -181,9 +181,9 @@ As of 0.7.0 the router acts as a relay for events emitted by the navigator, and
You can listen to these events by adding an event listener as such:

```javascript
this.props.routeEmitter.addListener('didFocus', (name) => {
//Do something with name..
});
this.props.routeEmitter.addListener('didFocus', (route) => {
console.log(route.name, 'didFocus');
});
```

As of v0.8.0 the `leftCorner`, `rightCorner` and `titleComponent` have access to the following router functions :
Expand Down
4 changes: 2 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,12 +83,12 @@ class Router extends React.Component {
this.refs.navigator.navigationContext.addListener('willfocus', (event) => {
const route = event.data.route;
this.setState({ route });
this.emitter.emit('willFocus', route.name);
this.emitter.emit('willFocus', route);
});

this.refs.navigator.navigationContext.addListener('didfocus', (event) => {
const route = event.data.route;
this.emitter.emit('didFocus', route.name);
this.emitter.emit('didFocus', route);
});

aspect.before(this.refs.navigator, 'pop', () => {
Expand Down