diff --git a/components/inputForm.tsx b/components/inputForm.tsx index b09c980..c0bc45b 100644 --- a/components/inputForm.tsx +++ b/components/inputForm.tsx @@ -30,6 +30,10 @@ export function InputForm({ label, value, placeholder, onChange, info, disable, const { colors } = useTheme(); if (itemLeft != undefined || itemRight != undefined) { + const hasBothItems = itemLeft != undefined && itemRight != undefined; + const baseInputWidth = width ? lebar * width / 100 : lebar * 0.78; + // When both icons present, shrink TextInput by right icon size to keep container width stable + const textInputWidth = hasBothItems ? baseInputWidth - 30 : baseInputWidth; return ( { @@ -42,7 +46,7 @@ export function InputForm({ label, value, placeholder, onChange, info, disable, } - {itemRight != undefined ? itemRight : itemLeft} + {hasBothItems ? itemLeft : (itemRight != undefined ? itemRight : itemLeft)} + {hasBothItems && itemRight} {error && ({errorText})} {info != undefined && ({info})}