Back out "Restore scroll position when scroll view is hidden and shown"

Summary:
Backing out D42815359 (47903d0c62) as it caused [this](https://fb.workplace.com/groups/rn.support/permalink/24250950937860193/)

## Changelog:
[iOS][Changed] - Backout to prevent issue

Reviewed By: sammy-SC

Differential Revision: D43041078

fbshipit-source-id: 844764af15c37baee55c927501b8b293878df284
This commit is contained in:
Riccardo Cipolleschi 2023-02-06 06:55:52 -08:00 коммит произвёл Facebook GitHub Bot
Родитель 011ea3306f
Коммит 34604fa8fd
1 изменённых файлов: 0 добавлений и 23 удалений

Просмотреть файл

@ -25,12 +25,6 @@
using namespace facebook::react; using namespace facebook::react;
struct PendingOffset {
bool isPending;
CGPoint offset;
CGPoint lastOffset;
};
static CGFloat const kClippingLeeway = 44.0; static CGFloat const kClippingLeeway = 44.0;
static UIScrollViewKeyboardDismissMode RCTUIKeyboardDismissModeFromProps(ScrollViewProps const &props) static UIScrollViewKeyboardDismissMode RCTUIKeyboardDismissModeFromProps(ScrollViewProps const &props)
@ -105,8 +99,6 @@ static void RCTSendScrollEventForNativeAnimations_DEPRECATED(UIScrollView *scrol
BOOL _shouldUpdateContentInsetAdjustmentBehavior; BOOL _shouldUpdateContentInsetAdjustmentBehavior;
CGPoint _contentOffsetWhenClipped; CGPoint _contentOffsetWhenClipped;
PendingOffset _pendingOffset;
} }
+ (RCTScrollViewComponentView *_Nullable)findScrollViewComponentViewForView:(UIView *)view + (RCTScrollViewComponentView *_Nullable)findScrollViewComponentViewForView:(UIView *)view
@ -181,12 +173,6 @@ static void RCTSendScrollEventForNativeAnimations_DEPRECATED(UIScrollView *scrol
_containerView.transform = transform; _containerView.transform = transform;
_scrollView.transform = transform; _scrollView.transform = transform;
} }
// If there is a pending offset, apply it
if (_pendingOffset.isPending) {
[self scrollTo:_pendingOffset.offset.x y:_pendingOffset.offset.y animated:false];
_pendingOffset.isPending = false;
}
} }
- (void)updateProps:(Props::Shared const &)props oldProps:(Props::Shared const &)oldProps - (void)updateProps:(Props::Shared const &)props oldProps:(Props::Shared const &)oldProps
@ -435,13 +421,6 @@ static void RCTSendScrollEventForNativeAnimations_DEPRECATED(UIScrollView *scrol
[self _updateStateWithContentOffset]; [self _updateStateWithContentOffset];
} }
// If the view is hidden, then set as pending offset. Apply it later on
// updateLayoutMetrics.
if (_scrollView.window == nil && !_pendingOffset.isPending) {
_pendingOffset.offset = _pendingOffset.lastOffset;
_pendingOffset.isPending = true;
}
NSTimeInterval now = CACurrentMediaTime(); NSTimeInterval now = CACurrentMediaTime();
if ((_lastScrollEventDispatchTime == 0) || (now - _lastScrollEventDispatchTime > _scrollEventThrottle)) { if ((_lastScrollEventDispatchTime == 0) || (now - _lastScrollEventDispatchTime > _scrollEventThrottle)) {
_lastScrollEventDispatchTime = now; _lastScrollEventDispatchTime = now;
@ -452,8 +431,6 @@ static void RCTSendScrollEventForNativeAnimations_DEPRECATED(UIScrollView *scrol
RCTSendScrollEventForNativeAnimations_DEPRECATED(scrollView, self.tag); RCTSendScrollEventForNativeAnimations_DEPRECATED(scrollView, self.tag);
} }
_pendingOffset.lastOffset = _scrollView.contentOffset;
[self _remountChildrenIfNeeded]; [self _remountChildrenIfNeeded];
} }