@scrolia/react-native-reanimated
Version:
A set of reanimated components for Scrolia React Native
52 lines (48 loc) • 2.16 kB
JavaScript
"use client";
const require_rolldown_runtime = require('../_virtual/rolldown_runtime.js');
const __scrolia_react_native_contexts_scrollcore = require_rolldown_runtime.__toESM(require("@scrolia/react-native/contexts/scrollcore"));
const __scrolia_react_native_functions_props = require_rolldown_runtime.__toESM(require("@scrolia/react-native/functions/props"));
const __scrolia_react_native_hooks_thumb = require_rolldown_runtime.__toESM(require("@scrolia/react-native/hooks/thumb"));
const react = require_rolldown_runtime.__toESM(require("react"));
const react_native = require_rolldown_runtime.__toESM(require("react-native"));
const react_native_reanimated = require_rolldown_runtime.__toESM(require("react-native-reanimated"));
const react_jsx_runtime = require_rolldown_runtime.__toESM(require("react/jsx-runtime"));
/**
* Horizontal thumb component based on `react-native-reanimated`.
*
* **This component requires `react-native-reanimated` to be installed.**
*/
const ReanimatedThumbX = (props) => {
const { options: { animated, plugins }, x: { setHvThumb, scrollbarLength, scrollbarOffset } } = (0, __scrolia_react_native_contexts_scrollcore.useScrollCore)();
const p = (0, __scrolia_react_native_functions_props.getComponentProps)({
name: "thumbX",
props,
plugins
});
react.useEffect(() => {
setHvThumb(true);
}, [setHvThumb]);
const { panResponder } = (0, __scrolia_react_native_hooks_thumb.useThumbXHandler)();
if (animated) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_native_reanimated.default.View, {
...p,
...panResponder.panHandlers,
ref: p.ref,
style: [p.style, {
width: Number.isNaN(scrollbarLength) ? 0 : scrollbarLength,
left: Number.isNaN(scrollbarOffset) ? 0 : scrollbarOffset
}],
children: p.children
});
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_native.View, {
...p,
...panResponder.panHandlers,
ref: p.ref,
style: [p.style, {
width: Number.isNaN(scrollbarLength) ? 0 : scrollbarLength,
left: Number.isNaN(scrollbarOffset) ? 0 : scrollbarOffset
}],
children: p.children
});
};
exports.ReanimatedThumbX = ReanimatedThumbX;
//# sourceMappingURL=x.js.map