refactor: replace settings buttons with switches and simplify provider sheet

Swap daemon management and keep-running-after-quit buttons for Switch
toggles. Remove the restart/start daemon control. Simplify the provider
diagnostic sheet to reuse shared settings styles and SettingsSection.
Drop the unused "sm" size variant from the Switch component. Remove
trailing periods from hint text for consistency.
This commit is contained in:
Mohamed Boudra
2026-04-26 08:15:28 +07:00
parent 521944f19b
commit 5b47b6594f
7 changed files with 204 additions and 481 deletions
+4 -9
View File
@@ -14,22 +14,17 @@ import Animated, {
} from "react-native-reanimated";
import { StyleSheet, useUnistyles } from "react-native-unistyles";
type SwitchSize = "sm" | "md";
interface SwitchProps {
value: boolean;
onValueChange?: (value: boolean) => void;
disabled?: boolean;
size?: SwitchSize;
accessibilityLabel?: string;
testID?: string;
style?: StyleProp<ViewStyle>;
}
const SIZES: Record<SwitchSize, { track: { width: number; height: number }; thumb: number }> = {
md: { track: { width: 44, height: 26 }, thumb: 22 },
sm: { track: { width: 34, height: 20 }, thumb: 16 },
};
const TRACK = { width: 34, height: 20 };
const THUMB = 16;
const TIMING = { duration: 180, easing: Easing.inOut(Easing.ease) };
@@ -37,13 +32,13 @@ export function Switch({
value,
onValueChange,
disabled = false,
size = "md",
accessibilityLabel,
testID,
style,
}: SwitchProps) {
const { theme } = useUnistyles();
const { track, thumb } = SIZES[size];
const track = TRACK;
const thumb = THUMB;
const padding = (track.height - thumb) / 2;
const thumbTravel = track.width - thumb - padding * 2;