UNPKG

@scrolia/react-native

Version:
74 lines (70 loc) 2.45 kB
"use client"; const require_rolldown_runtime = require('../../_virtual/rolldown_runtime.js'); const require_contexts_scrollcore = require('../../contexts/scrollcore.js'); const react = require_rolldown_runtime.__toESM(require("react")); const react_jsx_runtime = require_rolldown_runtime.__toESM(require("react/jsx-runtime")); /** Provider component. */ const Provider = (props) => { const { children,...p } = props; const contentTypeX = react.useRef("scrollview"); const contentTypeY = react.useRef("scrollview"); const contentRefX = react.useRef(null); const contentRefY = react.useRef(null); const [hvTrackX, setHvTrackX] = react.useState(false); const [hvThumbX, setHvThumbX] = react.useState(false); const [hvTrackY, setHvTrackY] = react.useState(false); const [hvThumbY, setHvThumbY] = react.useState(false); const totalX = react.useRef(0); const totalY = react.useRef(0); const viewX = react.useRef(0); const viewY = react.useRef(0); const viewOffsetX = react.useRef(0); const viewOffsetY = react.useRef(0); const [scrollbarLengthX, setScrollbarLengthX] = react.useState(0); const [scrollbarLengthY, setScrollbarLengthY] = react.useState(0); const [scrollbarOffsetX, setScrollbarOffsetX] = react.useState(0); const [scrollbarOffsetY, setScrollbarOffsetY] = react.useState(0); return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_contexts_scrollcore.ScrollCoreContext, { value: { options: { ...p, disabled: p.disabled ?? false, animated: p.animated ?? false, plugins: p.plugins ?? [] }, x: { contentType: contentTypeX, contentRef: contentRefX, hvTrack: hvTrackX, setHvTrack: setHvTrackX, hvThumb: hvThumbX, setHvThumb: setHvThumbX, total: totalX, view: viewX, viewOffset: viewOffsetX, scrollbarLength: scrollbarLengthX, setScrollbarLength: setScrollbarLengthX, scrollbarOffset: scrollbarOffsetX, setScrollbarOffset: setScrollbarOffsetX }, y: { contentType: contentTypeY, contentRef: contentRefY, hvTrack: hvTrackY, setHvTrack: setHvTrackY, hvThumb: hvThumbY, setHvThumb: setHvThumbY, total: totalY, view: viewY, viewOffset: viewOffsetY, scrollbarLength: scrollbarLengthY, setScrollbarLength: setScrollbarLengthY, scrollbarOffset: scrollbarOffsetY, setScrollbarOffset: setScrollbarOffsetY } }, children }); }; exports.Provider = Provider; //# sourceMappingURL=index.js.map