fix: add mic to service field, refresh list on screen focus
Release APK / build (push) Has been cancelled
Release APK / build (push) Has been cancelled
new.tsx: service field was missing its mic button — VoiceField type excluded "service" and the label used a plain Text instead of labelRow(). index.tsx: incident list only loaded on mount; router.back() does not remount the screen so new incidents never appeared. useFocusEffect replaces the one-shot useEffect so the list reloads on every focus. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
+7
-5
@@ -1,4 +1,4 @@
|
||||
import { useEffect, useRef, useState } from "react";
|
||||
import { useCallback, useEffect, useRef, useState } from "react";
|
||||
import {
|
||||
View,
|
||||
Text,
|
||||
@@ -6,7 +6,7 @@ import {
|
||||
Pressable,
|
||||
ActivityIndicator,
|
||||
} from "react-native";
|
||||
import { router } from "expo-router";
|
||||
import { router, useFocusEffect } from "expo-router";
|
||||
import { getIncidents } from "@/lib/db";
|
||||
import { useSettings } from "@/hooks/useSettings";
|
||||
import type { Incident } from "@/types/incident";
|
||||
@@ -26,9 +26,11 @@ export default function HomeScreen() {
|
||||
}
|
||||
}, [ready, settings.homeView]);
|
||||
|
||||
useEffect(() => {
|
||||
loadIncidents();
|
||||
}, []);
|
||||
useFocusEffect(
|
||||
useCallback(() => {
|
||||
loadIncidents();
|
||||
}, [])
|
||||
);
|
||||
|
||||
async function loadIncidents() {
|
||||
setLoading(true);
|
||||
|
||||
+2
-2
@@ -46,7 +46,7 @@ const LABEL_STYLE = {
|
||||
letterSpacing: 0.5,
|
||||
} as const;
|
||||
|
||||
type VoiceField = "title" | "symptom" | "rootCause" | "fix";
|
||||
type VoiceField = "title" | "service" | "symptom" | "rootCause" | "fix";
|
||||
|
||||
export default function NewIncidentScreen() {
|
||||
const { editId } = useLocalSearchParams<{ editId?: string }>();
|
||||
@@ -224,7 +224,7 @@ export default function NewIncidentScreen() {
|
||||
returnKeyType="next"
|
||||
/>
|
||||
|
||||
<Text style={[LABEL_STYLE, { marginBottom: 6 }]}>Service</Text>
|
||||
{labelRow("Service", "service")}
|
||||
<TextInput
|
||||
style={FIELD_STYLE}
|
||||
value={form.service}
|
||||
|
||||
Reference in New Issue
Block a user