@@ -259,8 +259,11 @@ class LargeList extends React.Component {
259259 this . contentSize . height += this . headerHeight ;
260260 this . contentSize . height += this . footerHeight ;
261261 this . safeArea . top = this . safeArea . bottom = this . headerHeight ;
262- this . _onScroll ( { nativeEvent : { contentOffset : this . contentOffset } } ) ;
263262 this . forceUpdate ( ) ;
263+ this . _onScroll (
264+ { nativeEvent : { contentOffset : this . contentOffset } } ,
265+ true
266+ ) ;
264267 }
265268
266269 componentDidUpdate ( ) {
@@ -388,21 +391,24 @@ class LargeList extends React.Component {
388391 renderSection = { this . props . renderSection }
389392 ref = { reference => ( this . currentSectionRef = reference ) }
390393 numberOfSections = { this . numberOfSections }
394+ heightForSection = { this . props . heightForSection }
391395 />
392396 </ ScrollView >
393397 </ View >
394398 ) ;
395399 }
396400
397401 _createSection ( section : number , top : number , refs : LargeListSection [ ] ) {
402+ let height = section >= 0 && section < this . numberOfSections ( ) ? this . props . heightForSection ( section ) :0 ;
398403 return (
399404 < LargeListSection
400405 ref = { reference => reference && refs . push ( reference ) }
401406 key = { this . keyForCreating ++ }
402- style = { [ styles . absoluteStretch , { top : top } ] }
407+ style = { [ styles . absoluteStretch , { top : top , height : height } ] }
403408 numberOfSections = { this . numberOfSections }
404409 section = { section }
405410 renderSection = { this . props . renderSection }
411+ heightForSection = { this . props . heightForSection }
406412 />
407413 ) ;
408414 }
@@ -436,13 +442,13 @@ class LargeList extends React.Component {
436442 _onCellTouchBegin ( sender ) {
437443 let hide = false ;
438444 this . workRefs . forEach ( item => {
439- let res = item . hideOther ( sender ) ;
445+ let res = item . hideOther ( sender ) ;
440446 if ( ! hide ) hide = res ;
441447 } ) ;
442448 return hide ;
443449 }
444450
445- _onScroll ( e , withoutReload ) {
451+ _onScroll ( e , forceUpdate ) {
446452 let offset : Offset = e . nativeEvent . contentOffset ;
447453 if ( this . empty || ! this . sizeConfirmed ) {
448454 this . contentOffset = offset ;
@@ -462,6 +468,7 @@ class LargeList extends React.Component {
462468 this . lastScrollTime = now ;
463469 let reloadType : number = 0 ;
464470 if (
471+ forceUpdate ||
465472 offset . y < topMargin ||
466473 offset . y + this . size . height + bottomMargin > this . contentSize . height ||
467474 speed < this . props . speedLevel1
@@ -712,16 +719,14 @@ class LargeList extends React.Component {
712719 if ( section . top !== - 10000 )
713720 section . updateToSection ( section . section , - 10000 , section . height , false ) ;
714721 } ) ;
715-
716- if ( ! withoutReload )
717- switch ( reloadType ) {
718- case 0 :
719- this . _forceUpdate ( ) ;
720- break ;
721- default :
722- this . _positionUpdate ( ) ;
723- break ;
724- }
722+ switch ( reloadType ) {
723+ case 0 :
724+ this . _forceUpdate ( ) ;
725+ break ;
726+ default :
727+ this . _positionUpdate ( ) ;
728+ break ;
729+ }
725730 this . contentOffset = offset ;
726731 this . props . onScroll && this . props . onScroll ( e ) ;
727732 //解决冲量结束无法回调的问题
@@ -888,7 +893,6 @@ class LargeList extends React.Component {
888893 ) {
889894 this . sizeConfirmed = true ;
890895 this . initCells ( ) ;
891- // setTimeout( ()=>this._forceUpdate(),2000);
892896 }
893897 }
894898
@@ -948,8 +952,7 @@ class LargeList extends React.Component {
948952 if ( offset . y > this . contentSize . height - this . size . height )
949953 offset . y = this . contentSize . height - this . size . height ;
950954 if ( ! animated ) {
951- this . _onScroll ( { nativeEvent : { contentOffset : offset } } ) ;
952- this . _forceUpdate ( ) ;
955+ this . _onScroll ( { nativeEvent : { contentOffset : offset } } , true ) ;
953956 }
954957 this . scrollViewRef . scrollTo ( offset ) ;
955958 }
@@ -1019,7 +1022,6 @@ class LargeList extends React.Component {
10191022 this . initVar ( ) ;
10201023 this . safeArea = { top : 0 , bottom : 0 } ;
10211024 this . workRefs . forEach ( cell => {
1022- // this.freeRefs.splice(0, 0, cell);
10231025 this . freeRefs . push ( cell ) ;
10241026 } ) ;
10251027 this . freeRefs . forEach ( cell => {
0 commit comments