Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update configuring-links.md #1278

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions versioned_docs/version-5.x/configuring-links.md
Original file line number Diff line number Diff line change
Expand Up @@ -442,6 +442,22 @@ const state = {
};
```

The `initialRouteName` property is also valid as a top-level key, this is useful if you want to add a base screen to a top-level route

```js
const config = {
initialRouteName: 'Feed',
screens: {
Home: {
screens: {
Profile: 'users/:id',
Settings: 'settings',
},
},
},
};
```

It's not possible to pass params to the initial screen through the URL. So make sure that your initial route doesn't need any params or specify `initialParams` to pass required params.

In this case, any params in the URL are only passed to the `Profile` screen which matches the path pattern `users/:id`, and the `Feed` screen doesn't receive any params. If you want to have the same params in the `Feed` screen, you can specify a [custom `getStateFromPath` function](navigation-container.md#linkinggetstatefrompath) and copy those params.
Expand Down
16 changes: 16 additions & 0 deletions versioned_docs/version-6.x/configuring-links.md
Original file line number Diff line number Diff line change
Expand Up @@ -480,6 +480,22 @@ const state = {
};
```

The `initialRouteName` property is also valid as a top-level key, this is useful if you want to add a base screen to a top-level route

```js
const config = {
initialRouteName: 'Feed',
screens: {
Home: {
screens: {
Profile: 'users/:id',
Settings: 'settings',
},
},
},
};
```

It's not possible to pass params to the initial screen through the URL. So make sure that your initial route doesn't need any params or specify `initialParams` to pass required params.

In this case, any params in the URL are only passed to the `Profile` screen which matches the path pattern `users/:id`, and the `Feed` screen doesn't receive any params. If you want to have the same params in the `Feed` screen, you can specify a [custom `getStateFromPath` function](navigation-container.md#linkinggetstatefrompath) and copy those params.
Expand Down
16 changes: 16 additions & 0 deletions versioned_docs/version-7.x/configuring-links.md
Original file line number Diff line number Diff line change
Expand Up @@ -480,6 +480,22 @@ const state = {
};
```

The `initialRouteName` property is also valid as a top-level key, this is useful if you want to add a base screen to a top-level route

```js
const config = {
initialRouteName: 'Feed',
screens: {
Home: {
screens: {
Profile: 'users/:id',
Settings: 'settings',
},
},
},
};
```

It's not possible to pass params to the initial screen through the URL. So make sure that your initial route doesn't need any params or specify `initialParams` to pass required params.

In this case, any params in the URL are only passed to the `Profile` screen which matches the path pattern `users/:id`, and the `Feed` screen doesn't receive any params. If you want to have the same params in the `Feed` screen, you can specify a [custom `getStateFromPath` function](navigation-container.md#linkinggetstatefrompath) and copy those params.
Expand Down