UNPKG

@crossed/sheet

Version:

A Cross Platform(Android & iOS) ActionSheet with a robust and flexible api, native performance and zero dependency code for react native. Create anything you want inside ActionSheet.

45 lines (44 loc) 1.22 kB
import { jsx } from "react/jsx-runtime"; import React, { useImperativeHandle } from "react"; import { Platform, ScrollView as RNScrollView } from "react-native"; import { ScrollView as RNGHScrollView } from "react-native-gesture-handler"; import { useScrollHandlers } from "../hooks/use-scroll-handlers"; function $ScrollView(props, ref) { const handlers = useScrollHandlers({ hasRefreshControl: !!props.refreshControl, refreshControlBoundary: props.refreshControlGestureArea || 0.15 }); useImperativeHandle(ref, () => handlers.ref); const ScrollComponent = Platform.OS === "web" ? RNScrollView : RNGHScrollView; return /* @__PURE__ */ jsx( ScrollComponent, { ...props, ...handlers, onScroll: (event) => { var _a; handlers.onScroll(event); (_a = props.onScroll) == null ? void 0 : _a.call(props, event); }, onLayout: (event) => { var _a; handlers.onLayout(); (_a = props.onLayout) == null ? void 0 : _a.call(props, event); }, bounces: false, scrollEventThrottle: 1 } ); } const ScrollView = React.forwardRef( $ScrollView ); export { ScrollView }; //# sourceMappingURL=ScrollView.js.map