@scrolia/react-native-reanimated
Version:
A set of reanimated components for Scrolia React Native
40 lines (36 loc) • 1.07 kB
JavaScript
"use client";
import { useScrollCore } from "@scrolia/react-native/contexts/scrollcore";
import { getComponentProps } from "@scrolia/react-native/functions/props";
import * as React from "react";
import { View } from "react-native";
import Reanimated from "react-native-reanimated";
import { Fragment, jsx } from "react/jsx-runtime";
/**
* Horizontal track component based on `react-native-reanimated`.
*
* **This component requires `react-native-reanimated` to be installed.**
*/
const ReanimatedTrackX = (props) => {
const { options: { disabled, animated, plugins }, x: { setHvTrack } } = useScrollCore();
const p = getComponentProps({
name: "trackX",
props,
plugins
});
React.useEffect(() => {
setHvTrack(true);
}, [setHvTrack]);
if (disabled) return /* @__PURE__ */ jsx(Fragment, {});
if (animated) return /* @__PURE__ */ jsx(Reanimated.View, {
...p,
ref: p.ref,
children: p.children
});
return /* @__PURE__ */ jsx(View, {
...p,
ref: p.ref,
children: p.children
});
};
export { ReanimatedTrackX };
//# sourceMappingURL=x.mjs.map