Resolve "Implement and Split edit Category from add Category"

This commit is contained in:
Thomas Schleicher 2024-01-05 16:45:25 +00:00 committed by jastornig
parent bf939fb807
commit d3b7c61c67
8 changed files with 146 additions and 21 deletions

View file

@ -16,12 +16,12 @@ const CategoryItem = (properties: CategoryItemProps) => {
const { colors } = useTheme();
const subText = `${properties.total_expenses} / ${properties.allocated_amount}`;
const subText = `${properties.total_expenses.toFixed(2)} / ${properties.allocated_amount}`;
return (
<TouchableOpacity onPress={properties.onPress}>
<CustomCard style={styles.customCardStyle}>
<View style={[styles.colorTipStyle, {backgroundColor: "blue"}]}/>
<View style={[styles.colorTipStyle, {backgroundColor: properties.color}]}/>
<View style={[styles.textViewStyle]}>
<Text style={[styles.categoryNameStyle, {color: colors.primaryText}]}>
{properties.category}

View file

@ -2,14 +2,14 @@ import { StyleSheet } from "react-native";
import ColorPicker, { BrightnessSlider, HueSlider, Preview, SaturationSlider, } from "reanimated-color-picker";
export type CustomColorPickerProperties = {
currentColor?: string | null,
color: string,
handleColorChange: (color: string) => void | undefined,
}
const CustomColorPicker = (properties: CustomColorPickerProperties) => {
return (
<ColorPicker
value={properties.currentColor ?? generateRandomColor()}
value={properties.color}
onChange={(color) => {
properties.handleColorChange(color["hex"])
}}
@ -30,10 +30,6 @@ const CustomColorPicker = (properties: CustomColorPickerProperties) => {
);
}
const generateRandomColor = (): string => {
return '#' + Math.floor(Math.random()*16777215).toString(16);
}
export default CustomColorPicker;
const styles = StyleSheet.create({