This commit is contained in:
Laux Dev
2026-03-03 10:17:48 +08:00
parent 1b3b669d58
commit e47424771f

View File

@@ -15,18 +15,16 @@ const SelectField = ({ label, options, ...props }) => {
});
useEffect(() => {
if (showOptions && selectRef.current) {
const rect = selectRef.current.getBoundingClientRect();
const spaceBelow = window.innerHeight - rect.bottom;
const spaceAbove = rect.top;
const dropdownHeight = 150;
if (!showOptions || !selectRef.current) return;
if (spaceBelow < dropdownHeight && spaceAbove > dropdownHeight) {
setDropUp(true);
} else {
setDropUp(false);
}
}
const rect = selectRef.current.getBoundingClientRect();
const spaceBelow = window.innerHeight - rect.bottom;
const spaceAbove = rect.top;
const dropdownHeight = 150;
setDropUp(spaceBelow < dropdownHeight && spaceAbove > dropdownHeight);
}, [showOptions]);
return (