Skip to content

Instantly share code, notes, and snippets.

type ActionHandler = (...args: any[]) => Promise<(() => void) | undefined | void>;
// Hook used to initiate loading on action started and finish loading on action completed
const useLoading = (action: ActionHandler, timeout = 0): [ActionHandler, boolean] => {
const [loading, setLoading] = useState(false);
const isMounted = useRef(false);
useEffect(() => {
isMounted.current = true;
@kapobajza
kapobajza / Popover.tsx
Last active November 26, 2023 09:10
RN Popover component sample
import { View, StyleSheet, Pressable } from "react-native";
import { Dispatch, ReactElement, ReactNode, SetStateAction } from "react";
const Popover = ({
visible,
setVisible,
children,
PopoverContent,
}: {
visible: boolean;