Socket
Socket
Sign inDemoInstall

use-smooth-horizontal-scroll

Package Overview
Dependencies
5
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.6.0 to 0.7.0

2

dist/index.js

@@ -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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc