UNPKG

@scrolia/react-native

Version:
44 lines (41 loc) 1.25 kB
"use client"; import { useScrollCore } from "../../contexts/scrollcore.mjs"; import { getComponentProps } from "../../functions/props.mjs"; import { useContentYHandler } from "../../hooks/content/index.mjs"; import { ScrollView } from "react-native"; import * as React from "react"; import { jsx } from "react/jsx-runtime"; /** * Vertical Content component. * * Use `ListY` for a list of items. */ const ContentY = (props) => { const { options: { disabled, plugins }, y: { contentRef, contentType } } = useScrollCore(); const p = getComponentProps({ name: "contentY", props, plugins }); React.useImperativeHandle(p.ref, () => { return contentRef.current; }, [contentRef]); React.useEffect(() => { contentType.current = "scrollview"; }, [contentType]); const { onLayout, onContentSizeChange, onScroll } = useContentYHandler({ props: p }); return /* @__PURE__ */ jsx(ScrollView, { ...p, ref: contentRef, showsHorizontalScrollIndicator: false, showsVerticalScrollIndicator: p.showsHorizontalScrollIndicator ?? disabled, onLayout, onContentSizeChange, onScroll, horizontal: false, scrollEventThrottle: p.scrollEventThrottle ?? 5, children: p.children }); }; export { ContentY }; //# sourceMappingURL=y.mjs.map