mirror of
https://github.com/Stef-00012/Zipline-Android-App.git
synced 2025-05-11 18:35:58 +02:00
apply custom text input & swtitch elements everywhere
This commit is contained in:
parent
05e90f36e3
commit
d147dbb707
21 changed files with 803 additions and 1506 deletions
44
components/Switch.tsx
Normal file
44
components/Switch.tsx
Normal 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>
|
||||
)
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue