trails/apps/mobile/app/_layout.tsx
Ullrich Schäfer 42a9c29c84
Set up Sentry crash reporting for mobile app
- Initialize @sentry/react-native with dedicated mobile project DSN
- Wrap root layout with Sentry.wrap() for unhandled error capture
- Configure Sentry plugin with org (trails-qq) and project (mobile)
  for source map uploads during EAS builds
- Disabled in dev, full tracing in production

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-13 02:07:44 +02:00

28 lines
680 B
TypeScript

import { useEffect, useState } from "react";
import { Stack, router } from "expo-router";
import { Sentry, initSentry } from "../lib/sentry";
import { isAuthenticated } from "../lib/auth";
import { startVersionCheck } from "../lib/version-check";
initSentry();
function RootLayout() {
const [checked, setChecked] = useState(false);
useEffect(() => {
isAuthenticated().then((authed) => {
if (!authed) {
router.replace("/login");
} else {
startVersionCheck();
}
setChecked(true);
});
}, []);
if (!checked) return null;
return <Stack screenOptions={{ headerShown: false }} />;
}
export default Sentry.wrap(RootLayout);