react-lock-bodyscroll
React lock body scroll work fine on Mobile browsers
Sometimes you want to prevent your users from being able to scroll the body of your page while a particular component is absolutely positioned over your page (think modal or full-screen mobile menu).
Installation
yarn add react-lock-bodyscroll
Usage
; { return <> <LockBodyScroll /> <div className="modal-overlay" onClick=onClose> <div className="modal"> <h2>title</h2> <p>content</p> </div> </div> </> ;} // OR// Call hook to lock body scroll { ; return <div className="modal-overlay" onClick=onClose> <div className="modal"> <h2>title</h2> <p>content</p> </div> </div> ;}
License
MIT © Nghiep