Skip to content

Commit c4a40e5

Browse files
committed
Add a warning about getId with native stack
1 parent ae75bde commit c4a40e5

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

versioned_docs/version-7.x/screen.md

+7-1
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,7 @@ This can be done by specifying the `getId` callback. It receives an object with
218218
<TabItem value="static" label="Static" default>
219219

220220
```js
221-
const Stack = createNativeStackNavigator({
221+
const Stack = createStackNavigator({
222222
screens: {
223223
Profile: {
224224
screen: ProfileScreen,
@@ -255,6 +255,12 @@ Let's say you have a stack with the history `Home > Profile (userId: bob) > Sett
255255

256256
If `getId` is specified in a tab or drawer navigator, the screen will remount if the ID changes.
257257

258+
:::warning
259+
260+
If you're using [`@react-navigation/native-stack`](native-stack-navigator.md), it doesn't work correctly with the `getId` callback. So it's recommended to avoid using it in that case.
261+
262+
:::
263+
258264
### Component
259265

260266
Each screen must specify a component to render for that route.

0 commit comments

Comments
 (0)