Force scroll event inside scrollViewDidEndScrollingAnimation and scrollTo

Summary:
Changelog: [internal]

`onScroll` event needs to be fired when scroll view ends the scrolling animation and when scrollTo is called.
This is how Paper does it and client code might depend on it.

Reviewed By: JoshuaGross

Differential Revision: D24527189

fbshipit-source-id: bdec099f16b3d8c97686975a1f769db4d2c0d832
This commit is contained in:
Samuel Susla
2020-10-24 12:02:08 -07:00
committed by Facebook GitHub Bot
parent 1d1cbc93c2
commit e75a0dc265
@@ -392,6 +392,7 @@ static void RCTSendPaperScrollEvent_DEPRECATED(UIScrollView *scrollView, NSInteg
- (void)scrollViewDidEndScrollingAnimation:(UIScrollView *)scrollView
{
[self _forceDispatchNextScrollEvent];
[self scrollViewDidScroll:scrollView];
if (!_eventEmitter) {
return;
@@ -458,6 +459,8 @@ static void RCTSendPaperScrollEvent_DEPRECATED(UIScrollView *scrollView, NSInteg
_scrollView.contentSize.height - _scrollView.bounds.size.height + _scrollView.contentInset.bottom +
fmax(_scrollView.contentInset.top, 0),
0.01)); // Make width and height greater than 0
[self _forceDispatchNextScrollEvent];
if (!CGRectContainsPoint(maxRect, offset)) {
CGFloat localX = fmax(offset.x, CGRectGetMinX(maxRect));
localX = fmin(localX, CGRectGetMaxX(maxRect));