"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.useAutoFocus = exports.usePrevious = void 0;
const tslib_1 = require("tslib");
const react_1 = tslib_1.__importDefault(require("react"));
const react_native_1 = require("react-native");
const usePrevious = (value) => {
    const ref = react_1.default.useRef();
    react_1.default.useEffect(() => {
        ref.current = value;
    });
    return ref.current;
};
exports.usePrevious = usePrevious;
const useAutoFocus = (autoFocus = false, inputRef) => {
    react_1.default.useEffect(() => {
        if (autoFocus && inputRef) {
            react_native_1.InteractionManager.runAfterInteractions(() => {
                inputRef?.current?._inputElement.current?.focus();
            });
        }
    }, [autoFocus, inputRef]);
    return inputRef;
};
exports.useAutoFocus = useAutoFocus;
//# sourceMappingURL=index.js.map