@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.
42 lines (41 loc) • 1.2 kB
JavaScript
import { jsx } from "react/jsx-runtime";
import React, { useImperativeHandle } from "react";
import { Platform, FlatList as RNFlatList } from "react-native";
import {
FlatList as RNGHFlatList
} from "react-native-gesture-handler";
import { useScrollHandlers } from "../hooks/use-scroll-handlers";
function $FlatList(props, ref) {
const handlers = useScrollHandlers({
hasRefreshControl: !!props.refreshControl,
refreshControlBoundary: props.refreshControlGestureArea || 0.15
});
useImperativeHandle(ref, () => handlers.ref);
const ScrollComponent = Platform.OS === "web" ? RNFlatList : RNGHFlatList;
return /* @__PURE__ */ jsx(
ScrollComponent,
{
...props,
...handlers,
onScroll: (event) => {
var _a;
handlers.onScroll(event);
(_a = props.onScroll) == null ? void 0 : _a.call(props, event);
},
bounces: false,
onLayout: (event) => {
var _a;
handlers.onLayout();
(_a = props.onLayout) == null ? void 0 : _a.call(props, event);
},
scrollEventThrottle: 1
}
);
}
const FlatList = React.forwardRef(
$FlatList
);
export {
FlatList
};
//# sourceMappingURL=FlatList.js.map