@attio/react-native-bottom-sheet-toolbox-flash-list
Version:
32 lines (31 loc) • 1.17 kB
JavaScript
;
import { FlashList } from "@shopify/flash-list";
import * as React from "react";
import { useSharedValue } from "react-native-reanimated";
import { BottomSheetListWrapper } from "@attio/react-native-bottom-sheet-toolbox";
import { FlashListScrollComponent, InvertedFlashListScrollComponent } from "./flash-list-scroll-component";
import { jsx as _jsx } from "react/jsx-runtime";
export function BottomSheetFlashList({
ref,
inverted = false,
onContentSizeChange,
...rest
}) {
const contentHeightSharedValue = useSharedValue(null);
const innerOnContentSizeChange = React.useCallback((w, h) => {
onContentSizeChange?.(w, h);
contentHeightSharedValue.set(h);
}, [onContentSizeChange]);
return /*#__PURE__*/_jsx(BottomSheetListWrapper, {
contentHeightSharedValue: contentHeightSharedValue,
children: /*#__PURE__*/_jsx(FlashList, {
ref: ref,
bounces: false,
renderScrollComponent: inverted ? InvertedFlashListScrollComponent : FlashListScrollComponent,
onContentSizeChange: innerOnContentSizeChange,
inverted: inverted,
...rest
})
});
}
//# sourceMappingURL=bottom-sheet-flash-list.js.map