UNPKG

@scrolia/react-native

Version:
46 lines (43 loc) 1.52 kB
"use client"; const require_runtime = require('../../_virtual/_rolldown/runtime.js'); const require_contexts_scrollcore = require('../../contexts/scrollcore.js'); const require_functions_props = require('../../functions/props.js'); const require_hooks_content_index = require('../../hooks/content/index.js'); let react_native = require("react-native"); let react = require("react"); react = require_runtime.__toESM(react); let react_jsx_runtime = require("react/jsx-runtime"); /** * Horizontal Content component. * * Use `ListX` for a list of items. */ const ContentX = (props) => { const { options: { disabled, plugins }, x: { contentRef, contentType } } = require_contexts_scrollcore.useScrollCore(); const p = require_functions_props.getComponentProps({ name: "contentX", props, plugins }); react.useImperativeHandle(p.ref, () => { return contentRef.current; }, [contentRef]); react.useEffect(() => { contentType.current = "scrollview"; }, [contentType]); const { onLayout, onContentSizeChange, onScroll } = require_hooks_content_index.useContentXHandler({ props: p }); return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_native.ScrollView, { ...p, ref: contentRef, showsHorizontalScrollIndicator: p.showsHorizontalScrollIndicator ?? disabled, showsVerticalScrollIndicator: false, onLayout, onContentSizeChange, onScroll, horizontal: true, scrollEventThrottle: p.scrollEventThrottle ?? 5, children: p.children }); }; exports.ContentX = ContentX; //# sourceMappingURL=x.js.map