From 62aa84a3257bd3c513df3fcb4b4eaa350ecf77bb Mon Sep 17 00:00:00 2001 From: Peter Argany Date: Tue, 16 Jun 2020 12:46:36 -0700 Subject: [PATCH] Deprecate calculateChildFrames from RCTScrollView Summary: This function is unused. (Followup to D21941946) Changelog: [iOS] Deprecate calculateChildFrames from RCTScrollView Reviewed By: sammy-SC Differential Revision: D22071415 fbshipit-source-id: 0c996ab02df1431ee9cfa082bc99681a2ec7118c --- React/Views/ScrollView/RCTScrollView.m | 30 ------------------- React/Views/ScrollView/RCTScrollViewManager.m | 22 -------------- 2 files changed, 52 deletions(-) diff --git a/React/Views/ScrollView/RCTScrollView.m b/React/Views/ScrollView/RCTScrollView.m index f448a7dec6e033..acef7bc88538b6 100644 --- a/React/Views/ScrollView/RCTScrollView.m +++ b/React/Views/ScrollView/RCTScrollView.m @@ -600,36 +600,6 @@ - (void)scrollViewDidScroll:(UIScrollView *)scrollView RCT_FORWARD_SCROLL_EVENT(scrollViewDidScroll : scrollView); } -- (NSArray *)calculateChildFramesData -{ - NSMutableArray *updatedChildFrames = [NSMutableArray new]; - [[_contentView reactSubviews] enumerateObjectsUsingBlock:^(UIView *subview, NSUInteger idx, __unused BOOL *stop) { - // Check if new or changed - CGRect newFrame = subview.frame; - BOOL frameChanged = NO; - if (self->_cachedChildFrames.count <= idx) { - frameChanged = YES; - [self->_cachedChildFrames addObject:[NSValue valueWithCGRect:newFrame]]; - } else if (!CGRectEqualToRect(newFrame, [self->_cachedChildFrames[idx] CGRectValue])) { - frameChanged = YES; - self->_cachedChildFrames[idx] = [NSValue valueWithCGRect:newFrame]; - } - - // Create JS frame object - if (frameChanged) { - [updatedChildFrames addObject:@{ - @"index" : @(idx), - @"x" : @(newFrame.origin.x), - @"y" : @(newFrame.origin.y), - @"width" : @(newFrame.size.width), - @"height" : @(newFrame.size.height), - }]; - } - }]; - - return updatedChildFrames; -} - - (void)scrollViewWillBeginDragging:(UIScrollView *)scrollView { _allowNextScrollNoMatterWhat = YES; // Ensure next scroll event is recorded, regardless of throttle diff --git a/React/Views/ScrollView/RCTScrollViewManager.m b/React/Views/ScrollView/RCTScrollViewManager.m index 2ac06cebca82fe..a176d1068609ba 100644 --- a/React/Views/ScrollView/RCTScrollViewManager.m +++ b/React/Views/ScrollView/RCTScrollViewManager.m @@ -12,12 +12,6 @@ #import "RCTShadowView.h" #import "RCTUIManager.h" -@interface RCTScrollView (Private) - -- (NSArray *)calculateChildFramesData; - -@end - @implementation RCTConvert (UIScrollView) RCT_ENUM_CONVERTER( @@ -140,22 +134,6 @@ - (UIView *)view }]; } -RCT_EXPORT_METHOD(calculateChildFrames : (nonnull NSNumber *)reactTag callback : (RCTResponseSenderBlock)callback) -{ - [self.bridge.uiManager - addUIBlock:^(__unused RCTUIManager *uiManager, NSDictionary *viewRegistry) { - RCTScrollView *view = viewRegistry[reactTag]; - if (!view || ![view isKindOfClass:[RCTScrollView class]]) { - return; - } - - NSArray *childFrames = [view calculateChildFramesData]; - if (childFrames) { - callback(@[ childFrames ]); - } - }]; -} - RCT_EXPORT_METHOD(scrollTo : (nonnull NSNumber *)reactTag offsetX : (CGFloat)x offsetY