File tree Expand file tree Collapse file tree 5 files changed +12
-10
lines changed Expand file tree Collapse file tree 5 files changed +12
-10
lines changed Original file line number Diff line number Diff line change @@ -14,24 +14,25 @@ - (instancetype)initWithBridge:(RCTBridge*)bridge {
1414 return self;
1515}
1616
17- - (RNNReactView*)createRootView : (NSString *)name rootViewId : (NSString *)rootViewId reactViewReadyBlock : (RNNReactViewReadyCompletionBlock)reactViewReadyBlock {
17+ - (RNNReactView*)createRootView : (NSString *)name rootViewId : (NSString *)rootViewId availableSize : (CGSize) availableSize reactViewReadyBlock : (RNNReactViewReadyCompletionBlock)reactViewReadyBlock {
1818 if (!rootViewId) {
1919 @throw [NSException exceptionWithName: @" MissingViewId" reason: @" Missing view id" userInfo: nil ];
2020 }
2121
2222 RNNReactView *view = [[RNNReactView alloc ] initWithBridge: _bridge
23- moduleName: name
24- initialProperties: @{@" componentId" : rootViewId}
25- reactViewReadyBlock: reactViewReadyBlock];
23+ moduleName: name
24+ initialProperties: @{@" componentId" : rootViewId}
25+ availableSize: availableSize
26+ reactViewReadyBlock: reactViewReadyBlock];
2627 return view;
2728}
2829
2930- (UIView*)createRootViewFromComponentOptions : (RNNComponentOptions*)componentOptions {
30- return [self createRootView: componentOptions.name.get rootViewId: componentOptions.componentId.get reactViewReadyBlock: nil ];
31+ return [self createRootView: componentOptions.name.get rootViewId: componentOptions.componentId.get availableSize: CGSizeZero reactViewReadyBlock: nil ];
3132}
3233
3334- (UIView*)createRootViewFromComponentOptions : (RNNComponentOptions*)componentOptions reactViewReadyBlock : (RNNReactViewReadyCompletionBlock)reactViewReadyBlock {
34- return [self createRootView: componentOptions.name.get rootViewId: componentOptions.componentId.get reactViewReadyBlock: reactViewReadyBlock];
35+ return [self createRootView: componentOptions.name.get rootViewId: componentOptions.componentId.get availableSize: CGSizeZero reactViewReadyBlock: reactViewReadyBlock];
3536}
3637
3738@end
Original file line number Diff line number Diff line change @@ -5,7 +5,7 @@ typedef void (^RNNReactViewReadyCompletionBlock)(void);
55
66@interface RNNReactView : RCTRootView <RCTRootViewDelegate>
77
8- - (instancetype )initWithBridge : (RCTBridge *)bridge moduleName : (NSString *)moduleName initialProperties : (NSDictionary *)initialProperties reactViewReadyBlock : (RNNReactViewReadyCompletionBlock)reactViewReadyBlock ;
8+ - (instancetype )initWithBridge : (RCTBridge *)bridge moduleName : (NSString *)moduleName initialProperties : (NSDictionary *)initialProperties availableSize : (CGSize) availableSize reactViewReadyBlock : (RNNReactViewReadyCompletionBlock)reactViewReadyBlock ;
99
1010@property (nonatomic , copy ) void (^rootViewDidChangeIntrinsicSize)(CGSize intrinsicSize);
1111@property (nonatomic , copy ) RNNReactViewReadyCompletionBlock reactViewReadyBlock;
Original file line number Diff line number Diff line change 44
55@implementation RNNReactView
66
7- - (instancetype )initWithBridge : (RCTBridge *)bridge moduleName : (NSString *)moduleName initialProperties : (NSDictionary *)initialProperties reactViewReadyBlock : (RNNReactViewReadyCompletionBlock)reactViewReadyBlock {
7+ - (instancetype )initWithBridge : (RCTBridge *)bridge moduleName : (NSString *)moduleName initialProperties : (NSDictionary *)initialProperties availableSize : (CGSize) availableSize reactViewReadyBlock : (RNNReactViewReadyCompletionBlock)reactViewReadyBlock {
88 self = [super initWithBridge: bridge moduleName: moduleName initialProperties: initialProperties];
99 [[NSNotificationCenter defaultCenter ] addObserver: self selector: @selector (contentDidAppear: ) name: RCTContentDidAppearNotification object: nil ];
1010 _reactViewReadyBlock = reactViewReadyBlock;
11+ [bridge.uiManager setAvailableSize: availableSize forRootView: self ];
1112
1213 return self;
1314}
Original file line number Diff line number Diff line change @@ -97,7 +97,7 @@ - (void)renderTreeAndWait:(BOOL)wait perform:(RNNReactViewReadyCompletionBlock)r
9797 }
9898
9999 __block RNNReactViewReadyCompletionBlock readyBlockCopy = readyBlock;
100- UIView* reactView = [_creator createRootView: self .layoutInfo.name rootViewId: self .layoutInfo.componentId reactViewReadyBlock: ^{
100+ UIView* reactView = [_creator createRootView: self .layoutInfo.name rootViewId: self .layoutInfo.componentId availableSize: [UIScreen mainScreen ].bounds.size reactViewReadyBlock: ^{
101101 [_presenter renderComponents: self .resolveOptions perform: ^{
102102 if (readyBlockCopy) {
103103 readyBlockCopy ();
Original file line number Diff line number Diff line change 55
66@protocol RNNRootViewCreator
77
8- - (RNNReactView*)createRootView : (NSString *)name rootViewId : (NSString *)rootViewId reactViewReadyBlock : (RNNReactViewReadyCompletionBlock)reactViewReadyBlock ;
8+ - (RNNReactView*)createRootView : (NSString *)name rootViewId : (NSString *)rootViewId availableSize : (CGSize) availableSize reactViewReadyBlock : (RNNReactViewReadyCompletionBlock)reactViewReadyBlock ;
99
1010- (UIView*)createRootViewFromComponentOptions : (RNNComponentOptions*)componentOptions ;
1111
You can’t perform that action at this time.
0 commit comments