@@ -127,6 +127,25 @@ 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
+
130
149
let startItemTop = locatedItemTop ;
131
150
for ( let index = itemIndex - 1 ; index >= startIndex ; index -= 1 ) {
132
151
startItemTop -= this . itemElementHeights [ this . getItemKey ( index ) ] || 0 ;
@@ -145,14 +164,19 @@ class List<T> extends React.Component<ListProps<T>, ListState> {
145
164
itemOffsetPtg : originItemOffsetPtg ,
146
165
startIndex : originStartIndex ,
147
166
endIndex : originEndIndex ,
167
+ scrollTop : originScrollTop ,
148
168
} = this . state ;
149
169
150
170
// 1. Get origin located item top
151
171
const originLocatedItemRelativeTop = getItemRelativeTop ( {
152
172
itemIndex : originItemIndex ,
153
173
itemOffsetPtg : originItemOffsetPtg ,
154
174
itemElementHeights : this . itemElementHeights ,
155
- scrollPtg : getElementScrollPercentage ( this . listRef . current ) ,
175
+ scrollPtg : getScrollPercentage ( {
176
+ scrollTop : originScrollTop ,
177
+ scrollHeight : prevProps . dataSource . length * itemHeight ,
178
+ clientHeight : this . listRef . current . clientHeight ,
179
+ } ) ,
156
180
clientHeight : this . listRef . current . clientHeight ,
157
181
getItemKey : ( index : number ) => this . getItemKey ( index , prevProps ) ,
158
182
} ) ;
@@ -164,6 +188,18 @@ class List<T> extends React.Component<ListProps<T>, ListState> {
164
188
this . getItemKey ( originItemIndex , prevProps ) ,
165
189
originLocatedItemRelativeTop ,
166
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
+ ) ;
167
203
168
204
// 2. Find the compare item
169
205
const removedItemIndex : number = prevProps . dataSource . findIndex ( ( _ , index ) => {
0 commit comments