frontend: use toast instead of the ugly alert component
Parents:
a13a1c01 file(s) changed
- frontend/app/(tabs)/settings.tsx +3 -5
frontend/app/(tabs)/settings.tsx
1 1
import {
2 2
TouchableOpacity,
3 3
StyleSheet,
4 4
Text,
5 5
SectionList,
▸ 12 unchanged lines
18 18
import { Section, SectionHeader } from "@/components/ui/Sections";
19 19
import { Ionicons, MaterialIcons } from "@expo/vector-icons";
20 20
import { Button } from "@/components/ui/Button";
21 21
import { TimePicker } from "@/components/ui/TimePicker";
22 22
import { usePatchUserMe } from "@/hooks/useUserPreferences.queries";
23 +
import { useToast } from '@/context/ToastContext';
23 24
24 25
export default function Settings() {
25 26
const { user, logout, updateAuthUser } = useAuth();
26 27
const [allowWeeklyInsights, setAllowWeeklyInsights] = useState(false);
28 +
const { showToast } = useToast();
27 29
28 30
const notificationsEnabled = user?.notificationsEnabled ?? true;
29 31
const dailyReminderTime = user?.dailyReminderTime ?? "20:00";
30 32
31 33
const patchUserMe = usePatchUserMe((updatedUser) => {
▸ 33 unchanged lines
65 67
{ text: "Cancelar", style: "cancel" },
66 68
{
67 69
text: "Exportar",
68 70
style: "destructive",
69 71
onPress: () => {
70 -
Alert.alert(
71 -
"Exportar dados",
72 -
"Você receberá um e-mail com os dados exportados.",
73 -
[{ text: "OK", style: "default" }],
74 -
);
72 +
showToast("Você receberá um e-mail com os dados exportados", "success")
75 73
},
76 74
},
77 75
]);
78 76
};
79 77
▸ 281 unchanged lines
361 359
height: StyleSheet.hairlineWidth,
362 360
backgroundColor: "#D1D5DB",
363 361
marginVertical: 16,
364 362
},
365 363
});