Browse files

`Removing UIManager.measureViewsInRect()`

It does not supported on Android and nobody uses it.
I could find only one use cases: Very old versin of `SectionList` library (4 years ago).

Reviewed By: sahrens

Differential Revision: D12972361

fbshipit-source-id: a5dfef5e877e996adec2d4941417b4a2e727cfb7
  • Loading branch information...
shergin authored and facebook-github-bot committed Nov 9, 2018
1 parent f386f83 commit d6236796b285e6ad19c53c5308a0ad9c10792a05
Showing with 0 additions and 54 deletions.
  1. +0 −1 Libraries/ReactNative/UIManagerProperties.js
  2. +0 −53 React/Modules/RCTUIManager.m
@@ -59,7 +59,6 @@ module.exports = [
@@ -1341,59 +1341,6 @@ static void RCTMeasureLayout(RCTShadowView *view,
RCTMeasureLayout(shadowView, shadowView.reactSuperview, callback);

* Returns an array of computed offset layouts in a dictionary form. The layouts are of any React subviews
* that are immediate descendants to the parent view found within a specified rect. The dictionary result
* contains left, top, width, height and an index. The index specifies the position among the other subviews.
* Only layouts for views that are within the rect passed in are returned. Invokes the error callback if the
* passed in parent view does not exist. Invokes the supplied callback with the array of computed layouts.
parentView:(nonnull NSNumber *)reactTag
errorCallback:(__unused RCTResponseSenderBlock)errorCallback
RCTShadowView *shadowView = _shadowViewRegistry[reactTag];
if (!shadowView) {
RCTLogError(@"Attempting to measure view that does not exist (tag #%@)", reactTag);
NSArray<RCTShadowView *> *childShadowViews = [shadowView reactSubviews];
NSMutableArray<NSDictionary *> *results =
[[NSMutableArray alloc] initWithCapacity:childShadowViews.count];

[childShadowViews enumerateObjectsUsingBlock:
^(RCTShadowView *childShadowView, NSUInteger idx, __unused BOOL *stop) {
CGRect childLayout = [childShadowView measureLayoutRelativeToAncestor:shadowView];
if (CGRectIsNull(childLayout)) {
RCTLogError(@"View %@ (tag #%@) is not a descendant of %@ (tag #%@)",
childShadowView, childShadowView.reactTag, shadowView, shadowView.reactTag);

CGFloat leftOffset = childLayout.origin.x;
CGFloat topOffset = childLayout.origin.y;
CGFloat width = childLayout.size.width;
CGFloat height = childLayout.size.height;

if (leftOffset <= rect.origin.x + rect.size.width &&
leftOffset + width >= rect.origin.x &&
topOffset <= rect.origin.y + rect.size.height &&
topOffset + height >= rect.origin.y) {

// This view is within the layout rect
NSDictionary *result = @{@"index": @(idx),
@"left": @(leftOffset),
@"top": @(topOffset),
@"width": @(width),
@"height": @(height)};

[results addObject:result];

RCT_EXPORT_METHOD(takeSnapshot:(id /* NSString or NSNumber */)target
withOptions:(NSDictionary *)options

0 comments on commit d623679

Please sign in to comment.