Support `shadowView.rootView`

Reviewed By: shergin

Differential Revision: D5418509

fbshipit-source-id: 585b088678096ccf8416ea21a675d8953bfa82c8
This commit is contained in:
Yu Wang 2017-07-14 18:14:46 -07:00 committed by Facebook Github Bot
parent a3142f50ed
commit 5701ae2145
2 changed files with 39 additions and 0 deletions

View File

@ -0,0 +1,16 @@
/**
* Copyright (c) 2015-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*/
#import <React/RCTRootShadowView.h>
#import <React/RCTShadowView.h>
@interface RCTShadowView (Hierarchy)
@property (nonatomic, readonly) RCTRootShadowView *rootView;
@end

View File

@ -0,0 +1,23 @@
/**
* Copyright (c) 2015-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*/
#import "RCTShadowView+Hierarchy.h"
@implementation RCTShadowView (Hierarchy)
- (nullable RCTRootShadowView *)rootView
{
RCTShadowView *view = self;
while (view != nil && ![view isKindOfClass:[RCTRootShadowView class]]) {
view = view.superview;
}
return (RCTRootShadowView *)view;
}
@end