@attio/react-native-bottom-sheet-toolbox
Version:
25 lines (24 loc) • 931 B
JavaScript
;
import { useDerivedValue } from "react-native-reanimated";
import { useBottomSheetKeyboardDismiss, useLayoutSharedValue } from "../hooks";
import { InvisibleView } from "./invisible-view";
import { jsx as _jsx } from "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.
*/
export function BottomSheetKeyboardDismissMarker({
extraOffset = 0
}) {
const {
onLayout,
y
} = useLayoutSharedValue(undefined, 0);
const yWithExtra = useDerivedValue(() => y.get() + extraOffset, [y, extraOffset]);
useBottomSheetKeyboardDismiss(yWithExtra);
return /*#__PURE__*/_jsx(InvisibleView, {
onLayout: onLayout
});
}
//# sourceMappingURL=bottom-sheet-keyboard-dismiss-marker.js.map