@gechiui/components
Version:
UI components for GeChiUI.
36 lines (28 loc) • 919 B
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = useIsFloatingKeyboard;
var _reactNative = require("react-native");
var _element = require("@gechiui/element");
/**
* External dependencies
*/
/**
* GeChiUI dependencies
*/
function useIsFloatingKeyboard() {
const windowWidth = _reactNative.Dimensions.get('window').width;
const [floating, setFloating] = (0, _element.useState)(false);
(0, _element.useEffect)(() => {
const onKeyboardWillChangeFrame = event => {
setFloating(event.endCoordinates.width !== windowWidth);
};
_reactNative.Keyboard.addListener('keyboardWillChangeFrame', onKeyboardWillChangeFrame);
return () => {
_reactNative.Keyboard.removeListener('keyboardWillChangeFrame', onKeyboardWillChangeFrame);
};
}, [windowWidth]);
return floating;
}
//# sourceMappingURL=use-is-floating-keyboard.native.js.map