fixed
This commit is contained in:
@@ -15,18 +15,16 @@ const SelectField = ({ label, options, ...props }) => {
|
||||
});
|
||||
|
||||
useEffect(() => {
|
||||
if (showOptions && selectRef.current) {
|
||||
if (!showOptions || !selectRef.current) return;
|
||||
|
||||
const rect = selectRef.current.getBoundingClientRect();
|
||||
|
||||
const spaceBelow = window.innerHeight - rect.bottom;
|
||||
const spaceAbove = rect.top;
|
||||
|
||||
const dropdownHeight = 150;
|
||||
|
||||
if (spaceBelow < dropdownHeight && spaceAbove > dropdownHeight) {
|
||||
setDropUp(true);
|
||||
} else {
|
||||
setDropUp(false);
|
||||
}
|
||||
}
|
||||
setDropUp(spaceBelow < dropdownHeight && spaceAbove > dropdownHeight);
|
||||
}, [showOptions]);
|
||||
|
||||
return (
|
||||
|
||||
Reference in New Issue
Block a user