Comparing version 0.0.1 to 0.0.2
{ | ||
"name": "react-8", | ||
"version": "0.0.1", | ||
"version": "0.0.2", | ||
"description": "Simple infinite scrolling for React", | ||
"main": "build/react-inf.js", | ||
"main": "build/react-8.js", | ||
"scripts": { | ||
@@ -12,3 +12,3 @@ "build": "webpack && webpack -p --minify", | ||
"type": "git", | ||
"url": "git+https://github.com/vahagnaharonian/react-infinity.git" | ||
"url": "git+https://github.com/vahagnaharonian/react-8.git" | ||
}, | ||
@@ -15,0 +15,0 @@ "keywords": [ |
@@ -13,3 +13,3 @@ #React 8 *(infinity)* | ||
import React from 'react'; | ||
import Infinity from 'react-8'; | ||
import InfiniteScroll from 'react-8'; | ||
@@ -24,7 +24,7 @@ class MyAwesomeComponent extends React.Component { | ||
return ( | ||
<Infinity | ||
<InfiniteScroll | ||
onNewData={this.handleNewData.bind(this)} | ||
style={{ height: 100, overflowY: 'auto' }}> | ||
{ this.generateContent(count) } | ||
</Inf> | ||
</InfiniteScroll> | ||
); | ||
@@ -45,2 +45,20 @@ } | ||
**soon** | ||
The API of the component is incredibly simple. There are just 3 properties to pass (including children). | ||
The component will just wrap the passed children in a `<div>`, without any styles or properties, just the necessary event listeners. You need to define styles for scrolling by yourself. All component properties are passed to that `<div>`. | ||
--- | ||
Here are the properties the component uses: | ||
####onNewData: function *(required)* | ||
This function will be called when new data is needed. The function simply needs to get data and append to the children. Though there are two special behaviors: | ||
1. Function returning `false` indicates that there is no more data and the component will not try to get any more. | ||
2. If function is defined with one parameter (eg. `onNewData = (done) => ...`), the component implies that it's a async call and will wait for it to finish before trying to get more data. The passed parameter is a function which needs to be called for the component to know that the process is over. | ||
* If the callback is called with `false` as argument (`done(false)`), component's behavior will be disabled. | ||
####offsetRatio: number *(default=0.5)* | ||
The offset when the function will be called to get new data to display. The provided number is multiplied by actual component height. For example, if the component height is 300 and *offsetRatio* is `0.5` the callback will be called as soon as the scrollbar enters the last 150 pixels of the whole scroll length. |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
14883
62