feat: edit expense

This commit is contained in:
Jakob Stornig 2024-01-05 15:26:09 +01:00
parent deda54152b
commit 5b71fa74b1
11 changed files with 273 additions and 41 deletions

View file

@ -7,14 +7,13 @@ import { useTheme } from '../../app/contexts/ThemeContext';
interface SearchBarProps extends ViewProps {
placeholder? : string;
onChangeText? : (text: string) => void | undefined
value?: string
}
export default function TextInputBar(props: SearchBarProps) {
const [isActive, setIsactive] = React.useState(false);
const { colors } = useTheme();
const [text, setText] = useState<string>("");
const textColor = colors
const backgroundColor = colors.elementDefaultColor;
const handleChange = (text:string) : void => {
@ -30,7 +29,7 @@ export default function TextInputBar(props: SearchBarProps) {
if(props.onChangeText){
props.onChangeText(text)
}
setText(text)
}
// cant apply the background color otherwise
@ -43,7 +42,7 @@ export default function TextInputBar(props: SearchBarProps) {
// changed styles.container to containerStyle
return (
<View style={[containerStyle, props.style]}>
<TextInput placeholderTextColor={colors.secondaryText} onChangeText = {handleChange} style={[{fontSize: SIZES.normal, height: "100%", color:colors.primaryText}, styles.TextInput]} autoCorrect={false} keyboardType='default' placeholder={props.placeholder} value={text} onFocus={()=>handleChange(text)} onEndEditing={()=>setIsactive(false)}/>
<TextInput placeholderTextColor={colors.secondaryText} onChangeText = {handleChange} style={[{fontSize: SIZES.normal, height: "100%", color:colors.primaryText}, styles.TextInput]} autoCorrect={false} keyboardType='default' placeholder={props.placeholder} value={props.value} onEndEditing={()=>setIsactive(false)}/>
{isActive &&
<TouchableOpacity style={styles.cancel} onPress={()=>{handleChange("")}}>