Skip to content

Commit eff6735

Browse files
majakFacebook Github Bot 1
authored andcommitted
pass flexiblity to shadowrootview on its creation
Reviewed By: javache Differential Revision: D3177404 fb-gh-sync-id: 2116628461e37e9f1d1b3cbc6d6560675cadee7e fbshipit-source-id: 2116628461e37e9f1d1b3cbc6d6560675cadee7e
1 parent 5cdfe0f commit eff6735

File tree

3 files changed

+10
-7
lines changed

3 files changed

+10
-7
lines changed

React/Base/RCTRootView.m

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,8 @@ @interface RCTRootContentView : RCTView <RCTInvalidating>
4242

4343
- (instancetype)initWithFrame:(CGRect)frame
4444
bridge:(RCTBridge *)bridge
45-
reactTag:(NSNumber *)reactTag NS_DESIGNATED_INITIALIZER;
46-
45+
reactTag:(NSNumber *)reactTag
46+
sizeFlexiblity:(RCTRootViewSizeFlexibility)sizeFlexibility NS_DESIGNATED_INITIALIZER;
4747
@end
4848

4949
@implementation RCTRootView
@@ -212,7 +212,8 @@ - (void)bundleFinishedLoading:(RCTBridge *)bridge
212212
[_contentView removeFromSuperview];
213213
_contentView = [[RCTRootContentView alloc] initWithFrame:self.bounds
214214
bridge:bridge
215-
reactTag:self.reactTag];
215+
reactTag:self.reactTag
216+
sizeFlexiblity:self.sizeFlexibility];
216217
[self runApplication:bridge];
217218

218219
_contentView.backgroundColor = self.backgroundColor;
@@ -320,13 +321,14 @@ @implementation RCTRootContentView
320321
- (instancetype)initWithFrame:(CGRect)frame
321322
bridge:(RCTBridge *)bridge
322323
reactTag:(NSNumber *)reactTag
324+
sizeFlexiblity:(RCTRootViewSizeFlexibility)sizeFlexibility
323325
{
324326
if ((self = [super initWithFrame:frame])) {
325327
_bridge = bridge;
326328
self.reactTag = reactTag;
327329
_touchHandler = [[RCTTouchHandler alloc] initWithBridge:_bridge];
328330
[self addGestureRecognizer:_touchHandler];
329-
[_bridge.uiManager registerRootView:self];
331+
[_bridge.uiManager registerRootView:self withSizeFlexibility:sizeFlexibility];
330332
self.layer.backgroundColor = NULL;
331333
}
332334
return self;

React/Modules/RCTUIManager.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
#import "RCTBridgeModule.h"
1414
#import "RCTInvalidating.h"
1515
#import "RCTViewManager.h"
16+
#import "RCTRootView.h"
1617

1718
/**
1819
* Posted right before re-render happens. This is a chance for views to invalidate their state so
@@ -47,7 +48,7 @@ RCT_EXTERN NSString *const RCTUIManagerRootViewKey;
4748
/**
4849
* Register a root view with the RCTUIManager.
4950
*/
50-
- (void)registerRootView:(UIView *)rootView;
51+
- (void)registerRootView:(UIView *)rootView withSizeFlexibility:(RCTRootViewSizeFlexibility)sizeFlexibility;
5152

5253
/**
5354
* Gets the view associated with a reactTag.

React/Modules/RCTUIManager.m

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@
2626
#import "RCTModuleData.h"
2727
#import "RCTModuleMethod.h"
2828
#import "RCTProfile.h"
29-
#import "RCTRootView.h"
3029
#import "RCTRootShadowView.h"
3130
#import "RCTRootViewInternal.h"
3231
#import "RCTScrollableProtocol.h"
@@ -336,7 +335,7 @@ - (dispatch_queue_t)methodQueue
336335
return _shadowQueue;
337336
}
338337

339-
- (void)registerRootView:(UIView *)rootView
338+
- (void)registerRootView:(UIView *)rootView withSizeFlexibility:(RCTRootViewSizeFlexibility)sizeFlexibility
340339
{
341340
RCTAssertMainThread();
342341

@@ -364,6 +363,7 @@ - (void)registerRootView:(UIView *)rootView
364363
shadowView.frame = frame;
365364
shadowView.backgroundColor = rootView.backgroundColor;
366365
shadowView.viewName = NSStringFromClass([rootView class]);
366+
shadowView.sizeFlexibility = sizeFlexibility;
367367
strongSelf->_shadowViewRegistry[shadowView.reactTag] = shadowView;
368368
[strongSelf->_rootViewTags addObject:reactTag];
369369
});

0 commit comments

Comments
 (0)