react-variable-height-infinite-scroller
Advanced tools
Comparing version
@@ -0,1 +1,15 @@ | ||
v3.3.0 - Sat, 02 Jan 2016 08:15:40 GMT | ||
-------------------------------------- | ||
v3.2.0 - Sat, 02 Jan 2016 08:15:00 GMT | ||
-------------------------------------- | ||
- [8be1599](../../commit/8be1599) [fixed] findDomNode call, upgraded deps | ||
v3.1.1 - Tue, 27 Oct 2015 17:56:13 GMT | ||
@@ -2,0 +16,0 @@ -------------------------------------- |
@@ -42,2 +42,3 @@ import React from 'react'; | ||
fakeRows: newFakeRows, | ||
rowToJumpTo: {row: 9}, | ||
newRowToJumpTo: {row: 9}, | ||
@@ -44,0 +45,0 @@ }); |
@@ -42,2 +42,3 @@ import React from 'react'; | ||
fakeRows: newFakeRows, | ||
rowToJumpTo: {row: 9}, | ||
newRowToJumpTo: {row: 9}, | ||
@@ -44,0 +45,0 @@ }); |
14
index.js
@@ -11,2 +11,6 @@ 'use strict'; | ||
var _reactDom = require('react-dom'); | ||
var _reactDom2 = _interopRequireDefault(_reactDom); | ||
var _validateIoNonnegativeIntegerArray = require('validate.io-nonnegative-integer-array'); | ||
@@ -51,3 +55,3 @@ | ||
var infiniteContainer = event.currentTarget; | ||
var visibleRowsContainer = _react2['default'].findDOMNode(this.refs.visibleRowsContainer); | ||
var visibleRowsContainer = _reactDom2['default'].findDOMNode(this.refs.visibleRowsContainer); | ||
// const currentAverageElementHeight = (visibleRowsContainer.getBoundingClientRect().height / this.state.visibleRows.length); | ||
@@ -107,3 +111,3 @@ this.oldRowStart = this.rowStart; | ||
componentWillUpdate: function componentWillUpdate() { | ||
var visibleRowsContainer = _react2['default'].findDOMNode(this.refs.visibleRowsContainer); | ||
var visibleRowsContainer = _reactDom2['default'].findDOMNode(this.refs.visibleRowsContainer); | ||
this.soonToBeRemovedRowElementHeights = 0; | ||
@@ -136,4 +140,4 @@ this.numberOfRowsAddedToTop = 0; | ||
// make the replacements | ||
var infiniteContainer = _react2['default'].findDOMNode(this.refs.infiniteContainer); | ||
var visibleRowsContainer = _react2['default'].findDOMNode(this.refs.visibleRowsContainer); | ||
var infiniteContainer = _reactDom2['default'].findDOMNode(this.refs.infiniteContainer); | ||
var visibleRowsContainer = _reactDom2['default'].findDOMNode(this.refs.visibleRowsContainer); | ||
if (this.soonToBeRemovedRowElementHeights) { | ||
@@ -259,3 +263,3 @@ infiniteContainer.scrollTop = infiniteContainer.scrollTop + this.soonToBeRemovedRowElementHeights; | ||
getVisibleRowsContainerDomNode: function getVisibleRowsContainerDomNode() { | ||
return _react2['default'].findDOMNode(this.refs.visibleRowsContainer); | ||
return _reactDom2['default'].findDOMNode(this.refs.visibleRowsContainer); | ||
}, | ||
@@ -262,0 +266,0 @@ |
import React, { PropTypes } from 'react'; | ||
import ReactDOM from 'react-dom'; | ||
import areNonNegativeIntegers from 'validate.io-nonnegative-integer-array'; | ||
@@ -37,3 +38,3 @@ | ||
let infiniteContainer = event.currentTarget; | ||
const visibleRowsContainer = React.findDOMNode(this.refs.visibleRowsContainer); | ||
const visibleRowsContainer = ReactDOM.findDOMNode(this.refs.visibleRowsContainer); | ||
// const currentAverageElementHeight = (visibleRowsContainer.getBoundingClientRect().height / this.state.visibleRows.length); | ||
@@ -93,3 +94,3 @@ this.oldRowStart = this.rowStart; | ||
componentWillUpdate() { | ||
let visibleRowsContainer = React.findDOMNode(this.refs.visibleRowsContainer); | ||
let visibleRowsContainer = ReactDOM.findDOMNode(this.refs.visibleRowsContainer); | ||
this.soonToBeRemovedRowElementHeights = 0; | ||
@@ -122,4 +123,4 @@ this.numberOfRowsAddedToTop = 0; | ||
// make the replacements | ||
let infiniteContainer = React.findDOMNode(this.refs.infiniteContainer); | ||
let visibleRowsContainer = React.findDOMNode(this.refs.visibleRowsContainer); | ||
let infiniteContainer = ReactDOM.findDOMNode(this.refs.infiniteContainer); | ||
let visibleRowsContainer = ReactDOM.findDOMNode(this.refs.visibleRowsContainer); | ||
if (this.soonToBeRemovedRowElementHeights) { | ||
@@ -244,3 +245,3 @@ infiniteContainer.scrollTop = infiniteContainer.scrollTop + this.soonToBeRemovedRowElementHeights; | ||
getVisibleRowsContainerDomNode() { | ||
return React.findDOMNode(this.refs.visibleRowsContainer); | ||
return ReactDOM.findDOMNode(this.refs.visibleRowsContainer); | ||
}, | ||
@@ -247,0 +248,0 @@ |
{ | ||
"name": "react-variable-height-infinite-scroller", | ||
"version": "3.1.1", | ||
"version": "3.3.0", | ||
"description": "variable row height scroller that renders just the visible rows with no precomputation of row-height necessary", | ||
@@ -38,2 +38,6 @@ "main": "index.js", | ||
}, | ||
"peerDependencies": { | ||
"react": "^0.14.5", | ||
"react-dom": "^0.14.5" | ||
}, | ||
"devDependencies": { | ||
@@ -49,3 +53,4 @@ "babel-core": "^5.8.23", | ||
"mt-changelog": "^0.6.1", | ||
"react": "^0.13.3", | ||
"react": "^0.14.5", | ||
"react-dom": "^0.14.5", | ||
"react-tools": "^0.13.3", | ||
@@ -52,0 +57,0 @@ "reactify": "^1.1.1", |
@@ -19,2 +19,12 @@ # react-variable-height-infinite-scroller | ||
``` | ||
<InfiniteScroller | ||
averageElementHeight={100} // this is a guess you make! | ||
containerHeight={600} | ||
rowToJumpTo={rowToJumpTo} // (optional) set this if you want to start/jump to a a particular row. Must be passed as a new object each time to allow for difference checking | ||
renderRow={renderRow} // function to render a row | ||
totalNumberOfRows={fakeRows.length} // an array of data for your rows | ||
/> | ||
``` | ||
## Props | ||
@@ -24,11 +34,12 @@ | ||
| :--- |:---:| :---| | ||
| averageElementHeight `number` | *(optional)* 100 | This is a guess you make of what is the average height. This is used to approximate number of rows when rendering more or less rows | | ||
| containerHeight `number` | __required__ | Maximum height of the scroll container | | ||
| totalNumberOfRows `number` | __required__ | Length of the data array | | ||
| renderRow `function` | __required__ | Function to render a row | | ||
| averageElementHeight `number` | *(optional)* 100 | This is a guess you make of what the average row height will be height. This is used to approximate how far to move the scrollbar | | ||
| rowToJumpTo | *(optional)* 0 | Object of shape `{ row: Number }`. Row you want to start with or jump to. Must be passed as a new object each time to allow for difference checking | | ||
| jumpToBottomOfRow `boolean` | *(optional)* false | By default jumping to a row jumps to the top. Set to true if you want to jump to the bottom of the row | | ||
| containerClassName `string` | *(optional)* infiniteContainer | className to apply on container | | ||
| onScroll `function` | *(optional)* no-op | Hook to call on scroll | ||
| jumpToBottomOfRow `boolean` | *(optional)* false | By default jumping to a row jumps to the top. Set to true if you want to jump to the bottom of the row | ||
| onScroll `function` | *(optional)* no-op | Hook to call on scroll | | ||
Taken from the demo code: | ||
@@ -35,0 +46,0 @@ |
Sorry, the diff of this file is too big to display
753115
5.99%17
6.25%138
8.66%3
200%16
6.67%18838
-3.24%