@@ -14,16 +14,16 @@ const GUTTER_SIZE = 3
14
14
const CELL_WIDTH = 75
15
15
16
16
export default class CollectionExample extends Component {
17
- static propTypes = {
17
+ static contextTypes = {
18
18
list : PropTypes . instanceOf ( Immutable . List ) . isRequired
19
- }
19
+ } ;
20
20
21
21
constructor ( props , context ) {
22
22
super ( props , context )
23
23
24
24
this . state = {
25
- cellCount : props . list . size ,
26
- columnCount : this . _getColumnCount ( props . list . size ) ,
25
+ cellCount : context . list . size ,
26
+ columnCount : this . _getColumnCount ( context . list . size ) ,
27
27
height : 300 ,
28
28
horizontalOverscanSize : 0 ,
29
29
scrollToCell : undefined ,
@@ -47,7 +47,7 @@ export default class CollectionExample extends Component {
47
47
const { cellCount, height, horizontalOverscanSize, scrollToCell, showScrollingPlaceholder, verticalOverscanSize } = this . state
48
48
49
49
return (
50
- < ContentBox { ... this . props } >
50
+ < ContentBox >
51
51
< ContentBoxHeader
52
52
text = 'Collection'
53
53
sourceLink = 'https://github.com/bvaughn/react-virtualized/blob/master/source/Collection/Collection.example.js'
@@ -131,7 +131,7 @@ export default class CollectionExample extends Component {
131
131
}
132
132
133
133
_cellRenderer ( { index, isScrolling, key, style } ) {
134
- const { list } = this . props
134
+ const { list } = this . context
135
135
const { showScrollingPlaceholder } = this . state
136
136
137
137
const datum = list . get ( index % list . size )
@@ -151,7 +151,7 @@ export default class CollectionExample extends Component {
151
151
}
152
152
153
153
_cellSizeAndPositionGetter ( { index } ) {
154
- const { list } = this . props
154
+ const { list } = this . context
155
155
const { columnCount } = this . state
156
156
157
157
const columnPosition = index % ( columnCount || 1 )
0 commit comments