use-smooth-horizontal-scroll
Advanced tools
Comparing version 0.6.0 to 0.7.0
@@ -1,2 +0,2 @@ | ||
function ___$insertStyle(e){if(e&&"undefined"!=typeof window){var t=document.createElement("style");return t.setAttribute("type","text/css"),t.innerHTML=e,document.head.appendChild(t),e}}Object.defineProperty(exports,"__esModule",{value:!0});var react=require("react"),useSmoothHorizontalScroll=function(){var l=react.useRef(null),e=react.useState(!0),t=e[0],n=e[1],r=react.useState(!1),o=r[0],u=r[1];return{scrollContainerRef:l,handleScroll:function(){var e,t,r,o;l.current&&(n(0===(null===(e=l.current)||void 0===e?void 0:e.scrollLeft)),u(Math.floor((null===(t=l.current)||void 0===t?void 0:t.scrollWidth)-(null===(r=l.current)||void 0===r?void 0:r.scrollLeft))<=(null===(o=l.current)||void 0===o?void 0:o.offsetWidth)))},scrollTo:function(e){var t,r;null!==(t=l.current)&&void 0!==t&&t.scrollTo({left:(null===(r=l.current)||void 0===r?void 0:r.scrollLeft)+e,behavior:"smooth"})},isAtStart:t,isAtEnd:o}};exports.default=useSmoothHorizontalScroll; | ||
function ___$insertStyle(e){if(e&&"undefined"!=typeof window){var t=document.createElement("style");return t.setAttribute("type","text/css"),t.innerHTML=e,document.head.appendChild(t),e}}Object.defineProperty(exports,"__esModule",{value:!0});var react=require("react"),useSmoothHorizontalScroll=function(){var l=react.useRef(null),e=react.useState(!0),t=e[0],n=e[1],r=react.useState(!1),o=r[0],c=r[1];react.useEffect(function(){l.current&&c(l.current.scrollWidth===l.current.offsetWidth)},[l]);return{scrollContainerRef:l,handleScroll:function(){var e,t,r,o;l.current&&(n(0===(null===(e=l.current)||void 0===e?void 0:e.scrollLeft)),c(Math.floor((null===(t=l.current)||void 0===t?void 0:t.scrollWidth)-(null===(r=l.current)||void 0===r?void 0:r.scrollLeft))<=(null===(o=l.current)||void 0===o?void 0:o.offsetWidth)))},scrollTo:function(e){var t,r;null!==(t=l.current)&&void 0!==t&&t.scrollTo({left:(null===(r=l.current)||void 0===r?void 0:r.scrollLeft)+e,behavior:"smooth"})},isAtStart:t,isAtEnd:o}};exports.default=useSmoothHorizontalScroll; | ||
//# sourceMappingURL=index.js.map |
{ | ||
"name": "use-smooth-horizontal-scroll", | ||
"version": "0.6.0", | ||
"version": "0.7.0", | ||
"description": "This package provides a custom hook for smooth horizontal scrolling in React. The hook allows for setting a scroll container, handling scroll events, scrolling to a specific point, and determining if the user is at the start or end of the scrollable area.", | ||
@@ -5,0 +5,0 @@ "author": "progrmoiz", |
Sorry, the diff of this file is not supported yet
10397