
Research
/Security News
Toptal’s GitHub Organization Hijacked: 10 Malicious Packages Published
Threat actors hijacked Toptal’s GitHub org, publishing npm packages with malicious payloads that steal tokens and attempt to wipe victim systems.
react-scrolllock
Advanced tools
Prevent scroll on the <body />
when a component is mounted.
yarn add react-scrolllock
import ScrollLock, { TouchScrollable } from 'react-scrolllock';
class Modal extends Component {
state = { lockScroll: false }
render() {
return (
<div>
...
// the lock accepts a single child element, which supports touch-scrolling.
<ScrollLock>
<ElementWithScrollableContent>...</ElementWithScrollableContent>
</ScrollLock>
// if your app structure doesn't allow wrapping like above, the `TouchScrollable`
// component is exposed as a named export.
<ScrollLock />
<TouchScrollable>
<ElementWithScrollableContent>...</ElementWithScrollableContent>
</TouchScrollable>
// you can also toggle the lock based on some state.
<ScrollLock isActive={this.state.lockScroll} />
</div>
);
}
}
Property | Description |
---|---|
accountForScrollbars boolean | Default: true -- Whether or not to replace the scrollbar width when active. |
isActive boolean | Default: true -- Whether or not the lock is active. |
children element | Default: null -- This element is wrapped internally by the TouchScrollable component. |
Wrap an element in the TouchScrollable
component if you need an area that supports scroll on mobile.
This is necessary because the touchmove
event is explicitly cancelled — iOS doesn't observe overflow: hidden;
when applied to the <body />
element 😢
Property | Description |
---|---|
children element | ref => element |
5.0.1
8adf1dc2
#69 Thanks @flexdinesh - Fix: consider body margin when calculating scrollbar widthFAQs
Prevent scroll on the body when component is mounted.
The npm package react-scrolllock receives a total of 79,673 weekly downloads. As such, react-scrolllock popularity was classified as popular.
We found that react-scrolllock demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 3 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
/Security News
Threat actors hijacked Toptal’s GitHub org, publishing npm packages with malicious payloads that steal tokens and attempt to wipe victim systems.
Research
/Security News
Socket researchers investigate 4 malicious npm and PyPI packages with 56,000+ downloads that install surveillance malware.
Security News
The ongoing npm phishing campaign escalates as attackers hijack the popular 'is' package, embedding malware in multiple versions.