UNPKG

@gorhom/bottom-sheet

Version:

A performant interactive bottom sheet with fully configurable options 🚀

53 lines (52 loc) • 1.93 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.useBottomSheetScrollableCreator = useBottomSheetScrollableCreator; var _bottomSheetScrollable = require("../components/bottomSheetScrollable"); var _jsxRuntime = require("react/jsx-runtime"); /** * A custom hook that creates a scrollable component for third-party libraries * like `LegendList` or `FlashList` to integrate the interaction and scrolling * behaviors with th BottomSheet component. * * @param configs - Configuration options for the scrollable creator. * @param configs.focusHook - This needed when bottom sheet used with multiple scrollables to allow bottom sheet * detect the current scrollable ref, especially when used with `React Navigation`. * You will need to provide `useFocusEffect` from `@react-navigation/native`. * @param configs.scrollEventsHandlersHook - Custom hook to provide scroll events handler, which will allow advance and * customize handling for scrollables. * @param configs.enableFooterMarginAdjustment - Adjust the scrollable bottom margin to avoid the animated footer. * * @example * ```tsx * const BottomSheetLegendListScrollable = useBottomSheetScrollableCreator(); * * // Usage in JSX * <LegendList * renderScrollComponent={BottomSheetLegendListScrollable} * /> * ``` */ // biome-ignore lint/suspicious/noExplicitAny: out of my control function useBottomSheetScrollableCreator({ focusHook, scrollEventsHandlersHook, enableFooterMarginAdjustment } = {}) { // @ts-ignore return ({ data: _, ...props }, ref) => /*#__PURE__*/ // @ts-ignore (0, _jsxRuntime.jsx)(_bottomSheetScrollable.BottomSheetScrollView, { ref: ref, ...props, focusHook: focusHook, scrollEventsHandlersHook: scrollEventsHandlersHook, enableFooterMarginAdjustment: enableFooterMarginAdjustment }); } //# sourceMappingURL=useBottomSheetScrollableCreator.js.map