@@ -461,7 +461,7 @@ class ScrollableBaseNative extends Component {
461
461
componentWillUnmount ( ) {
462
462
// Before call cancelAnimationFrame, you must send scrollStop Event.
463
463
if ( this . scrolling ) {
464
- this . forwardScrollEvent ( 'onScrollStop' ) ;
464
+ this . forwardScrollEvent ( 'onScrollStop' , this . getReachedEdgeInfo ( ) ) ;
465
465
}
466
466
this . scrollStopJob . stop ( ) ;
467
467
@@ -907,8 +907,8 @@ class ScrollableBaseNative extends Component {
907
907
908
908
// call scroll callbacks
909
909
910
- forwardScrollEvent ( type ) {
911
- forward ( type , { scrollLeft : this . scrollLeft , scrollTop : this . scrollTop , moreInfo : this . getMoreInfo ( ) } , this . props ) ;
910
+ forwardScrollEvent ( type , reachedEdgeInfo ) {
911
+ forward ( type , { scrollLeft : this . scrollLeft , scrollTop : this . scrollTop , moreInfo : this . getMoreInfo ( ) , reachedEdgeInfo } , this . props ) ;
912
912
}
913
913
914
914
// call scroll callbacks and update scrollbars for native scroll
@@ -929,7 +929,7 @@ class ScrollableBaseNative extends Component {
929
929
this . lastInputType = null ;
930
930
this . isScrollAnimationTargetAccumulated = false ;
931
931
this . scrolling = false ;
932
- this . forwardScrollEvent ( 'onScrollStop' ) ;
932
+ this . forwardScrollEvent ( 'onScrollStop' , this . getReachedEdgeInfo ( ) ) ;
933
933
this . startHidingThumb ( ) ;
934
934
}
935
935
@@ -999,6 +999,38 @@ class ScrollableBaseNative extends Component {
999
999
}
1000
1000
}
1001
1001
1002
+ getReachedEdgeInfo = ( ) => {
1003
+ const
1004
+ bounds = this . getScrollBounds ( ) ,
1005
+ reachedEdgeInfo = { bottom : false , left : false , right : false , top : false } ;
1006
+
1007
+ if ( this . canScrollHorizontally ( bounds ) ) {
1008
+ const
1009
+ rtl = this . state . rtl ,
1010
+ edge = this . getEdgeFromPosition ( this . scrollLeft , bounds . maxLeft ) ;
1011
+
1012
+ if ( edge ) { // if edge is null, no need to check which edge is reached.
1013
+ if ( ( edge === 'before' && ! rtl ) || ( edge === 'after' && rtl ) ) {
1014
+ reachedEdgeInfo . left = true ;
1015
+ } else {
1016
+ reachedEdgeInfo . right = true ;
1017
+ }
1018
+ }
1019
+ }
1020
+
1021
+ if ( this . canScrollVertically ( bounds ) ) {
1022
+ const edge = this . getEdgeFromPosition ( this . scrollTop , bounds . maxTop ) ;
1023
+
1024
+ if ( edge === 'before' ) {
1025
+ reachedEdgeInfo . top = true ;
1026
+ } else if ( edge === 'after' ) {
1027
+ reachedEdgeInfo . bottom = true ;
1028
+ }
1029
+ }
1030
+
1031
+ return reachedEdgeInfo ;
1032
+ }
1033
+
1002
1034
// scroll start
1003
1035
1004
1036
start ( { targetX, targetY, animate = true , overscrollEffect = false } ) {
0 commit comments