rename isOpen to isDropdownOpen
This commit is contained in:
parent
ffe95a12f2
commit
f9edab8f36
@ -32,25 +32,25 @@ function useDropdown<T>(
|
|||||||
options: Array<{ label: string; value: T }>,
|
options: Array<{ label: string; value: T }>,
|
||||||
closeOthers: () => void,
|
closeOthers: () => void,
|
||||||
) {
|
) {
|
||||||
const [isOpen, setIsOpen] = useState(false);
|
const [isDropdownOpen, setIsDropdownOpen] = useState(false);
|
||||||
const [value, setValue] = useState<T | null>(initialValue);
|
const [value, setValue] = useState<T | null>(initialValue);
|
||||||
const [optionsList, setOptionsList] = useState(options);
|
const [optionsList, setOptionsList] = useState(options);
|
||||||
|
|
||||||
const toggleOpen = useCallback(() => {
|
const toggleOpen = useCallback(() => {
|
||||||
if (!isOpen) {
|
if (!isDropdownOpen) {
|
||||||
closeOthers();
|
closeOthers();
|
||||||
}
|
}
|
||||||
setIsOpen(!isOpen);
|
setIsDropdownOpen(!isDropdownOpen);
|
||||||
}, [isOpen, closeOthers]);
|
}, [isDropdownOpen, closeOthers]);
|
||||||
|
|
||||||
return {
|
return {
|
||||||
isOpen,
|
isDropdownOpen,
|
||||||
toggleOpen,
|
toggleOpen,
|
||||||
value,
|
value,
|
||||||
setValue,
|
setValue,
|
||||||
optionsList,
|
optionsList,
|
||||||
setOptionsList,
|
setOptionsList,
|
||||||
setIsOpen,
|
setIsDropdownOpen,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -76,8 +76,8 @@ export const useVideoDetails = ({
|
|||||||
);
|
);
|
||||||
|
|
||||||
const closeAllDropdowns = useCallback(() => {
|
const closeAllDropdowns = useCallback(() => {
|
||||||
gameType.setIsOpen(false);
|
gameType.setIsDropdownOpen(false);
|
||||||
tableSize.setIsOpen(false);
|
tableSize.setIsDropdownOpen(false);
|
||||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
|
@ -47,7 +47,7 @@ export default function VideoDetails({ navigation, route }): React.JSX.Element {
|
|||||||
<DropDownPicker
|
<DropDownPicker
|
||||||
zIndex={3000}
|
zIndex={3000}
|
||||||
zIndexInverse={1000}
|
zIndexInverse={1000}
|
||||||
open={gameType.isOpen}
|
open={gameType.isDropdownOpen}
|
||||||
value={gameType.value}
|
value={gameType.value}
|
||||||
items={gameType.optionsList}
|
items={gameType.optionsList}
|
||||||
setOpen={gameType.toggleOpen}
|
setOpen={gameType.toggleOpen}
|
||||||
@ -59,7 +59,7 @@ export default function VideoDetails({ navigation, route }): React.JSX.Element {
|
|||||||
<DropDownPicker
|
<DropDownPicker
|
||||||
zIndex={2000}
|
zIndex={2000}
|
||||||
zIndexInverse={2000}
|
zIndexInverse={2000}
|
||||||
open={tableSize.isOpen}
|
open={tableSize.isDropdownOpen}
|
||||||
value={tableSize.value}
|
value={tableSize.value}
|
||||||
items={tableSize.optionsList}
|
items={tableSize.optionsList}
|
||||||
setOpen={tableSize.toggleOpen}
|
setOpen={tableSize.toggleOpen}
|
||||||
|
Loading…
Reference in New Issue
Block a user