File tree 6 files changed +39
-13
lines changed
6 files changed +39
-13
lines changed Original file line number Diff line number Diff line change 25
25
.item {
26
26
border-bottom : 1px solid # eee ;
27
27
padding : 0.5rem ;
28
+ box-sizing : border-box;
28
29
}
29
30
.item : hover {
30
31
background-color : # eee ;
Original file line number Diff line number Diff line change @@ -4,7 +4,9 @@ function rowRenderer (params) {
4
4
return React . createElement (
5
5
'div' ,
6
6
{
7
- className : 'item'
7
+ className : 'item' ,
8
+ key : params . key ,
9
+ style : params . style
8
10
} ,
9
11
React . createElement (
10
12
'strong' ,
@@ -17,13 +19,13 @@ function rowRenderer (params) {
17
19
}
18
20
19
21
function cellRenderer ( params ) {
20
- return rowRenderer ( {
21
- index : params . rowIndex
22
- } )
22
+ params . index = params . rowIndex
23
+
24
+ return rowRenderer ( params )
23
25
}
24
26
25
27
var cellMeasurer
26
- var virtualScroll
28
+ var list
27
29
var mostRecentWidth
28
30
29
31
var App = React . createClass ( {
@@ -39,7 +41,7 @@ var App = React.createClass({
39
41
function ( autoSizerParams ) {
40
42
if ( mostRecentWidth && mostRecentWidth !== autoSizerParams . width ) {
41
43
cellMeasurer . resetMeasurements ( )
42
- virtualScroll . recomputeRowHeights ( )
44
+ list . recomputeRowHeights ( )
43
45
}
44
46
45
47
mostRecentWidth = autoSizerParams . width
@@ -62,7 +64,7 @@ var App = React.createClass({
62
64
className : 'chat' ,
63
65
height : autoSizerParams . height ,
64
66
ref : function ( ref ) {
65
- virtualScroll = ref
67
+ list = ref
66
68
} ,
67
69
rowCount : chatHistory . length ,
68
70
rowHeight : cellMeasurerParams . getRowHeight ,
Original file line number Diff line number Diff line change 1
1
function 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
+ )
3
11
}
4
12
5
13
var App = React . createClass ( {
Original file line number Diff line number Diff line change @@ -18,16 +18,22 @@ function cellRenderer (params) {
18
18
return React . DOM . input ( {
19
19
className : 'input' ,
20
20
defaultValue : key ,
21
- onChange : function ( ) { }
21
+ key : params . key ,
22
+ onChange : function ( ) { } ,
23
+ style : params . style
22
24
} )
23
25
case 1 :
24
26
return React . DOM . button ( {
25
- className : 'button'
27
+ className : 'button' ,
28
+ key : params . key ,
29
+ style : params . style
26
30
} , key )
27
31
case 2 :
28
32
return React . DOM . img ( {
29
33
className : 'image' ,
30
- src : REACT_VIRTUALIZED_BANNER
34
+ key : params . key ,
35
+ src : REACT_VIRTUALIZED_BANNER ,
36
+ style : params . style
31
37
} )
32
38
}
33
39
}
Original file line number Diff line number Diff line change @@ -42,14 +42,15 @@ var App = React.createClass({
42
42
43
43
return React . DOM . div ( {
44
44
className : className ,
45
+ key : params . key ,
45
46
onMouseOver : function ( ) {
46
47
setState ( {
47
48
hoveredColumnIndex : columnIndex ,
48
49
hoveredRowIndex : rowIndex
49
50
} )
50
51
grid . forceUpdate ( )
51
52
} ,
52
-
53
+ style : params . style
53
54
} , key )
54
55
}
55
56
} )
Original file line number Diff line number Diff line change @@ -58,7 +58,15 @@ function setRef (ref) {
58
58
}
59
59
60
60
function 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
+ )
62
70
}
63
71
64
72
function rowHeight ( params ) {
You can’t perform that action at this time.
0 commit comments