@gorhom/bottom-sheet
Version:
A performant interactive bottom sheet with fully configurable options 🚀
39 lines (35 loc) • 926 B
JavaScript
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.
*/
function useBottomSheetContentSizeSetter() {
//#region hooks
const {
enableDynamicSizing,
animatedLayoutState
} = (0, _hooks.useBottomSheetInternal)();
//#endregion
//#region methods
const setContentSize = (0, _react.useCallback)(contentHeight => {
if (!enableDynamicSizing) {
return;
}
animatedLayoutState.modify(state => {
'worklet';
state.contentHeight = contentHeight;
return state;
});
}, [enableDynamicSizing, animatedLayoutState]);
//#endregion
return {
setContentSize
};
}
//# sourceMappingURL=useBottomSheetContentSizeSetter.js.map
;