import React from 'react';
import { InteractionManager } from 'react-native';
export const usePrevious = (value) => {
    const ref = React.useRef();
    React.useEffect(() => {
        ref.current = value;
    });
    return ref.current;
};
export const useAutoFocus = (autoFocus = false, inputRef = React.useRef(null)) => {
    React.useEffect(() => {
        if (autoFocus && inputRef.current) {
            InteractionManager.runAfterInteractions(() => {
                inputRef.current?.focus();
            });
        }
    }, [autoFocus, inputRef]);
    return inputRef;
};
//# sourceMappingURL=index.js.map