Skip to content

Commit 5892a59

Browse files
authored
Merge pull request #9 from olarsson/fixes
custom scrolling improvements
2 parents aaf8bc6 + b8f58f3 commit 5892a59

File tree

9 files changed

+176
-170
lines changed

9 files changed

+176
-170
lines changed

README.md

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# react-scrollsy v1.1.12 ![](https://img.badgesize.io/olarsson/react-scrollsy/master/dist/react-scrollsy.es.js)
1+
# react-scrollsy v1.2 ![](https://img.badgesize.io/olarsson/react-scrollsy/master/dist/react-scrollsy.es.js)
22

33
An ambitious light-weight react module written in TypeScript for tracking scroll progress in a performant way. Developed for use with spring based animation libraries such as react-spring, but can be used with or without any library.
44

@@ -115,7 +115,7 @@ Configuration and properties:
115115

116116
- `scrollThrottle` - (number) throttles the recalculations to this value in ms when the element is scrolled.
117117
- `resizeThrottle` - (number) throttles the recalculations to this value in ms when the element is resized.
118-
- `scrollingElement` - (string, required) the selector for the main scrollable element to track scroll progress of.
118+
- `scrollingElement` - (string/ref, required) the selector for the main scrollable element to track scroll progress of.
119119

120120
Creates a function which returns a `scrollData` object as such:
121121

@@ -128,8 +128,9 @@ Creates a function which returns a `scrollData` object as such:
128128

129129
```js
130130
<ScrollTrackerCustom
131-
key={active.toString()} // forces a rerender of the tracker, use this if you for example hide the element with 'display: none'
132-
scrollingElement='#custom-scroll-container'>
131+
key={active.toString()} // forces a rerender of the tracker, use this if you for example hide the element with 'display: none' combined with a string based scrollingElement selector
132+
scrollingElement='#custom-scroll-container' // this can also be a ref such as scrollingElement={scrollRef}
133+
>
133134
{({ scrollData }: ScrollData) => {
134135
return (
135136
// ScrollTracker components and other components can go inside here
@@ -210,4 +211,3 @@ If it still doesnt work then change the import string in the following fashion:
210211
### Todo
211212

212213
- [ ] Implement the scroll logic for horizontal scrolling
213-
- [ ] Refactor the ScrollTrackerCustom to handle both React refs and HTML elements

0 commit comments

Comments
 (0)