Skip to content

Commit 6a09814

Browse files
committed
Add addListener to navigation prop docs
1 parent 49b6fb5 commit 6a09814

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

docs/navigation-prop.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ Each `screen` component in your app is provided with the `navigation` prop autom
99
* `this.props.navigation`
1010
* `navigate` - go to another screen, figures out the action it needs to take to do it
1111
* `goBack` - close active screen and move back in the stack
12+
* `addListener` - subscribe to updates to navigation lifecycle
1213
* `state` - current state/routes
1314
* `setParams` - make changes to route's params
1415
* `dispatch` - send an action to router
@@ -98,6 +99,15 @@ Then you need to supply a key to goBack _FROM_:
9899
navigation.goBack(SCREEN_KEY_B) // will go to screen A FROM screen B
99100
```
100101

102+
### `addListener` - Subscribe to updates to navigation lifecycle
103+
104+
React Navigation emits events to screen components that subscribe to them:
105+
106+
- `willBlur` - the screen will be unfocused
107+
- `willFocus` - the screen will focus
108+
- `didFocus` - the screen focused (if there was a transition, the transition completed)
109+
- `didBlur` - the screen unfocused (if there was a transition, the transition completed)
110+
101111
### `state` - The screen's current state/route
102112

103113
A screen has access to its route via `this.props.navigation.state`. Each will return an object with the following:

0 commit comments

Comments
 (0)