fix(mobile): onboarding steps unreadable in dark mode

ArachnophobiaOptIn, UploadConsent, OnboardingGuidelines and AvatarStep
still used the static light-palette tokens in module-level
StyleSheet.create, so titles and checkbox labels rendered dark-on-dark.
Switched them to useTheme() + makeStyles(colors) like the other screens.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
adminandClaude Opus 5.5 committed 2026-09-26 09:07:49 +02:00
1 parent 69e095ddcb
commit 0c3ab5c2a2
4 files changed
+145 -119

No files matched your search

@@ -1,11 +1,12 @@
import { useState } from "react";
import { useMemo, useState } from "react";
import { View, Text, Pressable, StyleSheet } from "react-native";
import { useTranslation } from "react-i18next";
import { useMutation } from "@tanstack/react-query";
import { Bug, Check } from "lucide-react-native";
import { useTRPC } from "../../api/trpc";
import { Button } from "../Button";
import { colors, radii, typography } from "../../theme/tokens";
import { radii, getTypography, type ColorTokens, type Typography } from "../../theme/tokens";
import { useTheme } from "../../context/ThemeContext";
type Props = { onContinue: () => void };
@@ -16,6 +17,8 @@ type Props = { onContinue: () => void };
*/
export function ArachnophobiaOptIn({ onContinue }: Props) {
const { t } = useTranslation();
const { colors } = useTheme();
const styles = useMemo(() => makeStyles(colors), [colors]);
const trpc = useTRPC();
const [hideSpiders, setHideSpiders] = useState(false);
@@ -53,32 +56,35 @@ export function ArachnophobiaOptIn({ onContinue }: Props) {
);
}
const styles = StyleSheet.create({
container: { padding: 24, gap: 4 },
titleRow: { flexDirection: "row", alignItems: "center", gap: 8, marginBottom: 4 },
title: { ...typography.title, fontSize: 18 },
subtitle: { ...typography.body, color: colors.quietGray, marginBottom: 16 },
checkboxRow: {
flexDirection: "row",
gap: 12,
padding: 14,
borderRadius: radii.xl,
borderWidth: 1,
borderColor: colors.hairlineGray,
marginBottom: 16,
},
checkbox: {
width: 20,
height: 20,
borderRadius: 5,
borderWidth: 1.5,
borderColor: colors.hairlineGray,
alignItems: "center",
justifyContent: "center",
marginTop: 2,
},
checkboxChecked: { backgroundColor: colors.marigoldOrange, borderColor: colors.marigoldOrange },
checkboxLabel: { ...typography.body, flex: 1, fontSize: 13, lineHeight: 19 },
hint: { ...typography.label, textTransform: "none", letterSpacing: 0, marginBottom: 16 },
cta: { marginTop: 4 },
});
function makeStyles(colors: ColorTokens) {
const typography: Typography = getTypography(colors);
return StyleSheet.create({
container: { padding: 24, gap: 4 },
titleRow: { flexDirection: "row", alignItems: "center", gap: 8, marginBottom: 4 },
title: { ...typography.title, fontSize: 18 },
subtitle: { ...typography.body, color: colors.quietGray, marginBottom: 16 },
checkboxRow: {
flexDirection: "row",
gap: 12,
padding: 14,
borderRadius: radii.xl,
borderWidth: 1,
borderColor: colors.hairlineGray,
marginBottom: 16,
},
checkbox: {
width: 20,
height: 20,
borderRadius: 5,
borderWidth: 1.5,
borderColor: colors.hairlineGray,
alignItems: "center",
justifyContent: "center",
marginTop: 2,
},
checkboxChecked: { backgroundColor: colors.marigoldOrange, borderColor: colors.marigoldOrange },
checkboxLabel: { ...typography.body, flex: 1, fontSize: 13, lineHeight: 19 },
hint: { ...typography.label, textTransform: "none", letterSpacing: 0, marginBottom: 16 },
cta: { marginTop: 4 },
});
}
+41 -35
View File
@@ -1,4 +1,4 @@
import { useCallback, useState } from "react";
import { useCallback, useMemo, useState } from "react";
import { View, Text, Image as RNImage, Pressable, ActivityIndicator, StyleSheet, Alert } from "react-native";
import * as ImagePicker from "expo-image-picker";
import { useTranslation } from "react-i18next";
@@ -9,7 +9,8 @@ import { uploadImageToSupabase } from "../../lib/upload";
import { resizeForUpload } from "../../lib/resize-image";
import { PetAvatar } from "../PetAvatar";
import { Button } from "../Button";
import { colors, radii, typography } from "../../theme/tokens";
import { radii, getTypography, type ColorTokens, type Typography } from "../../theme/tokens";
import { useTheme } from "../../context/ThemeContext";
type Props = {
petId: string;
@@ -26,6 +27,8 @@ type Props = {
*/
export function AvatarStep({ petId, petName, onDone }: Props) {
const { t } = useTranslation();
const { colors } = useTheme();
const styles = useMemo(() => makeStyles(colors), [colors]);
const trpc = useTRPC();
const [asset, setAsset] = useState<ImagePicker.ImagePickerAsset | null>(null);
const [uploadedKey, setUploadedKey] = useState<string | null>(null);
@@ -120,36 +123,39 @@ export function AvatarStep({ petId, petName, onDone }: Props) {
);
}
const styles = StyleSheet.create({
container: { padding: 24, gap: 4, alignItems: "center" },
title: { ...typography.title, fontSize: 18, textAlign: "center" },
subtitle: { ...typography.body, color: colors.quietGray, textAlign: "center", marginBottom: 20 },
previewWrap: { width: 96, height: 96, borderRadius: 48, overflow: "hidden", backgroundColor: colors.hairlineGray },
preview: { width: "100%", height: "100%" },
previewOverlay: {
position: "absolute",
top: 0,
left: 0,
right: 0,
bottom: 0,
backgroundColor: "rgba(0,0,0,0.4)",
alignItems: "center",
justifyContent: "center",
},
error: { ...typography.body, color: colors.alertRed, marginTop: 12, textAlign: "center" },
pickerRow: { flexDirection: "row", gap: 12, marginTop: 20, alignSelf: "stretch" },
pickerButton: {
flex: 1,
flexDirection: "row",
alignItems: "center",
justifyContent: "center",
gap: 8,
height: 48,
borderRadius: radii.lg,
borderWidth: 1,
borderColor: colors.hairlineGray,
},
pickerText: { ...typography.body, color: colors.ink },
cta: { marginTop: 20, alignSelf: "stretch" },
skipLink: { ...typography.label, textTransform: "none", letterSpacing: 0, color: colors.quietGray, marginTop: 12 },
});
function makeStyles(colors: ColorTokens) {
const typography: Typography = getTypography(colors);
return StyleSheet.create({
container: { padding: 24, gap: 4, alignItems: "center" },
title: { ...typography.title, fontSize: 18, textAlign: "center" },
subtitle: { ...typography.body, color: colors.quietGray, textAlign: "center", marginBottom: 20 },
previewWrap: { width: 96, height: 96, borderRadius: 48, overflow: "hidden", backgroundColor: colors.hairlineGray },
preview: { width: "100%", height: "100%" },
previewOverlay: {
position: "absolute",
top: 0,
left: 0,
right: 0,
bottom: 0,
backgroundColor: "rgba(0,0,0,0.4)",
alignItems: "center",
justifyContent: "center",
},
error: { ...typography.body, color: colors.alertRed, marginTop: 12, textAlign: "center" },
pickerRow: { flexDirection: "row", gap: 12, marginTop: 20, alignSelf: "stretch" },
pickerButton: {
flex: 1,
flexDirection: "row",
alignItems: "center",
justifyContent: "center",
gap: 8,
height: 48,
borderRadius: radii.lg,
borderWidth: 1,
borderColor: colors.hairlineGray,
},
pickerText: { ...typography.body, color: colors.ink },
cta: { marginTop: 20, alignSelf: "stretch" },
skipLink: { ...typography.label, textTransform: "none", letterSpacing: 0, color: colors.quietGray, marginTop: 12 },
});
}
@@ -1,12 +1,13 @@
import { View, Text, Pressable, ActivityIndicator, Linking, StyleSheet } from "react-native";
import { useEffect } from "react";
import { useEffect, useMemo } from "react";
import { useTranslation } from "react-i18next";
import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query";
import { ScrollText } from "lucide-react-native";
import { useTRPC } from "../../api/trpc";
import { env } from "../../lib/env";
import { Button } from "../Button";
import { colors, radii, typography } from "../../theme/tokens";
import { radii, getTypography, type ColorTokens, type Typography } from "../../theme/tokens";
import { useTheme } from "../../context/ThemeContext";
type Props = { onContinue: () => void };
@@ -18,6 +19,8 @@ type Props = { onContinue: () => void };
*/
export function OnboardingGuidelines({ onContinue }: Props) {
const { t } = useTranslation();
const { colors } = useTheme();
const styles = useMemo(() => makeStyles(colors), [colors]);
const trpc = useTRPC();
const queryClient = useQueryClient();
@@ -80,22 +83,25 @@ export function OnboardingGuidelines({ onContinue }: Props) {
);
}
const styles = StyleSheet.create({
center: { flex: 1, alignItems: "center", justifyContent: "center", padding: 40 },
container: { padding: 24, gap: 4 },
titleRow: { flexDirection: "row", alignItems: "center", gap: 8, marginBottom: 4 },
title: { ...typography.title, fontSize: 18 },
subtitle: { ...typography.body, color: colors.quietGray, marginBottom: 16 },
card: {
gap: 10,
padding: 14,
borderRadius: radii.xl,
borderWidth: 1,
borderColor: colors.hairlineGray,
backgroundColor: colors.pureWhite,
marginBottom: 16,
},
summary: { ...typography.body },
link: { ...typography.label, textTransform: "none", letterSpacing: 0, color: colors.marigoldDeep, marginBottom: 8 },
cta: { marginTop: 12 },
});
function makeStyles(colors: ColorTokens) {
const typography: Typography = getTypography(colors);
return StyleSheet.create({
center: { flex: 1, alignItems: "center", justifyContent: "center", padding: 40 },
container: { padding: 24, gap: 4 },
titleRow: { flexDirection: "row", alignItems: "center", gap: 8, marginBottom: 4 },
title: { ...typography.title, fontSize: 18 },
subtitle: { ...typography.body, color: colors.quietGray, marginBottom: 16 },
card: {
gap: 10,
padding: 14,
borderRadius: radii.xl,
borderWidth: 1,
borderColor: colors.hairlineGray,
backgroundColor: colors.pureWhite,
marginBottom: 16,
},
summary: { ...typography.body },
link: { ...typography.label, textTransform: "none", letterSpacing: 0, color: colors.marigoldDeep, marginBottom: 8 },
cta: { marginTop: 12 },
});
}
@@ -1,4 +1,4 @@
import { useEffect, useState } from "react";
import { useEffect, useMemo, useState } from "react";
import { View, Text, Pressable, ActivityIndicator, Linking, StyleSheet } from "react-native";
import { useTranslation } from "react-i18next";
import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query";
@@ -6,7 +6,8 @@ import { ShieldCheck, Check } from "lucide-react-native";
import { useTRPC } from "../../api/trpc";
import { env } from "../../lib/env";
import { Button } from "../Button";
import { colors, radii, typography } from "../../theme/tokens";
import { radii, getTypography, type ColorTokens, type Typography } from "../../theme/tokens";
import { useTheme } from "../../context/ThemeContext";
type Props = { onContinue: () => void };
@@ -18,6 +19,8 @@ type Props = { onContinue: () => void };
*/
export function UploadConsent({ onContinue }: Props) {
const { t } = useTranslation();
const { colors } = useTheme();
const styles = useMemo(() => makeStyles(colors), [colors]);
const trpc = useTRPC();
const queryClient = useQueryClient();
const [contentRightsChecked, setContentRightsChecked] = useState(false);
@@ -85,6 +88,8 @@ export function UploadConsent({ onContinue }: Props) {
}
function ConsentCheckbox({ checked, onToggle, label }: { checked: boolean; onToggle: () => void; label: string }) {
const { colors } = useTheme();
const styles = useMemo(() => makeStyles(colors), [colors]);
return (
<Pressable style={styles.checkboxRow} onPress={onToggle}>
<View style={[styles.checkbox, checked && styles.checkboxChecked]}>
@@ -95,33 +100,36 @@ function ConsentCheckbox({ checked, onToggle, label }: { checked: boolean; onTog
);
}
const styles = StyleSheet.create({
center: { flex: 1, alignItems: "center", justifyContent: "center", padding: 40 },
container: { padding: 24, gap: 4 },
titleRow: { flexDirection: "row", alignItems: "center", gap: 8, marginBottom: 4 },
title: { ...typography.title, fontSize: 18 },
subtitle: { ...typography.body, color: colors.quietGray, marginBottom: 16 },
checkboxRow: {
flexDirection: "row",
gap: 12,
padding: 14,
borderRadius: radii.xl,
borderWidth: 1,
borderColor: colors.hairlineGray,
marginBottom: 12,
},
checkbox: {
width: 20,
height: 20,
borderRadius: 5,
borderWidth: 1.5,
borderColor: colors.hairlineGray,
alignItems: "center",
justifyContent: "center",
marginTop: 2,
},
checkboxChecked: { backgroundColor: colors.marigoldOrange, borderColor: colors.marigoldOrange },
checkboxLabel: { ...typography.body, flex: 1, fontSize: 13, lineHeight: 19 },
link: { ...typography.label, textTransform: "none", letterSpacing: 0, color: colors.marigoldDeep, marginBottom: 16, marginTop: 4 },
cta: { marginTop: 4 },
});
function makeStyles(colors: ColorTokens) {
const typography: Typography = getTypography(colors);
return StyleSheet.create({
center: { flex: 1, alignItems: "center", justifyContent: "center", padding: 40 },
container: { padding: 24, gap: 4 },
titleRow: { flexDirection: "row", alignItems: "center", gap: 8, marginBottom: 4 },
title: { ...typography.title, fontSize: 18 },
subtitle: { ...typography.body, color: colors.quietGray, marginBottom: 16 },
checkboxRow: {
flexDirection: "row",
gap: 12,
padding: 14,
borderRadius: radii.xl,
borderWidth: 1,
borderColor: colors.hairlineGray,
marginBottom: 12,
},
checkbox: {
width: 20,
height: 20,
borderRadius: 5,
borderWidth: 1.5,
borderColor: colors.hairlineGray,
alignItems: "center",
justifyContent: "center",
marginTop: 2,
},
checkboxChecked: { backgroundColor: colors.marigoldOrange, borderColor: colors.marigoldOrange },
checkboxLabel: { ...typography.body, flex: 1, fontSize: 13, lineHeight: 19 },
link: { ...typography.label, textTransform: "none", letterSpacing: 0, color: colors.marigoldDeep, marginBottom: 16, marginTop: 4 },
cta: { marginTop: 4 },
});
}