
Security News
npm ‘is’ Package Hijacked in Expanding Supply Chain Attack
The ongoing npm phishing campaign escalates as attackers hijack the popular 'is' package, embedding malware in multiple versions.
scroll-sync-react
Advanced tools
We provide you with a React.Context.Provider (<ScrollSync/>
) Component that you wrap your "context" with, and then wrap each of your scrollable elements with a scroll listner (<ScrollSyncNode/>
)
And see the magic happen
I needed this type of functionality on a side project, so I researched and found this library https://github.com/okonet/react-scroll-sync
I have so much similarity with this library, but it's not maintained anymore, and uses the legacy context api, which introduced unexpected bugs, so I re-implemented it with the new context API and using react-hooks
A codesandbox that utilizes the latest of this package https://codesandbox.io/s/gallant-sky-joiou
npm i scroll-sync-react --save
import { ScrollSync, ScrollSyncNode } from './build';
const App = () =>
<ScrollSync>
<div style={{ display: 'flex', position: 'relative', height: 300 }}>
<ScrollSyncNode group="a">
<div style={{ overflow: 'auto' }}>
<section style={{ height: 1000 }}>
<h1>This is group `a`</h1>
Scrollable things
</section>
</div>
</ScrollSyncNode>
<ScrollSyncNode group="a">
<div style={{ overflow: 'auto' }}>
<section style={{ height: 1000 }}>
<h1>This is group `a`</h1>
Scrollable things
</section>
</div>
</ScrollSyncNode>
</div>
</ScrollSync>
prop | type | required | default | description |
---|---|---|---|---|
children | ReactElement | true | wrapper of to-be-synced elements | |
disabled | boolean | false | false | whether syncing is enabled or not |
proportional | boolean | false | true | In case we want scroll to be proportionally applied regardless of the width and/or height |
prop | type | required | default | description |
---|---|---|---|---|
children | ReactElement | true | scrollable element | |
group | string | false | "default" | the group of scollable elements this node will be synced with |
scroll | "two-way", "synced-only" or "syncer-only" | false | "two-way" | to determine scroll configuration with other ScrollSyncNode s |
selfLockAxis | "X", "Y", "XY" or null | false | null | to specifiy current node scroll lock axis |
onScroll | (event) => void | false | ()=>{} | on Node Scroll callback |
A photo equals a thousand word, how about a GIF!
scroll
proponScroll
node callbackFAQs
## Overview
We found that scroll-sync-react demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer 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.
Security News
The ongoing npm phishing campaign escalates as attackers hijack the popular 'is' package, embedding malware in multiple versions.
Security News
A critical flaw in the popular npm form-data package could allow HTTP parameter pollution, affecting millions of projects until patched versions are adopted.
Security News
Bun 1.2.19 introduces isolated installs for smoother monorepo workflows, along with performance boosts, new tooling, and key compatibility fixes.