rename isOpen to isDropdownOpen

This commit is contained in:
Loewy 2024-02-19 14:01:44 -08:00
parent ffe95a12f2
commit f9edab8f36
2 changed files with 10 additions and 10 deletions

View File

@ -32,25 +32,25 @@ function useDropdown<T>(
options: Array<{ label: string; value: T }>,
closeOthers: () => void,
) {
const [isOpen, setIsOpen] = useState(false);
const [isDropdownOpen, setIsDropdownOpen] = useState(false);
const [value, setValue] = useState<T | null>(initialValue);
const [optionsList, setOptionsList] = useState(options);
const toggleOpen = useCallback(() => {
if (!isOpen) {
if (!isDropdownOpen) {
closeOthers();
}
setIsOpen(!isOpen);
}, [isOpen, closeOthers]);
setIsDropdownOpen(!isDropdownOpen);
}, [isDropdownOpen, closeOthers]);
return {
isOpen,
isDropdownOpen,
toggleOpen,
value,
setValue,
optionsList,
setOptionsList,
setIsOpen,
setIsDropdownOpen,
};
}
@ -76,8 +76,8 @@ export const useVideoDetails = ({
);
const closeAllDropdowns = useCallback(() => {
gameType.setIsOpen(false);
tableSize.setIsOpen(false);
gameType.setIsDropdownOpen(false);
tableSize.setIsDropdownOpen(false);
// eslint-disable-next-line react-hooks/exhaustive-deps
}, []);

View File

@ -47,7 +47,7 @@ export default function VideoDetails({ navigation, route }): React.JSX.Element {
<DropDownPicker
zIndex={3000}
zIndexInverse={1000}
open={gameType.isOpen}
open={gameType.isDropdownOpen}
value={gameType.value}
items={gameType.optionsList}
setOpen={gameType.toggleOpen}
@ -59,7 +59,7 @@ export default function VideoDetails({ navigation, route }): React.JSX.Element {
<DropDownPicker
zIndex={2000}
zIndexInverse={2000}
open={tableSize.isOpen}
open={tableSize.isDropdownOpen}
value={tableSize.value}
items={tableSize.optionsList}
setOpen={tableSize.toggleOpen}