File tree Expand file tree Collapse file tree 2 files changed +7
-7
lines changed Expand file tree Collapse file tree 2 files changed +7
-7
lines changed Original file line number Diff line number Diff line change @@ -165,8 +165,8 @@ The functions **`this.props.setRightProps`**, **`this.props.setLeftProps`** and
165
165
166
166
As of 0.7.0 the router acts as a relay for events emitted by the navigator, and extends these to the following list:
167
167
168
- - ` willFocus ` : Emitted when a route will focus. Emits the route name as a string .
169
- - ` didFocus ` : Emitted when a route did focus. Emits the route name as a string .
168
+ - ` willFocus ` : Emitted when a route will focus. Emits route object .
169
+ - ` didFocus ` : Emitted when a route did focus. Emits route object .
170
170
- ` willPop ` : Emitted when a route stack will be popped. Triggered by ` Navigator.pop(); `
171
171
- ` didPop ` : Emitted when a route stack did pop. Triggered by ` Navigator.pop(); `
172
172
- ` willPush ` : Emitted when a new route will be pushed to the route stack. Emits the new route object. Triggered by ` Navigator.push(route); `
@@ -181,9 +181,9 @@ As of 0.7.0 the router acts as a relay for events emitted by the navigator, and
181
181
You can listen to these events by adding an event listener as such:
182
182
183
183
``` javascript
184
- this .props .routeEmitter .addListener (' didFocus' , (name ) => {
185
- // Do something with name..
186
- });
184
+ this .props .routeEmitter .addListener (' didFocus' , (route ) => {
185
+ console . log ( route . name , ' didFocus ' );
186
+ });
187
187
```
188
188
189
189
As of v0.8.0 the ` leftCorner ` , ` rightCorner ` and ` titleComponent ` have access to the following router functions :
Original file line number Diff line number Diff line change @@ -83,12 +83,12 @@ class Router extends React.Component {
83
83
this . refs . navigator . navigationContext . addListener ( 'willfocus' , ( event ) => {
84
84
const route = event . data . route ;
85
85
this . setState ( { route } ) ;
86
- this . emitter . emit ( 'willFocus' , route . name ) ;
86
+ this . emitter . emit ( 'willFocus' , route ) ;
87
87
} ) ;
88
88
89
89
this . refs . navigator . navigationContext . addListener ( 'didfocus' , ( event ) => {
90
90
const route = event . data . route ;
91
- this . emitter . emit ( 'didFocus' , route . name ) ;
91
+ this . emitter . emit ( 'didFocus' , route ) ;
92
92
} ) ;
93
93
94
94
aspect . before ( this . refs . navigator , 'pop' , ( ) => {
You can’t perform that action at this time.
0 commit comments