You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: versioned_docs/version-5.x/header-buttons.md
+4-3Lines changed: 4 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -67,7 +67,7 @@ function HomeScreen({ navigation }) {
67
67
<Button onPress={() =>setCount(c=> c +1)} title="Update count"/>
68
68
),
69
69
});
70
-
}, [navigation, setCount]);
70
+
}, [navigation]);
71
71
72
72
return<Text>Count: {count}</Text>;
73
73
}
@@ -79,15 +79,16 @@ function HomeScreen({ navigation }) {
79
79
80
80
You can change the label behavior with `headerBackTitle` and `headerTruncatedBackTitle` ([read more](stack-navigator.md#headerbacktitle)).
81
81
82
-
To customize the back button image, you can use [headerBackImage](/docs/stack-navigator/#headerbackimage).
82
+
To customize the back button image, you can use [headerBackImage](stack-navigator.md#headerbackimage).
83
83
84
84
## Overriding the back button
85
85
86
86
The back button will be rendered automatically in a stack navigator whenever it is possible for the user to go back from their current screen — in other words, the back button will be rendered whenever there is more than one screen in the stack.
87
87
88
-
Generally, this is what you want. But it's possible that in some circumstances that you want to customize the back button more than you can through the options mentioned above, in which case you can set the `headerLeft` option to a React Element that will be rendered, just as we did with `headerRight`. Alternatively, the `headerLeft` option also accepts a React Component, which can be used, for example, for overriding the onPress behavior of the back button. Read more about this in the [api reference](/docs/stack-navigator/#headerleft).
88
+
Generally, this is what you want. But it's possible that in some circumstances that you want to customize the back button more than you can through the options mentioned above, in which case you can set the `headerLeft` option to a React Element that will be rendered, just as we did with `headerRight`. Alternatively, the `headerLeft` option also accepts a React Component, which can be used, for example, for overriding the onPress behavior of the back button. Read more about this in the [api reference](stack-navigator.md#headerleft).
89
89
90
90
## Summary
91
91
92
92
- You can set buttons in the header through the `headerLeft` and `headerRight` properties in `options`.
93
93
- The back button is fully customizable with `headerLeft`, but if you just want to change the title or image, there are other `options` for that —`headerBackTitle`, `headerTruncatedBackTitle`, and `headerBackImage`.
94
+
- You can use a callback for the options prop to access `navigation` and `route` objects.
Copy file name to clipboardExpand all lines: versioned_docs/version-5.x/screen-options-resolution.md
+2-2Lines changed: 2 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,7 +1,7 @@
1
1
---
2
2
id: screen-options-resolution
3
-
title: Screen options resolution
4
-
sidebar_label: Screen options resolution
3
+
title: Screen options with nested navigators
4
+
sidebar_label: Screen options with nested navigators
5
5
---
6
6
7
7
In this document we'll explain how [screen options](screen-options.md) work when there are multiple navigators. It's important to understand this so that you put your `options` in the correct place and can properly configure your navigators. If you put them in the wrong place, at best nothing will happen and at worst something confusing and unexpected will happen.
Copy file name to clipboardExpand all lines: versioned_docs/version-5.x/server-rendering.md
+2-1Lines changed: 2 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -199,9 +199,10 @@ ctx.status = status.code;
199
199
200
200
After we render the app with`ReactDOMServer.renderToString`, the `code` property of the `status` object will be updated to be `404`if the `NotFound`screen was rendered.
201
201
202
-
You can follow a similar approach for other status codes too.
202
+
You can follow a similar approach for other status codes too, for example, `401`for unauthorized etc.
203
203
204
204
## Summary
205
205
206
206
- Use the `location` prop on `ServerContainer` to render correct screens based on the incoming request.
207
207
- Attach a `ref` to the `ServerContainer` get options for the current screen.
208
+
- Use context to attach more information such as status code.
Copy file name to clipboardExpand all lines: versioned_docs/version-5.x/stack-navigator.md
+25-2Lines changed: 25 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -202,6 +202,29 @@ Function which returns a React Element to display on the right side of the heade
202
202
203
203
Function which returns a React Element to display on the left side of the header. When a function is used, it receives a number of arguments when rendered (`onPress`, `label`, `labelStyle` and more - check [types.tsx](https://github.com/react-navigation/react-navigation/blob/master/packages/stack/src/types.tsx#L344-L408) for the complete list).
204
204
205
+
By default, `HeaderBackButton` component is used. You can implement it and use it to override the back button press, for example:
0 commit comments