react-scroll-control 1.0.3 → 1.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/{readme.md → README.md} +40 -0
- package/package.json +1 -1
package/{readme.md → README.md}
RENAMED
|
@@ -48,3 +48,43 @@ Using npm:
|
|
|
48
48
|
|
|
49
49
|
```bash
|
|
50
50
|
npm install react-scroll-control
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
## 🧪 Examples
|
|
54
|
+
|
|
55
|
+
```js
|
|
56
|
+
useSmoothScroll(0.3); // very slow scrolling
|
|
57
|
+
useSmoothScroll(0.5); // smooth & natural
|
|
58
|
+
useSmoothScroll(1); // default browser speed
|
|
59
|
+
useSmoothScroll(1.5); // fast scrolling
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
## 🚀 Usage
|
|
63
|
+
|
|
64
|
+
```jsx
|
|
65
|
+
import useSmoothScroll from "react-scroll-control";
|
|
66
|
+
|
|
67
|
+
function App() {
|
|
68
|
+
useSmoothScroll(0.5);
|
|
69
|
+
|
|
70
|
+
return (
|
|
71
|
+
<div>
|
|
72
|
+
<h1>Hello JSX</h1>
|
|
73
|
+
</div>
|
|
74
|
+
);
|
|
75
|
+
}
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
## ⚠️ Important Notes
|
|
79
|
+
|
|
80
|
+
- This hook replaces native mouse-wheel scrolling
|
|
81
|
+
|
|
82
|
+
- Uses { passive: false } to allow preventDefault()
|
|
83
|
+
|
|
84
|
+
- Best used at the root level of the application
|
|
85
|
+
|
|
86
|
+
- Avoid nested scroll containers
|
|
87
|
+
|
|
88
|
+
- Not suitable for touch-based scrolling
|
|
89
|
+
|
|
90
|
+
- Desktop browsers only
|