@@ -87,7 +87,11 @@ export default class InfiniteScroll extends Component {
87
87
88
88
componentWillReceiveProps ( props ) {
89
89
// do nothing when dataLength and key are unchanged
90
- if ( this . props . key === props . key && this . props . dataLength === props . dataLength ) return ;
90
+ if (
91
+ this . props . key === props . key &&
92
+ this . props . dataLength === props . dataLength
93
+ )
94
+ return ;
91
95
92
96
this . actionTriggered = false ;
93
97
// update state when new data was sent in
@@ -98,8 +102,9 @@ export default class InfiniteScroll extends Component {
98
102
}
99
103
100
104
getScrollableTarget ( ) {
101
- if ( this . props . scrollableTarget instanceof HTMLElement ) return this . props . scrollableTarget ;
102
- if ( typeof this . props . scrollableTarget === 'string' ) {
105
+ if ( this . props . scrollableTarget instanceof HTMLElement )
106
+ return this . props . scrollableTarget ;
107
+ if ( typeof this . props . scrollableTarget === "string" ) {
103
108
return document . getElementById ( this . props . scrollableTarget ) ;
104
109
}
105
110
if ( this . props . scrollableTarget === null ) {
@@ -119,7 +124,8 @@ export default class InfiniteScroll extends Component {
119
124
this . currentY = this . startY ;
120
125
121
126
this . _infScroll . style . willChange = "transform" ;
122
- this . _infScroll . style . transition = `transform 0.2s cubic-bezier(0,0,0.31,1)` ;
127
+ this . _infScroll . style . transition =
128
+ "transform 0.2s cubic-bezier(0,0,0.31,1)" ;
123
129
}
124
130
125
131
onMove ( evt ) {
@@ -143,7 +149,7 @@ export default class InfiniteScroll extends Component {
143
149
this . startY } px, 0px)`;
144
150
}
145
151
146
- onEnd ( evt ) {
152
+ onEnd ( ) {
147
153
this . startY = 0 ;
148
154
this . currentY = 0 ;
149
155
@@ -156,9 +162,9 @@ export default class InfiniteScroll extends Component {
156
162
requestAnimationFrame ( ( ) => {
157
163
// this._infScroll
158
164
if ( this . _infScroll ) {
159
- this . _infScroll . style . overflow = "auto" ;
160
- this . _infScroll . style . transform = "none" ;
161
- this . _infScroll . style . willChange = "none" ;
165
+ this . _infScroll . style . overflow = "auto" ;
166
+ this . _infScroll . style . transform = "none" ;
167
+ this . _infScroll . style . willChange = "none" ;
162
168
}
163
169
} ) ;
164
170
}
@@ -178,7 +184,8 @@ export default class InfiniteScroll extends Component {
178
184
}
179
185
180
186
return (
181
- target . scrollTop + clientHeight >= threshold . value / 100 * target . scrollHeight
187
+ target . scrollTop + clientHeight >=
188
+ ( threshold . value / 100 ) * target . scrollHeight
182
189
) ;
183
190
}
184
191
@@ -193,8 +200,8 @@ export default class InfiniteScroll extends Component {
193
200
this . props . height || this . _scrollableNode
194
201
? event . target
195
202
: document . documentElement . scrollTop
196
- ? document . documentElement
197
- : document . body ;
203
+ ? document . documentElement
204
+ : document . body ;
198
205
199
206
// return immediately if the action has already been triggered,
200
207
// prevents multiple triggers.
@@ -232,7 +239,7 @@ export default class InfiniteScroll extends Component {
232
239
return (
233
240
< div style = { outerDivStyle } >
234
241
< div
235
- className = { `infinite-scroll-component ${ this . props . className || '' } ` }
242
+ className = { `infinite-scroll-component ${ this . props . className || "" } ` }
236
243
ref = { infScroll => ( this . _infScroll = infScroll ) }
237
244
style = { style }
238
245
>
0 commit comments