Skip to content

Commit

Permalink
Add warning about accessing route.params.screen
Browse files Browse the repository at this point in the history
  • Loading branch information
satya164 committed Dec 11, 2024
1 parent fdbf5d6 commit db23292
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
6 changes: 6 additions & 0 deletions versioned_docs/version-6.x/nesting-navigators.md
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,12 @@ navigation.navigate('Root', {

In the above case, you're navigating to the `Media` screen, which is in a navigator nested inside the `Sound` screen, which is in a navigator nested inside the `Settings` screen.

:::warning

The `screen` and related params are reserved for internal use and are managed by React Navigation. While you can access `route.params.screen` etc. in the parent screens, relying on them may lead to unexpected behavior.

:::

### Rendering initial route defined in the navigator

By default, when you navigate a screen in the nested navigator, the specified screen is used as the initial screen and the initial route prop on the navigator is ignored. This behaviour is different from the React Navigation 4.
Expand Down
6 changes: 6 additions & 0 deletions versioned_docs/version-7.x/nesting-navigators.md
Original file line number Diff line number Diff line change
Expand Up @@ -791,6 +791,12 @@ navigation.navigate('Home', {

In the above case, you're navigating to the `Media` screen, which is in a navigator nested inside the `Sound` screen, which is in a navigator nested inside the `Settings` screen.

:::warning

The `screen` and related params are reserved for internal use and are managed by React Navigation. While you can access `route.params.screen` etc. in the parent screens, relying on them may lead to unexpected behavior.

:::

### Rendering initial route defined in the navigator

By default, when you navigate a screen in the nested navigator, the specified screen is used as the initial screen and the `initialRouteName` prop on the navigator is ignored.
Expand Down

0 comments on commit db23292

Please sign in to comment.