@scrolia/react-native-flash-list
Version:
A set of list components for Scrolia React Native
46 lines (42 loc) • 1.91 kB
JavaScript
"use client";
const require_rolldown_runtime = require('./_virtual/rolldown_runtime.js');
const __scrolia_react_native_contexts_scrollcore = require_rolldown_runtime.__toESM(require("@scrolia/react-native/contexts/scrollcore"));
const __scrolia_react_native_functions_props = require_rolldown_runtime.__toESM(require("@scrolia/react-native/functions/props"));
const __scrolia_react_native_hooks_content = require_rolldown_runtime.__toESM(require("@scrolia/react-native/hooks/content"));
const __shopify_flash_list = require_rolldown_runtime.__toESM(require("@shopify/flash-list"));
const react = require_rolldown_runtime.__toESM(require("react"));
const react_jsx_runtime = require_rolldown_runtime.__toESM(require("react/jsx-runtime"));
/**
* Horizontal list component based on `@shopify/flash-list`.
*
* **This component requires `@shopify/flash-list` to be installed.**
*/
const FlashListX = (props) => {
const { options: { disabled, plugins }, x: { contentType, contentRef } } = (0, __scrolia_react_native_contexts_scrollcore.useScrollCore)();
const p = (0, __scrolia_react_native_functions_props.getComponentProps)({
name: "listX",
props,
plugins
});
react.useImperativeHandle(p.ref, () => {
return contentRef.current;
}, [contentRef]);
react.useEffect(() => {
contentType.current = "flatlist";
}, [contentType]);
const { onLayout, onContentSizeChange, onScroll } = (0, __scrolia_react_native_hooks_content.useContentXHandler)({ props: p });
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(__shopify_flash_list.FlashList, {
...p,
ref: contentRef,
showsHorizontalScrollIndicator: p.showsHorizontalScrollIndicator ?? disabled,
showsVerticalScrollIndicator: false,
onLayout,
onContentSizeChange,
onScroll,
horizontal: true,
scrollEventThrottle: p.scrollEventThrottle ?? 5,
children: p.children
});
};
exports.FlashListX = FlashListX;
//# sourceMappingURL=x.js.map