@scrolia/react-native
Version:
A headless scrollbar component
46 lines (43 loc) • 1.52 kB
JavaScript
"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");
/**
* Vertical Content component.
*
* Use `ListY` for a list of items.
*/
const ContentY = (props) => {
const { options: { disabled, plugins }, y: { contentRef, contentType } } = require_contexts_scrollcore.useScrollCore();
const p = require_functions_props.getComponentProps({
name: "contentY",
props,
plugins
});
react.useImperativeHandle(p.ref, () => {
return contentRef.current;
}, [contentRef]);
react.useEffect(() => {
contentType.current = "scrollview";
}, [contentType]);
const { onLayout, onContentSizeChange, onScroll } = require_hooks_content_index.useContentYHandler({ props: p });
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_native.ScrollView, {
...p,
ref: contentRef,
showsHorizontalScrollIndicator: false,
showsVerticalScrollIndicator: p.showsHorizontalScrollIndicator ?? disabled,
onLayout,
onContentSizeChange,
onScroll,
horizontal: false,
scrollEventThrottle: p.scrollEventThrottle ?? 5,
children: p.children
});
};
exports.ContentY = ContentY;
//# sourceMappingURL=y.js.map