apply custom text input & swtitch elements everywhere

This commit is contained in:
Stef-00012 2025-02-04 22:19:31 +01:00
parent 05e90f36e3
commit d147dbb707
No known key found for this signature in database
GPG key ID: 28BE9A9E4EF0E6BF
21 changed files with 803 additions and 1506 deletions

44
components/Switch.tsx Normal file
View file

@ -0,0 +1,44 @@
import { styles } from "@/styles/components/switch";
import { Switch as NativeSwitch } from "@react-native-material/core";
import { useState } from "react";
import { Text } from "react-native";
import { View } from "react-native";
interface Props {
value: boolean;
title?: string;
onValueChange: () => void | Promise<void>;
disabled?: boolean;
}
export default function Switch({
value,
title,
onValueChange,
disabled = false
}: Props) {
return (
<View style={styles.switchContainer}>
<NativeSwitch
disabled={disabled}
value={value}
onValueChange={onValueChange}
thumbColor={value ? "#2e3e6b" : "#222c47"}
trackColor={{
true: "#21273b",
false: "#181c28",
}}
/>
{title && (
<Text
style={{
...styles.switchText,
...(disabled && styles.switchTextDisabled)
}}
>
{title}
</Text>
)}
</View>
)
}