File tree Expand file tree Collapse file tree 6 files changed +39
-13
lines changed
Expand file tree Collapse file tree 6 files changed +39
-13
lines changed Original file line number Diff line number Diff line change 2525 .item {
2626 border-bottom : 1px solid # eee ;
2727 padding : 0.5rem ;
28+ box-sizing : border-box;
2829 }
2930 .item : hover {
3031 background-color : # eee ;
Original file line number Diff line number Diff line change @@ -4,7 +4,9 @@ function rowRenderer (params) {
44 return React . createElement (
55 'div' ,
66 {
7- className : 'item'
7+ className : 'item' ,
8+ key : params . key ,
9+ style : params . style
810 } ,
911 React . createElement (
1012 'strong' ,
@@ -17,13 +19,13 @@ function rowRenderer (params) {
1719}
1820
1921function cellRenderer ( params ) {
20- return rowRenderer ( {
21- index : params . rowIndex
22- } )
22+ params . index = params . rowIndex
23+
24+ return rowRenderer ( params )
2325}
2426
2527var cellMeasurer
26- var virtualScroll
28+ var list
2729var mostRecentWidth
2830
2931var App = React . createClass ( {
@@ -39,7 +41,7 @@ var App = React.createClass({
3941 function ( autoSizerParams ) {
4042 if ( mostRecentWidth && mostRecentWidth !== autoSizerParams . width ) {
4143 cellMeasurer . resetMeasurements ( )
42- virtualScroll . recomputeRowHeights ( )
44+ list . recomputeRowHeights ( )
4345 }
4446
4547 mostRecentWidth = autoSizerParams . width
@@ -62,7 +64,7 @@ var App = React.createClass({
6264 className : 'chat' ,
6365 height : autoSizerParams . height ,
6466 ref : function ( ref ) {
65- virtualScroll = ref
67+ list = ref
6668 } ,
6769 rowCount : chatHistory . length ,
6870 rowHeight : cellMeasurerParams . getRowHeight ,
Original file line number Diff line number Diff line change 11function cellRenderer ( params ) {
2- return params . columnIndex
2+ return React . createElement (
3+ 'div' ,
4+ {
5+ className : 'item' ,
6+ key : params . key ,
7+ style : params . style
8+ } ,
9+ params . columnIndex
10+ )
311}
412
513var App = React . createClass ( {
Original file line number Diff line number Diff line change @@ -18,16 +18,22 @@ function cellRenderer (params) {
1818 return React . DOM . input ( {
1919 className : 'input' ,
2020 defaultValue : key ,
21- onChange : function ( ) { }
21+ key : params . key ,
22+ onChange : function ( ) { } ,
23+ style : params . style
2224 } )
2325 case 1 :
2426 return React . DOM . button ( {
25- className : 'button'
27+ className : 'button' ,
28+ key : params . key ,
29+ style : params . style
2630 } , key )
2731 case 2 :
2832 return React . DOM . img ( {
2933 className : 'image' ,
30- src : REACT_VIRTUALIZED_BANNER
34+ key : params . key ,
35+ src : REACT_VIRTUALIZED_BANNER ,
36+ style : params . style
3137 } )
3238 }
3339}
Original file line number Diff line number Diff line change @@ -42,14 +42,15 @@ var App = React.createClass({
4242
4343 return React . DOM . div ( {
4444 className : className ,
45+ key : params . key ,
4546 onMouseOver : function ( ) {
4647 setState ( {
4748 hoveredColumnIndex : columnIndex ,
4849 hoveredRowIndex : rowIndex
4950 } )
5051 grid . forceUpdate ( )
5152 } ,
52-
53+ style : params . style
5354 } , key )
5455 }
5556} )
Original file line number Diff line number Diff line change @@ -58,7 +58,15 @@ function setRef (ref) {
5858}
5959
6060function cellRenderer ( params ) {
61- return renderItem ( data [ params . index ] , params . index )
61+ var renderedCell = renderItem ( data [ params . index ] , params . index )
62+
63+ return React . DOM . ul (
64+ {
65+ key : params . key ,
66+ style : params . style
67+ } ,
68+ renderedCell
69+ )
6270}
6371
6472function rowHeight ( params ) {
You can’t perform that action at this time.
0 commit comments