File tree Expand file tree Collapse file tree 1 file changed +7
-1
lines changed Expand file tree Collapse file tree 1 file changed +7
-1
lines changed Original file line number Diff line number Diff line change @@ -68,7 +68,7 @@ class List<T> extends React.Component<ListProps<T>, ListState> {
68
68
* Phase 4: Record used item height
69
69
* Phase 5: Trigger re-render to use correct position
70
70
*/
71
- public componentDidUpdate ( ) {
71
+ public componentDidUpdate ( prevProps : ListProps < T > ) {
72
72
const { status, startIndex, endIndex } = this . state ;
73
73
const { dataSource, itemKey } = this . props ;
74
74
@@ -82,6 +82,11 @@ class List<T> extends React.Component<ListProps<T>, ListState> {
82
82
83
83
this . setState ( { status : 'MEASURE_DONE' } ) ;
84
84
}
85
+
86
+ // Re-calculate the scroll position align with the current visible item position
87
+ if ( prevProps . dataSource . length !== dataSource . length ) {
88
+ console . log ( '!!!!!!' ) ;
89
+ }
85
90
}
86
91
87
92
public getItemHeight = ( index : number ) => this . itemElementHeights [ index ] || 0 ;
@@ -147,6 +152,7 @@ class List<T> extends React.Component<ListProps<T>, ListState> {
147
152
itemHeight,
148
153
dataSource,
149
154
children,
155
+ itemKey,
150
156
...restProps
151
157
} = this . props ;
152
158
You can’t perform that action at this time.
0 commit comments