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