Files
petfeed/mobile/app/(app)/_layout.tsx
T
adminandClaude Opus 5.5 78e16c9210 feat(mobile): Empfehlungsprogramm in der App
- Bildschirm "Freunde einladen" (/invite, aus den Einstellungen erreichbar):
  eigener Code mit nativem Teilen-Dialog, Rangleiter mit Fortschritt,
  eingeladene Tiere, nachträgliche Code-Eingabe im Einlösefenster
- Onboarding-Schritt "Wie hast du von PawFeed erfahren?" mit Code-Eingabe,
  einmal pro Owner (referrals.onboardingState)
- Rang-Abzeichen in PetIdentityBadges (Feed und Profil), Profilring in
  Rangfarbe, "Eingeladen von …" im Tierprofil
- Benachrichtigungen REFERRAL_JOINED / REFERRAL_RANK_UP
- Keine neuen nativen Module (React Native Share) — per OTA auslieferbar

Typecheck grün; nicht auf einem Gerät getestet.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-01 06:30:11 +02:00

93 lines
4.1 KiB
TypeScript

import { Pressable } from "react-native";
import { Stack, useRouter } from "expo-router";
import { X } from "lucide-react-native";
import { useTranslation } from "react-i18next";
import { useTheme } from "../../src/context/ThemeContext";
import { fontFamily } from "../../src/theme/tokens";
function CloseModalButton() {
const router = useRouter();
const { colors } = useTheme();
return (
<Pressable onPress={() => router.back()} hitSlop={12} style={{ marginLeft: 8 }}>
<X color={colors.ink} size={22} />
</Pressable>
);
}
export default function AppLayout() {
const { t } = useTranslation();
const { colors } = useTheme();
// Plain prop objects, not StyleSheet.create — safe to recompute on every
// render, unlike the module-level StyleSheet.create calls most other
// screens still use (see theme/tokens.ts's top comment for why those
// can't react to a theme change without being converted individually).
const headerOptions = {
headerShown: true,
headerStyle: { backgroundColor: colors.pureWhite },
headerTitleStyle: { fontFamily: fontFamily.bold, color: colors.ink },
// Without this, the native-stack's default back button/chevron keeps its
// platform default tint (effectively invisible against a dark header —
// found.md: "kein Zurückbutton" on the health screen wasn't a missing
// button, it was a black-on-black one).
headerTintColor: colors.ink,
// iOS labels the back button with the previous screen's title — here the
// untitled `(tabs)` group, so it literally read "< (tabs)". Chevron only.
headerBackButtonDisplayMode: "minimal",
} as const;
return (
<Stack screenOptions={{ headerShown: false }}>
<Stack.Screen name="(tabs)" />
<Stack.Screen name="messages/index" options={{ ...headerOptions, title: t("screens.messages") }} />
<Stack.Screen name="pets/[petId]/index" options={{ ...headerOptions, title: t("screens.profile") }} />
<Stack.Screen name="pets/[petId]/edit" options={{ ...headerOptions, title: t("screens.editProfile") }} />
<Stack.Screen name="pets/[petId]/followers" options={{ ...headerOptions, title: t("screens.followers") }} />
<Stack.Screen name="pets/[petId]/following" options={{ ...headerOptions, title: t("screens.following") }} />
<Stack.Screen name="pets/[petId]/health/index" options={{ ...headerOptions, title: t("screens.health") }} />
<Stack.Screen name="pets/[petId]/milestones" options={{ ...headerOptions, title: t("screens.milestones") }} />
<Stack.Screen name="posts/[postId]/comments" options={{ ...headerOptions, title: t("screens.comments") }} />
<Stack.Screen name="messages/[conversationId]" options={{ ...headerOptions, title: t("screens.conversation") }} />
<Stack.Screen name="search" options={{ ...headerOptions, title: t("screens.search") }} />
<Stack.Screen name="settings" options={{ ...headerOptions, title: t("screens.settings") }} />
<Stack.Screen name="invite" options={{ ...headerOptions, title: t("screens.invite") }} />
<Stack.Screen name="delete-account" options={{ ...headerOptions, title: t("screens.deleteAccount") }} />
<Stack.Screen
name="post-new"
options={{
...headerOptions,
title: t("screens.newPost"),
presentation: "modal",
headerLeft: () => <CloseModalButton />,
}}
/>
<Stack.Screen
name="story-new"
options={{
...headerOptions,
title: t("screens.newStory"),
presentation: "modal",
headerLeft: () => <CloseModalButton />,
}}
/>
<Stack.Screen
name="milestone-new"
options={{
...headerOptions,
title: t("screens.newMilestone"),
presentation: "modal",
headerLeft: () => <CloseModalButton />,
}}
/>
<Stack.Screen
name="image-viewer"
options={{ headerShown: false, presentation: "fullScreenModal", animation: "fade" }}
/>
<Stack.Screen
name="story-viewer"
options={{ headerShown: false, presentation: "fullScreenModal", animation: "fade" }}
/>
</Stack>
);
}