@gorhom/bottom-sheet
Version:
A performant interactive bottom sheet with fully configurable options 🚀
32 lines (29 loc) • 979 B
JavaScript
import { useCallback } from 'react';
import { useBottomSheetInternal } from '../../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
*/
export function useBottomSheetContentSizeSetter(enableFooterMarginAdjustment) {
//#region hooks
const {
enableDynamicSizing,
animatedContentHeight,
animatedFooterHeight
} = useBottomSheetInternal();
//#endregion
//#region methods
const setContentSize = useCallback(contentHeight => {
if (enableDynamicSizing) {
animatedContentHeight.value = contentHeight + (enableFooterMarginAdjustment ? animatedFooterHeight.value : 0);
}
}, [enableDynamicSizing, animatedContentHeight, animatedFooterHeight, enableFooterMarginAdjustment]);
//#endregion
return {
setContentSize
};
}
//# sourceMappingURL=useBottomSheetContentSizeSetter.js.map