Skip to content

Commit f79ce05

Browse files
authored
Add props and options table
1 parent ffe8420 commit f79ce05

File tree

1 file changed

+12
-9
lines changed

1 file changed

+12
-9
lines changed

README.md

+12-9
Original file line numberDiff line numberDiff line change
@@ -70,16 +70,19 @@ export default ({ items, fetchMoreItems }) => <div>
7070
- The wrapped component must be a Class-based component, not a functional one, because `Autoscroll` uses a `ref`.
7171
- This package is agnostic about any CSS you use. However, it assumes that you provide the adequate CSS to make the wrapped component have a scroll bar. (ie. `overflow-y:scroll;` and a set `height`)
7272

73-
## options
73+
## props
74+
75+
The `autoscroll` higher-order-component supports the followig props
7476

75-
Optional props:
77+
|name|default|description|
78+
|-|-|-|
79+
|OnScrolled|`undefined`|called without arguments whenever the list is scrolled|
80+
|OnScrolledTop|`undefined`|called without arguments whenever the list is scrolled to the top|
7681

77-
- `onScrolled`: called whenever the list is scrolled. This is not an event listener.
78-
- `onScrolledTop`: called when the list is scrolled to the top.
79-
Pass these props when rendering the wrapped list component.
82+
## options
8083

81-
`autoscroll(Component, { isScrolledDownThreshold: 150 /*default*/})`
84+
When creating a component by calling the `autoscroll` higher-order-component, an options object can be passed in as the second argument. It may contain the following keys:
8285

83-
The `isScrolledDownThreshold` option is used when determining whether the user has scrolled back to the bottom. If the element's `scrollBottom` is within `isScrolledDownThreshold`px of the maximum scroll (`scrollHeight`), the component will scroll down on the next updates.
84-
This option exists because scrolling almost all the way down, but not entirely, can be interpreted as a sign that the user intends to see the bottom of the list.
85-
Set it to 0 to enforce scrolling all the way down.
86+
|name|default|description|
87+
|-|-|-|
88+
|isScrolledDownThreshold|150(px)|Used when determining whether the user has scrolled back to the bottom. If the element's `scrollBottom` is within `isScrolledDownThreshold`px of the maximum scroll (`scrollHeight`), the component will scroll down on the next updates. This option exists because scrolling almost all the way down, but not entirely, can be interpreted as a sign that the user intends to see the bottom of the list. Set it to 0 to enforce scrolling all the way down. |

0 commit comments

Comments
 (0)