|
@@ -2,7 +2,9 @@
|
2
|
2
|
#import "RCTHelpers.h"
|
3
|
3
|
#import <React/RCTUIManager.h>
|
4
|
4
|
|
5
|
|
-@implementation RNNReactView
|
|
5
|
+@implementation RNNReactView {
|
|
6
|
+ BOOL _fillParent;
|
|
7
|
+}
|
6
|
8
|
|
7
|
9
|
- (instancetype)initWithBridge:(RCTBridge *)bridge moduleName:(NSString *)moduleName initialProperties:(NSDictionary *)initialProperties availableSize:(CGSize)availableSize reactViewReadyBlock:(RNNReactViewReadyCompletionBlock)reactViewReadyBlock {
|
8
|
10
|
self = [super initWithBridge:bridge moduleName:moduleName initialProperties:initialProperties];
|
|
@@ -44,10 +46,19 @@
|
44
|
46
|
}
|
45
|
47
|
}
|
46
|
48
|
|
|
49
|
+- (CGSize)intrinsicContentSize {
|
|
50
|
+ if (_fillParent) {
|
|
51
|
+ return UILayoutFittingExpandedSize;
|
|
52
|
+ } else {
|
|
53
|
+ return [super intrinsicContentSize];
|
|
54
|
+ }
|
|
55
|
+}
|
|
56
|
+
|
47
|
57
|
- (void)setAlignment:(NSString *)alignment inFrame:(CGRect)frame {
|
48
|
58
|
if ([alignment isEqualToString:@"fill"]) {
|
|
59
|
+ _fillParent = YES;
|
|
60
|
+ self.translatesAutoresizingMaskIntoConstraints = NO;
|
49
|
61
|
self.sizeFlexibility = RCTRootViewSizeFlexibilityNone;
|
50
|
|
- [self setFrame:frame];
|
51
|
62
|
} else {
|
52
|
63
|
self.sizeFlexibility = RCTRootViewSizeFlexibilityWidthAndHeight;
|
53
|
64
|
__weak RNNReactView *weakSelf = self;
|