mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
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
This commit is contained in:
committed by
Facebook GitHub Bot
parent
3ff671c704
commit
62aa84a325
@@ -600,36 +600,6 @@ RCT_SCROLL_EVENT_HANDLER(scrollViewDidScrollToTop, onScrollToTop)
|
||||
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
|
||||
|
||||
@@ -12,12 +12,6 @@
|
||||
#import "RCTShadowView.h"
|
||||
#import "RCTUIManager.h"
|
||||
|
||||
@interface RCTScrollView (Private)
|
||||
|
||||
- (NSArray<NSDictionary *> *)calculateChildFramesData;
|
||||
|
||||
@end
|
||||
|
||||
@implementation RCTConvert (UIScrollView)
|
||||
|
||||
RCT_ENUM_CONVERTER(
|
||||
@@ -140,22 +134,6 @@ RCT_EXPORT_METHOD(getContentSize : (nonnull NSNumber *)reactTag callback : (RCTR
|
||||
}];
|
||||
}
|
||||
|
||||
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
|
||||
|
||||
Reference in New Issue
Block a user