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