@crossed/ui
Version:
A universal & performant styling library for React Native, Next.js & React
65 lines (64 loc) • 1.38 kB
JavaScript
import { jsx, jsxs } from "react/jsx-runtime";
import { withStaticProperties } from "@crossed/core";
import { Layout } from "./utils/Layout";
import { Title } from "./utils/Title";
import { Footer } from "./utils/Footer";
import { Body } from "./utils/Body";
import { forwardRef } from "react";
import { useLogic } from "./utils/useLogic";
import Animated from "react-native-reanimated";
const Root = forwardRef((props, ref) => {
const {
stickyHeader,
stickyFooter,
containerProps,
style,
children,
...rest
} = props;
const {
title,
footer,
body,
onLayout,
onContentSizeChange,
showFooter,
paddingRight
} = useLogic(props);
return /* @__PURE__ */ jsx(
Layout,
{
footer,
showFooter,
paddingRight,
stickyFooter,
...containerProps,
children: /* @__PURE__ */ jsxs(
Animated.ScrollView,
{
ref,
stickyHeaderIndices: stickyHeader && title ? [0] : void 0,
...rest,
onLayout,
onContentSizeChange,
style: [style],
children: [
title,
body,
footer
]
}
)
}
);
});
Root.displayName = "ScrollView";
const ScrollView = withStaticProperties(Root, {
Title,
Footer,
Body
});
export {
ScrollView
};
//# sourceMappingURL=ScrollView.js.map