2016-03-21 10:20:49 +00:00
|
|
|
/**
|
|
|
|
* Copyright (c) 2015-present, Facebook, Inc.
|
|
|
|
*
|
2018-02-17 02:24:55 +00:00
|
|
|
* This source code is licensed under the MIT license found in the
|
|
|
|
* LICENSE file in the root directory of this source tree.
|
2016-03-21 10:20:49 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#import "RCTRootShadowView.h"
|
|
|
|
|
2017-02-07 04:58:23 +00:00
|
|
|
#import "RCTI18nUtil.h"
|
2018-02-12 08:04:16 +00:00
|
|
|
#import "RCTShadowView+Layout.h"
|
2017-02-07 04:58:23 +00:00
|
|
|
|
2016-03-21 10:20:49 +00:00
|
|
|
@implementation RCTRootShadowView
|
|
|
|
|
2016-06-21 18:51:49 +00:00
|
|
|
- (instancetype)init
|
|
|
|
{
|
2018-02-12 08:04:16 +00:00
|
|
|
if (self = [super init]) {
|
2017-02-14 23:23:40 +00:00
|
|
|
_baseDirection = [[RCTI18nUtil sharedInstance] isRTL] ? YGDirectionRTL : YGDirectionLTR;
|
2017-02-20 07:05:42 +00:00
|
|
|
_availableSize = CGSizeMake(INFINITY, INFINITY);
|
2016-06-21 18:51:49 +00:00
|
|
|
}
|
2018-02-12 08:04:16 +00:00
|
|
|
|
2016-06-21 18:51:49 +00:00
|
|
|
return self;
|
|
|
|
}
|
|
|
|
|
2018-02-12 08:04:16 +00:00
|
|
|
- (void)layoutWithAffectedShadowViews:(NSHashTable<RCTShadowView *> *)affectedShadowViews
|
2016-03-21 10:20:49 +00:00
|
|
|
{
|
2018-02-12 08:04:16 +00:00
|
|
|
NSHashTable<NSString *> *other = [NSHashTable new];
|
2016-03-21 10:20:49 +00:00
|
|
|
|
2018-02-12 08:04:16 +00:00
|
|
|
RCTLayoutContext layoutContext = {};
|
|
|
|
layoutContext.absolutePosition = CGPointZero;
|
|
|
|
layoutContext.affectedShadowViews = affectedShadowViews;
|
|
|
|
layoutContext.other = other;
|
2016-03-21 10:20:49 +00:00
|
|
|
|
2018-02-12 08:04:16 +00:00
|
|
|
[self layoutWithMinimumSize:CGSizeZero
|
|
|
|
maximumSize:_availableSize
|
|
|
|
layoutDirection:RCTUIKitLayoutDirectionFromYogaLayoutDirection(_baseDirection)
|
|
|
|
layoutContext:layoutContext];
|
2016-03-21 10:20:49 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
@end
|