From a5e379cc7fdb10231e7dab5de332d1ebd2dd578a Mon Sep 17 00:00:00 2001 From: amaliadwiy Date: Tue, 5 May 2026 16:26:07 +0800 Subject: [PATCH] fix: tampilkan ikon search dan ikon x secara bersamaan di input pencarian Co-Authored-By: Claude Sonnet 4.6 --- components/inputForm.tsx | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) 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})}