react-native-select-dropdown is a highly customized dropdown | select | picker | menu for react native that works for andriod and iOS platforms.
320
stars
137
forks
source link
DropDown Windonw not in desired Position for tablet/iPad landscape #200
Open
jasrzhang opened 1 month ago
Hi legends.
I found the drop down Window sometimes overflow, and not supporting rotation very well.
In the useLayoutDropdown.js, could we use
useWindowsDemension
hook rather than useDimentions.get()
directly?`const {height} = Dimensions.get('window'); const DROPDOWN_MAX_HEIGHT = height * 0.4;
export const useLayoutDropdown = (data, dropdownStyle) => { const [isVisible, setIsVisible] = useState(false); // dropdown visible ? const [buttonLayout, setButtonLayout] = useState(null); const [dropdownCalculatedStyle, setDropdownCalculatedStyle] = useState({});`
I did a simple test, it seems working better to me like this:
` export const useLayoutDropdown = (data, dropdownStyle) => {
const { height } = useWindowDimensions(); const DROPDOWN_MAX_HEIGHT = useMemo(() => height * 0.4, [height]);
const [isVisible, setIsVisible] = useState(false); // dropdown visible ? const [buttonLayout, setButtonLayout] = useState(null); const [dropdownCalculatedStyle, setDropdownCalculatedStyle] = useState({}); `