@@ -127,25 +127,6 @@ class List<T> extends React.Component<ListProps<T>, ListState> {
127
127
getItemKey : this . getItemKey ,
128
128
} ) ;
129
129
130
- // TODO: REMOVE ME
131
- const locatedItemRelativeTop = getItemRelativeTop ( {
132
- itemIndex,
133
- itemOffsetPtg,
134
- itemElementHeights : this . itemElementHeights ,
135
- scrollPtg : getElementScrollPercentage ( this . listRef . current ) ,
136
- clientHeight : this . listRef . current . clientHeight ,
137
- getItemKey : this . getItemKey ,
138
- } ) ;
139
- console . warn ( 'MEASURE:::' , this . getItemKey ( itemIndex ) , locatedItemRelativeTop ) ;
140
- console . warn (
141
- ' ->' ,
142
- itemIndex ,
143
- itemOffsetPtg ,
144
- this . itemElementHeights ,
145
- getElementScrollPercentage ( this . listRef . current ) ,
146
- this . listRef . current . clientHeight ,
147
- ) ;
148
-
149
130
let startItemTop = locatedItemTop ;
150
131
for ( let index = itemIndex - 1 ; index >= startIndex ; index -= 1 ) {
151
132
startItemTop -= this . itemElementHeights [ this . getItemKey ( index ) ] || 0 ;
@@ -181,26 +162,6 @@ class List<T> extends React.Component<ListProps<T>, ListState> {
181
162
getItemKey : ( index : number ) => this . getItemKey ( index , prevProps ) ,
182
163
} ) ;
183
164
184
- console . log (
185
- '1. Origin Located:' ,
186
- originItemIndex ,
187
- originItemOffsetPtg ,
188
- this . getItemKey ( originItemIndex , prevProps ) ,
189
- originLocatedItemRelativeTop ,
190
- ) ;
191
- console . warn (
192
- ' -> ' ,
193
- originItemIndex ,
194
- originItemOffsetPtg ,
195
- this . itemElementHeights ,
196
- getScrollPercentage ( {
197
- scrollTop : originScrollTop ,
198
- scrollHeight : prevProps . dataSource . length * itemHeight ,
199
- clientHeight : this . listRef . current . clientHeight ,
200
- } ) ,
201
- this . listRef . current . clientHeight ,
202
- ) ;
203
-
204
165
// 2. Find the compare item
205
166
const removedItemIndex : number = prevProps . dataSource . findIndex ( ( _ , index ) => {
206
167
const key = this . getItemKey ( index , prevProps ) ;
@@ -211,8 +172,6 @@ class List<T> extends React.Component<ListProps<T>, ListState> {
211
172
if ( originCompareItemIndex < 0 ) {
212
173
originCompareItemIndex = 0 ;
213
174
}
214
- const compareItemKey = this . getItemKey ( originCompareItemIndex , prevProps ) ;
215
- console . log ( '2. Compare Item:' , compareItemKey ) ;
216
175
217
176
// 3. Find the compare item top
218
177
const originCompareItemTop = getCompareItemRelativeTop ( {
@@ -225,8 +184,6 @@ class List<T> extends React.Component<ListProps<T>, ListState> {
225
184
itemElementHeights : this . itemElementHeights ,
226
185
} ) ;
227
186
228
- console . log ( '3. Compare Item Top:' , originCompareItemTop ) ;
229
-
230
187
// 4. Find the best match compare item top
231
188
let bestSimilarity = Number . MAX_VALUE ;
232
189
let bestScrollTop : number = null ;
@@ -270,14 +227,9 @@ class List<T> extends React.Component<ListProps<T>, ListState> {
270
227
itemElementHeights : this . itemElementHeights ,
271
228
} ) ;
272
229
273
- // console.log('4.1 ScrollTop:', scrollTop, 'CompareTop:', compareItemTop);
274
-
275
230
// 4.2 Find best match compare item top
276
231
const similarity = Math . abs ( compareItemTop - originCompareItemTop ) ;
277
232
if ( similarity < bestSimilarity ) {
278
- console . log ( '4.2 Winner:' , scrollTop , compareItemTop . toFixed ( 2 ) ) ;
279
- console . log ( ' -> ' , similarity . toFixed ( 2 ) , bestSimilarity . toFixed ( 2 ) ) ;
280
-
281
233
bestSimilarity = similarity ;
282
234
bestScrollTop = scrollTop ;
283
235
bestItemIndex = itemIndex ;
@@ -290,17 +242,6 @@ class List<T> extends React.Component<ListProps<T>, ListState> {
290
242
291
243
// 5. Re-scroll if has best scroll match
292
244
if ( bestScrollTop !== null ) {
293
- console . log (
294
- '5. Find best match:' ,
295
- bestScrollTop ,
296
- 'Located:' ,
297
- bestItemIndex ,
298
- bestItemOffsetPtg ,
299
- 'Range:' ,
300
- bestStartIndex ,
301
- bestEndIndex ,
302
- ) ;
303
-
304
245
this . lockScroll = true ;
305
246
this . listRef . current . scrollTop = bestScrollTop ;
306
247
0 commit comments