Security News
Supply Chain Attack Detected in Solana's web3.js Library
A supply chain attack has been detected in versions 1.95.6 and 1.95.7 of the popular @solana/web3.js library.
@studio-freight/react-lenis
Advanced tools
![NPM Version](https://img.shields.io/npm/v/%40studio-freight%2Freact-lenis?colorA=000000&colorB=ff98a2) ![NPM Downloads](https://img.shields.io/npm/dm/%40studio-freight%2Freact-lenis?colorA=000000&colorB=ff98a2)
react-lenis provides a <ReactLenis>
component that creates a Lenis instance and provides it to its children via context. This allows you to use Lenis in your React app without worrying about passing the instance down through props. It also provides a useLenis
hook that allows you to access the Lenis instance from any component in your app.
For npm users:
npm i @studio-freight/react-lenis
For yarn users:
yarn add @studio-freight/react-lenis
import { ReactLenis, useLenis } from '@studio-freight/react-lenis'
function Layout() {
const lenis = useLenis(({ scroll }) => {
// called every scroll
})
return (
<ReactLenis root>
{ /* content */ }
</ReactLenis>
)
}
options
: Lenis options.root
: Lenis will be instanciate using <html>
scroll. Default: false
.autoRaf
: if false
, lenis.raf
needs to be called manually. Default: true
.rAFpriority
: Tempus execution priority. Default: 0
.Once the Lenis context is set (components mounted inside <ReactLenis>
) you can use these handy hooks:
useLenis
is a hook that returns the Lenis instance
The hook takes three argument:
callback
: The function to be called whenever a scroll event is emitteddeps
: Trigger callback on changepriority
: Manage callback execution orderGSAP integration
function Component() {
const lenisRef = useRef()
useEffect(() => {
function update(time) {
lenisRef.current?.lenis?.raf(time * 1000)
}
gsap.ticker.add(update)
return () => {
gsap.ticker.remove(update)
}
})
return (
<ReactLenis ref={lenisRef} autoRaf={false}>
{ /* content */ }
</ReactLenis>
)
}
This tool is maintained by the Studio Freight Darkroom team:
FAQs
![NPM Version](https://img.shields.io/npm/v/%40studio-freight%2Freact-lenis?colorA=000000&colorB=ff98a2) ![NPM Downloads](https://img.shields.io/npm/dm/%40studio-freight%2Freact-lenis?colorA=000000&colorB=ff98a2)
The npm package @studio-freight/react-lenis receives a total of 7,566 weekly downloads. As such, @studio-freight/react-lenis popularity was classified as popular.
We found that @studio-freight/react-lenis demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 5 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.
Security News
A supply chain attack has been detected in versions 1.95.6 and 1.95.7 of the popular @solana/web3.js library.
Research
Security News
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
Security News
Research
Socket researchers have discovered malicious npm packages targeting crypto developers, stealing credentials and wallet data using spyware delivered through typosquats of popular cryptographic libraries.