"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.useKeyboard = useKeyboard;
const react_1 = require("react");
const react_native_1 = require("react-native");
function useKeyboard() {
    const [isKeyboardVisible, setIsKeyboardVisible] = (0, react_1.useState)(false);
    const [keyboardHeight, setKeyboardHeight] = (0, react_1.useState)(0);
    (0, react_1.useEffect)(() => {
        const willShowSubscription = react_native_1.Keyboard.addListener("keyboardWillShow", (e) => {
            // setIsKeyboardVisible(true);
            setKeyboardHeight(e.endCoordinates.height);
            console.log("keyboardWillShow", e.endCoordinates.height);
        });
        const willHideSubscription = react_native_1.Keyboard.addListener("keyboardWillHide", (e) => {
            // setIsKeyboardVisible(false);
            setKeyboardHeight(0);
            console.log("keyboardWillHide", e.endCoordinates.height);
        });
        const showSubscription = react_native_1.Keyboard.addListener("keyboardDidShow", (e) => {
            setIsKeyboardVisible(true);
            setKeyboardHeight(e.endCoordinates.height);
            console.log("keyboardDidShow", e.endCoordinates.height);
        });
        const hideSubscription = react_native_1.Keyboard.addListener("keyboardDidHide", () => {
            setIsKeyboardVisible(false);
            setKeyboardHeight(0);
        });
        return () => {
            showSubscription.remove();
            hideSubscription.remove();
            willShowSubscription.remove();
        };
    }, []);
    return { isKeyboardVisible, keyboardHeight };
}
//# sourceMappingURL=useKeyboard.js.map