Skip to content

Commit 500c8a0

Browse files
andry-bakaspencercarli
authored andcommitted
Doc Improvement: goBack key doc improvement (react-navigation#2035)
* chore(Doc Improvement): goBack key doc improvement * chore(Doc improvement): fix wording * chore(Doc Improvement): fix uppercase/lowercase wording
1 parent 3ad142b commit 500c8a0

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

docs/guides/Screen-Navigation-Prop.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,26 @@ class HomeScreen extends React.Component {
116116
}
117117
```
118118

119+
*Going back from a specific screen*
120+
121+
Consider the following navigation stack history:
122+
```...
123+
navigation.navigate(SCREEN_KEY_A);
124+
...
125+
navigation.navigate(SCREEN_KEY_B);
126+
...
127+
navigation.navigate(SCREEN_KEY_C);
128+
...
129+
navigation.navigate(SCREEN_KEY_D);
130+
```
131+
132+
Now you are on *screen D* and want to go back to *screen A* (popping D, C, and B).
133+
Then you need to supply a key to goBack *FROM*:
134+
135+
```
136+
navigation.goBack(SCREEN_KEY_B) // will go to screen A FROM screen B
137+
```
138+
119139
## `dispatch` - Send an action to the router
120140

121141
Use dispatch to send any navigation action to the router. The other navigation functions use dispatch behind the scenes.

0 commit comments

Comments
 (0)