Skip to content

Commit 45de90a

Browse files
committed
clean up
1 parent f6c916e commit 45de90a

File tree

1 file changed

+0
-59
lines changed

1 file changed

+0
-59
lines changed

src/List.tsx

Lines changed: 0 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -127,25 +127,6 @@ class List<T> extends React.Component<ListProps<T>, ListState> {
127127
getItemKey: this.getItemKey,
128128
});
129129

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-
149130
let startItemTop = locatedItemTop;
150131
for (let index = itemIndex - 1; index >= startIndex; index -= 1) {
151132
startItemTop -= this.itemElementHeights[this.getItemKey(index)] || 0;
@@ -181,26 +162,6 @@ class List<T> extends React.Component<ListProps<T>, ListState> {
181162
getItemKey: (index: number) => this.getItemKey(index, prevProps),
182163
});
183164

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-
204165
// 2. Find the compare item
205166
const removedItemIndex: number = prevProps.dataSource.findIndex((_, index) => {
206167
const key = this.getItemKey(index, prevProps);
@@ -211,8 +172,6 @@ class List<T> extends React.Component<ListProps<T>, ListState> {
211172
if (originCompareItemIndex < 0) {
212173
originCompareItemIndex = 0;
213174
}
214-
const compareItemKey = this.getItemKey(originCompareItemIndex, prevProps);
215-
console.log('2. Compare Item:', compareItemKey);
216175

217176
// 3. Find the compare item top
218177
const originCompareItemTop = getCompareItemRelativeTop({
@@ -225,8 +184,6 @@ class List<T> extends React.Component<ListProps<T>, ListState> {
225184
itemElementHeights: this.itemElementHeights,
226185
});
227186

228-
console.log('3. Compare Item Top:', originCompareItemTop);
229-
230187
// 4. Find the best match compare item top
231188
let bestSimilarity = Number.MAX_VALUE;
232189
let bestScrollTop: number = null;
@@ -270,14 +227,9 @@ class List<T> extends React.Component<ListProps<T>, ListState> {
270227
itemElementHeights: this.itemElementHeights,
271228
});
272229

273-
// console.log('4.1 ScrollTop:', scrollTop, 'CompareTop:', compareItemTop);
274-
275230
// 4.2 Find best match compare item top
276231
const similarity = Math.abs(compareItemTop - originCompareItemTop);
277232
if (similarity < bestSimilarity) {
278-
console.log('4.2 Winner:', scrollTop, compareItemTop.toFixed(2));
279-
console.log(' -> ', similarity.toFixed(2), bestSimilarity.toFixed(2));
280-
281233
bestSimilarity = similarity;
282234
bestScrollTop = scrollTop;
283235
bestItemIndex = itemIndex;
@@ -290,17 +242,6 @@ class List<T> extends React.Component<ListProps<T>, ListState> {
290242

291243
// 5. Re-scroll if has best scroll match
292244
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-
304245
this.lockScroll = true;
305246
this.listRef.current.scrollTop = bestScrollTop;
306247

0 commit comments

Comments
 (0)