RCTRootShadowView.m 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. /*
  2. * Copyright (c) Facebook, Inc. and its affiliates.
  3. *
  4. * This source code is licensed under the MIT license found in the
  5. * LICENSE file in the root directory of this source tree.
  6. */
  7. #import "RCTRootShadowView.h"
  8. #import "RCTI18nUtil.h"
  9. #import "RCTShadowView+Layout.h"
  10. @implementation RCTRootShadowView
  11. - (instancetype)init
  12. {
  13. if (self = [super init]) {
  14. _baseDirection = [[RCTI18nUtil sharedInstance] isRTL] ? YGDirectionRTL : YGDirectionLTR;
  15. _minimumSize = CGSizeZero;
  16. _availableSize = CGSizeMake(INFINITY, INFINITY);
  17. }
  18. return self;
  19. }
  20. - (void)layoutWithAffectedShadowViews:(NSHashTable<RCTShadowView *> *)affectedShadowViews
  21. {
  22. NSHashTable<NSString *> *other = [NSHashTable new];
  23. RCTLayoutContext layoutContext = {};
  24. layoutContext.absolutePosition = CGPointZero;
  25. layoutContext.affectedShadowViews = affectedShadowViews;
  26. layoutContext.other = other;
  27. [self layoutWithMinimumSize:_minimumSize
  28. maximumSize:_availableSize
  29. layoutDirection:RCTUIKitLayoutDirectionFromYogaLayoutDirection(_baseDirection)
  30. layoutContext:layoutContext];
  31. }
  32. @end