UNPKG

@scrolia/react-native-reanimated

Version:

A set of reanimated components for Scrolia React Native

53 lines (50 loc) 2.03 kB
"use client"; const require_rolldown_runtime = require('../_virtual/rolldown_runtime.js'); let _scrolia_react_native_contexts_scrollcore = require("@scrolia/react-native/contexts/scrollcore"); let _scrolia_react_native_functions_props = require("@scrolia/react-native/functions/props"); let _scrolia_react_native_hooks_thumb = require("@scrolia/react-native/hooks/thumb"); let react = require("react"); react = require_rolldown_runtime.__toESM(react); let react_native = require("react-native"); let react_native_reanimated = require("react-native-reanimated"); react_native_reanimated = require_rolldown_runtime.__toESM(react_native_reanimated); let react_jsx_runtime = require("react/jsx-runtime"); /** * Vertical thumb component based on `react-native-reanimated`. * * **This component requires `react-native-reanimated` to be installed.** */ const ReanimatedThumbY = (props) => { const { options: { animated, plugins }, y: { setHvThumb, scrollbarLength, scrollbarOffset } } = (0, _scrolia_react_native_contexts_scrollcore.useScrollCore)(); const p = (0, _scrolia_react_native_functions_props.getComponentProps)({ name: "thumbY", props, plugins }); react.useEffect(() => { setHvThumb(true); }, [setHvThumb]); const { panResponder } = (0, _scrolia_react_native_hooks_thumb.useThumbYHandler)(); if (animated) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_native_reanimated.default.View, { ...p, ...panResponder.panHandlers, ref: p.ref, style: [p.style, { height: Number.isNaN(scrollbarLength) ? 0 : scrollbarLength, top: 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, { height: Number.isNaN(scrollbarLength) ? 0 : scrollbarLength, top: Number.isNaN(scrollbarOffset) ? 0 : scrollbarOffset }], children: p.children }); }; exports.ReanimatedThumbY = ReanimatedThumbY; //# sourceMappingURL=y.js.map