UNPKG

@attio/react-native-bottom-sheet-toolbox

Version:
29 lines (28 loc) 1.11 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.BottomSheetKeyboardDismissMarker = BottomSheetKeyboardDismissMarker; var _reactNativeReanimated = require("react-native-reanimated"); var _hooks = require("../hooks"); var _invisibleView = require("./invisible-view"); var _jsxRuntime = require("react/jsx-runtime"); /** * A marker component that we can use to identify a point within the bottom-sheet * for which the keyboard should be dismissed should the point fall behind the keyboard. * Note: this does inject an invisible View into the tree, which may impact layout. */ function BottomSheetKeyboardDismissMarker({ extraOffset = 0 }) { const { onLayout, y } = (0, _hooks.useLayoutSharedValue)(undefined, 0); const yWithExtra = (0, _reactNativeReanimated.useDerivedValue)(() => y.get() + extraOffset, [y, extraOffset]); (0, _hooks.useBottomSheetKeyboardDismiss)(yWithExtra); return /*#__PURE__*/(0, _jsxRuntime.jsx)(_invisibleView.InvisibleView, { onLayout: onLayout }); } //# sourceMappingURL=bottom-sheet-keyboard-dismiss-marker.js.map