Skip to content

Commit 02b4813

Browse files
fix(mobile): navigation layouts render as elements under the React Compiler
React Navigation calls layout and screenLayout as plain functions during its own render. With the compiler on, a component passed there allocates its memo cache inside the navigator's hooks, which crashed Android at launch with useMemoCache size mismatches. Co-Authored-By: Claude Opus 5.5 <[email protected]>
1 parent da90d36 commit 02b4813

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

‎apps/mobile/src/Stack.tsx‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -669,7 +669,9 @@ function NotFoundScreen() {
669669

670670
const RootStackConfig = createWorkspaceStackNavigator({
671671
initialRouteName: "Home",
672-
layout: RootStackLayout,
672+
// React Navigation calls layouts as plain functions inside its own render. Passing a
673+
// compiled component directly would put its memo cache among the navigator's hooks.
674+
layout: (props) => <RootStackLayout {...props} />,
673675
screenOptions: {
674676
headerShown: false,
675677
},
@@ -1012,7 +1014,7 @@ export const RootStack = RootStackConfig.with(function AdaptiveRootStack({ Navig
10121014

10131015
return (
10141016
<Navigator
1015-
screenLayout={GuardedScreenLayout}
1017+
screenLayout={(props) => <GuardedScreenLayout {...props} />}
10161018
screenOptions={({ route }) => {
10171019
if (route.name !== "SettingsSheet" && route.name !== "NewTaskSheet") {
10181020
return {};

0 commit comments

Comments
 (0)