From 59e8bd95607e58386feeca095cd43915816b3c61 Mon Sep 17 00:00:00 2001 From: Valentin Shergin Date: Sun, 17 Nov 2019 10:43:18 -0800 Subject: [PATCH] Fabric: ScrollViewComponentView: Calling `onScrollEndDrag` in `scrollViewDidEndDragging:` Summary: * Previously we called `onScrollEndDrag` in `scrollViewWillEndDragging` which was not correct. * Now we also call `_updateStateWithContentOffset` in the method to update the stored in state `contentOffset`. This fixes all `measure*` infra. Changelog: [Internal] Fabric-specific internal change. Reviewed By: sammy-SC Differential Revision: D18563050 fbshipit-source-id: ade696eda579642c22927c8a56ff122cd61a7534 --- .../ComponentViews/ScrollView/RCTScrollViewComponentView.mm | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/React/Fabric/Mounting/ComponentViews/ScrollView/RCTScrollViewComponentView.mm b/React/Fabric/Mounting/ComponentViews/ScrollView/RCTScrollViewComponentView.mm index 46561b62dcd..709e9c03e6a 100644 --- a/React/Fabric/Mounting/ComponentViews/ScrollView/RCTScrollViewComponentView.mm +++ b/React/Fabric/Mounting/ComponentViews/ScrollView/RCTScrollViewComponentView.mm @@ -252,9 +252,7 @@ static void RCTSendPaperScrollEvent_DEPRECATED(UIScrollView *scrollView, NSInteg std::static_pointer_cast(_eventEmitter)->onScrollBeginDrag([self _scrollViewMetrics]); } -- (void)scrollViewWillEndDragging:(UIScrollView *)scrollView - withVelocity:(CGPoint)velocity - targetContentOffset:(inout CGPoint *)targetContentOffset +- (void)scrollViewDidEndDragging:(UIScrollView *)scrollView willDecelerate:(BOOL)decelerate { [self _forceDispatchNextScrollEvent]; @@ -263,6 +261,7 @@ static void RCTSendPaperScrollEvent_DEPRECATED(UIScrollView *scrollView, NSInteg } std::static_pointer_cast(_eventEmitter)->onScrollEndDrag([self _scrollViewMetrics]); + [self _updateStateWithContentOffset]; } - (void)scrollViewWillBeginDecelerating:(UIScrollView *)scrollView