Files
lnreader/src/hooks/useBoolean.ts
T
Patrick Loser 414ca51660 fix: Export to EPUB Improvements (#670)
* Test config

* update react-native-epub-creator

* updated deps

* option for export to epub

* added prettier to dev deps since I couldn't push

* removed white background when pulling up bottomsheet

* added options to the export to epub feature

* support for customCSS -JS and inchapter images

* package update

* fixed weird typing

* fixed weird KeyboardAvoidingView

* remove test config

* logic fix

* removed styles2

* fixed package problems

* fixed package problems

* notification icons

* package reinstallation

* package reinstallation

* customFileModal fix

* fixed ChapterItem alignment

* added github suggestions
2023-07-15 13:14:11 +05:30

22 lines
631 B
TypeScript

import { Dispatch, SetStateAction, useCallback, useState } from 'react';
export interface BooleanHookType {
value: boolean;
setValue: Dispatch<SetStateAction<boolean>>;
setTrue: () => void;
setFalse: () => void;
toggle: () => void;
}
const useBoolean = (defaultValue?: boolean): BooleanHookType => {
const [value, setValue] = useState(!!defaultValue);
const setTrue = useCallback(() => setValue(true), []);
const setFalse = useCallback(() => setValue(false), []);
const toggle = useCallback(() => setValue(x => !x), []);
return { value, setValue, setTrue, setFalse, toggle };
};
export default useBoolean;