UNPKG

@gorhom/bottom-sheet

Version:

A performant interactive bottom sheet with fully configurable options 🚀

37 lines (34 loc) • 1.13 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.useBottomSheetContentSizeSetter = useBottomSheetContentSizeSetter; var _react = require("react"); var _hooks = require("../../hooks"); /** * A hook to set the content size properly into the bottom sheet, * internals. * * @param enableFooterMarginAdjustment Adjust the scrollable bottom margin to avoid the animated footer. * @returns */ function useBottomSheetContentSizeSetter(enableFooterMarginAdjustment) { //#region hooks const { enableDynamicSizing, animatedContentHeight, animatedFooterHeight } = (0, _hooks.useBottomSheetInternal)(); //#endregion //#region methods const setContentSize = (0, _react.useCallback)(contentHeight => { if (enableDynamicSizing) { animatedContentHeight.value = contentHeight + (enableFooterMarginAdjustment ? animatedFooterHeight.value : 0); } }, [enableDynamicSizing, animatedContentHeight, animatedFooterHeight, enableFooterMarginAdjustment]); //#endregion return { setContentSize }; } //# sourceMappingURL=useBottomSheetContentSizeSetter.js.map