Skip to content
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
20 changes: 20 additions & 0 deletions versioned_docs/version-7.x/group.md
Original file line number Diff line number Diff line change
Expand Up @@ -287,6 +287,26 @@ const MyStack = createNativeStackNavigator({
</TabItem>
</ConfigTabs>

:::warning

The function passed to `screenLayout` is invoked as a regular function, not rendered as a React component. This means you **cannot call React Hooks directly inside it** — doing so will fail at runtime with errors such as _"Should have a queue. You are likely calling Hooks conditionally, which is not allowed."_

If you need to use Hooks, wrap your logic in a separate component and return it as JSX:

```jsx
function MyScreenLayout(props) {
const value = useMyHook(); // ✅ Hook runs inside a real component

return <ErrorBoundary>{props.children}</ErrorBoundary>;
}

const Stack = createNativeStackNavigator({
screenLayout: (props) => <MyScreenLayout {...props} />,
});
```

:::

### Navigation key

Optional key for a group of screens. If the key changes, all existing screens in this group will be removed (if used in a stack navigator) or reset (if used in a tab or drawer navigator):
Expand Down
20 changes: 20 additions & 0 deletions versioned_docs/version-7.x/navigator.md
Original file line number Diff line number Diff line change
Expand Up @@ -310,6 +310,26 @@ function MyStack() {
</TabItem>
</ConfigTabs>

:::warning

The function passed to `screenLayout` is invoked as a regular function, not rendered as a React component. This means you **cannot call React Hooks directly inside it** — doing so will fail at runtime with errors such as _"Should have a queue. You are likely calling Hooks conditionally, which is not allowed."_

If you need to use Hooks, wrap your logic in a separate component and return it as JSX:

```jsx
function MyScreenLayout(props) {
const value = useMyHook(); // ✅ Hook runs inside a real component

return <ErrorBoundary>{props.children}</ErrorBoundary>;
}

const Stack = createNativeStackNavigator({
screenLayout: (props) => <MyScreenLayout {...props} />,
});
```

:::

### Router

:::warning
Expand Down
20 changes: 20 additions & 0 deletions versioned_docs/version-8.x/group.md
Original file line number Diff line number Diff line change
Expand Up @@ -287,6 +287,26 @@ const MyStack = createNativeStackNavigator({
</TabItem>
</ConfigTabs>

:::warning

The function passed to `screenLayout` is invoked as a regular function, not rendered as a React component. This means you **cannot call React Hooks directly inside it** — doing so will fail at runtime with errors such as _"Should have a queue. You are likely calling Hooks conditionally, which is not allowed."_

If you need to use Hooks, wrap your logic in a separate component and return it as JSX:

```jsx
function MyScreenLayout(props) {
const value = useMyHook(); // ✅ Hook runs inside a real component

return <ErrorBoundary>{props.children}</ErrorBoundary>;
}

const Stack = createNativeStackNavigator({
screenLayout: (props) => <MyScreenLayout {...props} />,
});
```

:::

### Navigation key

Optional key for a group of screens. If the key changes, all existing screens in this group will be removed (if used in a stack navigator) or reset (if used in a tab or drawer navigator):
Expand Down
20 changes: 20 additions & 0 deletions versioned_docs/version-8.x/navigator.md
Original file line number Diff line number Diff line change
Expand Up @@ -270,6 +270,26 @@ function MyStack() {
</TabItem>
</ConfigTabs>

:::warning

The function passed to `screenLayout` is invoked as a regular function, not rendered as a React component. This means you **cannot call React Hooks directly inside it** — doing so will fail at runtime with errors such as _"Should have a queue. You are likely calling Hooks conditionally, which is not allowed."_

If you need to use Hooks, wrap your logic in a separate component and return it as JSX:

```jsx
function MyScreenLayout(props) {
const value = useMyHook(); // ✅ Hook runs inside a real component

return <ErrorBoundary>{props.children}</ErrorBoundary>;
}

const Stack = createNativeStackNavigator({
screenLayout: (props) => <MyScreenLayout {...props} />,
});
```

:::

### Router

Routers can be customized with the `router` prop on navigator to override how navigation actions are handled.
Expand Down
Loading