@@ -14,9 +14,15 @@ class List extends PureComponent {
1414 initialIndex : PropTypes . number ,
1515 items ( props , propName ) {
1616 const object = props [ propName ] ;
17- if ( object != null && ! ( Array . isArray ( object ) || typeof object [ Symbol . iterator ] === 'function' ) ) {
17+ if (
18+ object != null &&
19+ ! (
20+ Array . isArray ( object ) ||
21+ typeof object [ Symbol . iterator ] === 'function'
22+ )
23+ ) {
1824 return new Error (
19- `\`${ propName } \` must be of type Array or a native type implementing the iterable interface` ,
25+ `\`${ propName } \` must be of type Array or a native type implementing the iterable interface`
2026 ) ;
2127 }
2228 return undefined ;
@@ -66,13 +72,19 @@ class List extends PureComponent {
6672 this . prematureIntersectionChecked = this . state . size === 0 ;
6773 }
6874
69- setRef = callback => {
75+ setRef = ( callback ) => {
7076 let prevRootNode ;
71- this . setRootNode = node => {
77+ this . setRootNode = ( node ) => {
7278 if ( node !== prevRootNode ) {
7379 prevRootNode = node ;
74- const overflow = window . getComputedStyle ( node ) [ AXIS_CSS_MAP [ this . props . axis ] ] ;
75- callback ( [ 'auto' , 'scroll' , 'overlay' ] . indexOf ( overflow ) !== - 1 ? node : null ) ;
80+ const overflow = window . getComputedStyle ( node ) [
81+ AXIS_CSS_MAP [ this . props . axis ]
82+ ] ;
83+ callback (
84+ [ 'auto' , 'scroll' , 'overlay' ] . indexOf ( overflow ) !== - 1
85+ ? node
86+ : null
87+ ) ;
7688 }
7789 } ;
7890 } ;
@@ -87,7 +99,7 @@ class List extends PureComponent {
8799 ! isIntersecting ,
88100 'ReactIntersectionList: the sentinel detected a viewport with a bigger size than the size of its items. ' +
89101 'This could lead to detrimental behavior, e.g.: triggering more than one onIntersection callback at the start.\n' +
90- 'To prevent this, use either a bigger `pageSize` value or avoid using the prop awaitMore initially.' ,
102+ 'To prevent this, use either a bigger `pageSize` value or avoid using the prop awaitMore initially.'
91103 ) ;
92104 }
93105
@@ -112,18 +124,26 @@ class List extends PureComponent {
112124
113125 warning (
114126 ! ( hasChildren && hasRender ) ,
115- 'ReactIntersectionList: cannot use children and renderItem props as render function at the same time.' ,
127+ 'ReactIntersectionList: cannot use children and renderItem props as render function at the same time.'
116128 ) ;
117129
118130 if ( hasChildren ) {
119131 return children ;
120132 }
121133
122- return hasRender ? renderItem : ( index , key ) => < div key = { key } > { index } </ div > ;
134+ return hasRender
135+ ? renderItem
136+ : ( index , key ) => < div key = { key } > { index } </ div > ;
123137 }
124138
125139 renderItems ( ) {
126- const { awaitMore, axis, initialIndex, itemsRenderer, threshold } = this . props ;
140+ const {
141+ awaitMore,
142+ axis,
143+ initialIndex,
144+ itemsRenderer,
145+ threshold,
146+ } = this . props ;
127147 const { size, itemCount } = this . state ;
128148 const itemRenderer = this . getItemRenderer ( ) ;
129149 const items = [ ] ;
@@ -150,7 +170,7 @@ class List extends PureComponent {
150170 }
151171 }
152172
153- return itemsRenderer ( items , node => {
173+ return itemsRenderer ( items , ( node ) => {
154174 if ( node && sentinel ) {
155175 this . setRootNode ( node ) ;
156176 }
0 commit comments