@@ -61,7 +61,10 @@ export interface ListProps<T> extends React.HTMLAttributes<any> {
61
61
fullHeight ?: boolean ;
62
62
itemKey : Key | ( ( item : T ) => Key ) ;
63
63
component ?: string | React . FC < any > | React . ComponentClass < any > ;
64
+ /** Disable scroll check. Usually used on animation control */
64
65
disabled ?: boolean ;
66
+ /** Set `false` will always use real scroll instead of virtual one */
67
+ virtual ?: boolean ;
65
68
66
69
/** When `disabled`, trigger if changed item not render. */
67
70
onSkipRender ?: ( ) => void ;
@@ -158,7 +161,7 @@ class List<T = any> extends React.Component<ListProps<T>, ListState<T>> {
158
161
startIndex : 0 ,
159
162
endIndex : 0 ,
160
163
startItemTop : 0 ,
161
- isVirtual : requireVirtual ( props . height , props . itemHeight , props . data . length ) ,
164
+ isVirtual : requireVirtual ( props . height , props . itemHeight , props . data . length , props . virtual ) ,
162
165
itemCount : props . data . length ,
163
166
} ;
164
167
}
@@ -189,7 +192,7 @@ class List<T = any> extends React.Component<ListProps<T>, ListState<T>> {
189
192
*/
190
193
public componentDidUpdate ( ) {
191
194
const { status } = this . state ;
192
- const { data, height, itemHeight, disabled, onSkipRender } = this . props ;
195
+ const { data, height, itemHeight, disabled, onSkipRender, virtual } = this . props ;
193
196
const prevData : T [ ] = this . cachedProps . data || [ ] ;
194
197
195
198
let changedItemIndex : number = null ;
@@ -214,7 +217,7 @@ class List<T = any> extends React.Component<ListProps<T>, ListState<T>> {
214
217
return ;
215
218
}
216
219
217
- const isVirtual = requireVirtual ( height , itemHeight , data . length ) ;
220
+ const isVirtual = requireVirtual ( height , itemHeight , data . length , virtual ) ;
218
221
let nextStatus = status ;
219
222
if ( this . state . isVirtual !== isVirtual ) {
220
223
nextStatus = isVirtual ? 'SWITCH_TO_VIRTUAL' : 'SWITCH_TO_RAW' ;
@@ -734,6 +737,7 @@ class List<T = any> extends React.Component<ListProps<T>, ListState<T>> {
734
737
itemKey,
735
738
onSkipRender,
736
739
disabled,
740
+ virtual,
737
741
...restProps
738
742
} = this . props ;
739
743
@@ -745,7 +749,7 @@ class List<T = any> extends React.Component<ListProps<T>, ListState<T>> {
745
749
* Virtual list switch is works on component updated.
746
750
* We should double check here if need cut the content.
747
751
*/
748
- const shouldVirtual = requireVirtual ( height , itemHeight , data . length ) ;
752
+ const shouldVirtual = requireVirtual ( height , itemHeight , data . length , virtual ) ;
749
753
750
754
return (
751
755
< Component
0 commit comments