Skip to content

Commit

Permalink
Deprecate calculateChildFrames from RCTScrollView
Browse files Browse the repository at this point in the history
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
  • Loading branch information
Peter Argany authored and facebook-github-bot committed Jun 16, 2020
1 parent 3ff671c commit 62aa84a
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 52 deletions.
30 changes: 0 additions & 30 deletions React/Views/ScrollView/RCTScrollView.m
Original file line number Diff line number Diff line change
Expand Up @@ -600,36 +600,6 @@ - (void)scrollViewDidScroll:(UIScrollView *)scrollView
RCT_FORWARD_SCROLL_EVENT(scrollViewDidScroll : scrollView);
}

- (NSArray<NSDictionary *> *)calculateChildFramesData
{
NSMutableArray<NSDictionary *> *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
Expand Down
22 changes: 0 additions & 22 deletions React/Views/ScrollView/RCTScrollViewManager.m
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,6 @@
#import "RCTShadowView.h"
#import "RCTUIManager.h"

@interface RCTScrollView (Private)

- (NSArray<NSDictionary *> *)calculateChildFramesData;

@end

@implementation RCTConvert (UIScrollView)

RCT_ENUM_CONVERTER(
Expand Down Expand Up @@ -140,22 +134,6 @@ - (UIView *)view
}];
}

RCT_EXPORT_METHOD(calculateChildFrames : (nonnull NSNumber *)reactTag callback : (RCTResponseSenderBlock)callback)
{
[self.bridge.uiManager
addUIBlock:^(__unused RCTUIManager *uiManager, NSDictionary<NSNumber *, RCTScrollView *> *viewRegistry) {
RCTScrollView *view = viewRegistry[reactTag];
if (!view || ![view isKindOfClass:[RCTScrollView class]]) {
return;
}

NSArray<NSDictionary *> *childFrames = [view calculateChildFramesData];
if (childFrames) {
callback(@[ childFrames ]);
}
}];
}

RCT_EXPORT_METHOD(scrollTo
: (nonnull NSNumber *)reactTag offsetX
: (CGFloat)x offsetY
Expand Down

0 comments on commit 62aa84a

Please sign in to comment.