2 Commits

Author SHA1 Message Date
billisdead f1a4b58234 refactor: remove crash reporter from _layout.tsx
Release APK / build (push) Has been cancelled
CrashBoundary and ErrorUtils debug handler were temporary scaffolding
to identify the launch crash (react version mismatch). Removing now
that the root cause is fixed.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-22 18:50:15 +02:00
billisdead dca76ea394 fix: add npm overrides to align react + react-dom to 19.2.3
Release APK / build (push) Has been cancelled
react-dom@19.2.7 has a hard peer dep on react@^19.2.7, breaking
npm ci when react is pinned to 19.2.3. npm overrides force both
packages to 19.2.3 so the lock file resolves cleanly.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-22 18:20:49 +02:00
3 changed files with 27 additions and 82 deletions
+19 -78
View File
@@ -1,55 +1,13 @@
import { useEffect, useState, Component } from "react"; import { useEffect } from "react";
import type { ReactNode } from "react";
import { Stack, router } from "expo-router"; import { Stack, router } from "expo-router";
import { StatusBar } from "expo-status-bar"; import { StatusBar } from "expo-status-bar";
import { GestureHandlerRootView } from "react-native-gesture-handler"; import { GestureHandlerRootView } from "react-native-gesture-handler";
import { View, Text, ScrollView } from "react-native";
import "../global.css"; import "../global.css";
import { Colors } from "@/constants/theme"; import { Colors } from "@/constants/theme";
import { useSettings } from "@/hooks/useSettings"; import { useSettings } from "@/hooks/useSettings";
// Catch JS errors in release mode and show them on-screen instead of
// silently crashing to desktop. Remove once the crash is identified.
class CrashBoundary extends Component<
{ children: ReactNode },
{ error: Error | null }
> {
state = { error: null };
static getDerivedStateFromError(e: Error) {
return { error: e };
}
render() {
const { error } = this.state;
if (error) {
return (
<View style={{ flex: 1, backgroundColor: "#0f1117", padding: 20, paddingTop: 60 }}>
<Text style={{ color: "#ef4444", fontSize: 16, fontWeight: "700", marginBottom: 12 }}>
CRASH copie ce texte
</Text>
<ScrollView>
<Text style={{ color: "#fff", fontSize: 11, fontFamily: "monospace" }}>
{String(error)}{"\n\n"}{(error as any).stack}
</Text>
</ScrollView>
</View>
);
}
return this.props.children;
}
}
export default function RootLayout() { export default function RootLayout() {
const { settings, ready } = useSettings(); const { settings, ready } = useSettings();
const [jsError, setJsError] = useState<string | null>(null);
useEffect(() => {
const prev = (ErrorUtils as any).getGlobalHandler();
(ErrorUtils as any).setGlobalHandler((e: Error, isFatal: boolean) => {
if (isFatal) setJsError(`${String(e)}\n\n${(e as any).stack ?? ""}`);
prev?.(e, isFatal);
});
return () => (ErrorUtils as any).setGlobalHandler(prev);
}, []);
useEffect(() => { useEffect(() => {
if (!ready) return; if (!ready) return;
@@ -58,41 +16,24 @@ export default function RootLayout() {
} }
}, [ready, settings.onboardingDone]); }, [ready, settings.onboardingDone]);
if (jsError) {
return (
<View style={{ flex: 1, backgroundColor: "#0f1117", padding: 20, paddingTop: 60 }}>
<Text style={{ color: "#ef4444", fontSize: 16, fontWeight: "700", marginBottom: 12 }}>
FATAL JS ERROR copie ce texte
</Text>
<ScrollView>
<Text style={{ color: "#fff", fontSize: 11, fontFamily: "monospace" }}>
{jsError}
</Text>
</ScrollView>
</View>
);
}
return ( return (
<CrashBoundary> <GestureHandlerRootView style={{ flex: 1, backgroundColor: Colors.bg }}>
<GestureHandlerRootView style={{ flex: 1, backgroundColor: Colors.bg }}> <StatusBar style="light" />
<StatusBar style="light" /> <Stack
<Stack screenOptions={{
screenOptions={{ headerStyle: { backgroundColor: Colors.surface },
headerStyle: { backgroundColor: Colors.surface }, headerTintColor: Colors.text1,
headerTintColor: Colors.text1, headerTitleStyle: { color: Colors.text1 },
headerTitleStyle: { color: Colors.text1 }, contentStyle: { backgroundColor: Colors.bg },
contentStyle: { backgroundColor: Colors.bg }, animation: "slide_from_right",
animation: "slide_from_right", }}
}} >
> <Stack.Screen name="index" options={{ title: "SheetHappens" }} />
<Stack.Screen name="index" options={{ title: "SheetHappens" }} /> <Stack.Screen name="new" options={{ title: "New Incident", presentation: "modal" }} />
<Stack.Screen name="new" options={{ title: "New Incident", presentation: "modal" }} /> <Stack.Screen name="incident/[id]" options={{ title: "Incident" }} />
<Stack.Screen name="incident/[id]" options={{ title: "Incident" }} /> <Stack.Screen name="settings" options={{ title: "Settings" }} />
<Stack.Screen name="settings" options={{ title: "Settings" }} /> <Stack.Screen name="onboarding" options={{ headerShown: false }} />
<Stack.Screen name="onboarding" options={{ headerShown: false }} /> </Stack>
</Stack> </GestureHandlerRootView>
</GestureHandlerRootView>
</CrashBoundary>
); );
} }
+4 -4
View File
@@ -6748,16 +6748,16 @@
} }
}, },
"node_modules/react-dom": { "node_modules/react-dom": {
"version": "19.2.7", "version": "19.2.3",
"resolved": "https://registry.npmjs.org/react-dom/-/react-dom-19.2.7.tgz", "resolved": "https://registry.npmjs.org/react-dom/-/react-dom-19.2.3.tgz",
"integrity": "sha512-t0BRVXvbiE/o20Hfw669rLbMCDWtYZLvmJigy2f0MxsXF+71pxhR3xOkspmsO8h3ZlNzyibAmtCa3l4lYKk6gQ==", "integrity": "sha512-yELu4WmLPw5Mr/lmeEpox5rw3RETacE++JgHqQzd2dg+YbJuat3jH4ingc+WPZhxaoFzdv9y33G+F7Nl5O0GBg==",
"license": "MIT", "license": "MIT",
"peer": true, "peer": true,
"dependencies": { "dependencies": {
"scheduler": "^0.27.0" "scheduler": "^0.27.0"
}, },
"peerDependencies": { "peerDependencies": {
"react": "^19.2.7" "react": "^19.2.3"
} }
}, },
"node_modules/react-fast-compare": { "node_modules/react-fast-compare": {
+4
View File
@@ -27,6 +27,10 @@
"react-native-screens": "~4.25.2", "react-native-screens": "~4.25.2",
"tailwindcss": "~3.4.19" "tailwindcss": "~3.4.19"
}, },
"overrides": {
"react": "19.2.3",
"react-dom": "19.2.3"
},
"devDependencies": { "devDependencies": {
"@babel/core": "^7.25.0", "@babel/core": "^7.25.0",
"@expo/metro-config": "~56.0.14", "@expo/metro-config": "~56.0.14",