Provide root reactTag to RootComponent and use it to resolve view controllers
This commit is contained in:
parent
5614a04cba
commit
effa43926b
|
@ -73,6 +73,7 @@ function renderApplication<D, P, S>(
|
|||
<AppContainer rootTag={rootTag}>
|
||||
<RootComponent
|
||||
{...initialProps}
|
||||
rootTag={rootTag}
|
||||
/>
|
||||
</AppContainer>,
|
||||
rootTag
|
||||
|
|
|
@ -34,6 +34,11 @@
|
|||
*/
|
||||
- (void)registerRootView:(UIView *)rootView;
|
||||
|
||||
/**
|
||||
* Gets the view associated with a reactTag.
|
||||
*/
|
||||
- (UIView *)viewForReactTag:(NSNumber *)reactTag;
|
||||
|
||||
/**
|
||||
* Update the frame of a root view. This might be in response to a screen rotation
|
||||
* or some other layout event outside of the React-managed view hierarchy.
|
||||
|
|
|
@ -359,6 +359,12 @@ static NSDictionary *RCTViewConfigForModule(Class managerClass)
|
|||
});
|
||||
}
|
||||
|
||||
- (UIView *)viewForReactTag:(NSNumber *)reactTag
|
||||
{
|
||||
RCTAssertMainThread();
|
||||
return _viewRegistry[reactTag];
|
||||
}
|
||||
|
||||
- (void)setFrame:(CGRect)frame forRootView:(UIView *)rootView
|
||||
{
|
||||
RCTAssertMainThread();
|
||||
|
|
|
@ -13,7 +13,6 @@
|
|||
|
||||
#import "RCTAssert.h"
|
||||
#import "RCTLog.h"
|
||||
#import "RCTWrapperViewController.h"
|
||||
|
||||
@implementation UIView (React)
|
||||
|
||||
|
@ -91,9 +90,12 @@
|
|||
- (UIViewController *)backingViewController
|
||||
{
|
||||
id responder = [self nextResponder];
|
||||
if ([responder isKindOfClass:[RCTWrapperViewController class]]) {
|
||||
while (responder) {
|
||||
if ([responder isKindOfClass:[UIViewController class]]) {
|
||||
return responder;
|
||||
}
|
||||
responder = [responder nextResponder];
|
||||
}
|
||||
return nil;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue