An universal scroll component for React
npm i reactscroller --save
and then you can(ES6):
import ReactScoller from "reactscroller";
or:
var ReactScoller = require("reactscroller");
You can visit ReactScrollerExample to find more details for usage.
The following is a list of incoming properties:
property | Optional | Default | description | type |
---|---|---|---|---|
containerHeight | Necessary | null | The height for the outer container to scroll | String | Number |
containerWidth | Optional | 100% | The width for the outer container to scroll | String | Number |
refresh | Optional | null | The function for pull down to refresh | Function |
loadMore | Optional | null | The function for scroll up to load more | Function |
lowerBound | Optional | 50 | The distance to the bottom when trigger the function loadmore | Number |
refreshTip | Necessary | null | The refreshTip for the different stages of refreshing(a property of this.state is better. It should be changed) |
String or Component |
loadMoreTip | Necessary | null | The loadmoreTip for the different stages of loading more (a property of this.state is better. It should be changed) |
String or Component |
showRefresh | Necessary | null | Whether the refreshTip should be displayed | bool |
showLoadMore | Necessary | null | Whether the loadMoreTip should be displayed | bool |
I peeled off the core module and the presentation module during the coding phase. So you can use the ReactScrollerCore
to make more customization.
import {ReactScrollerCore} from "reactscroller";
I continue thinking and testing, if you have some good ideas please visit issues
MIT