Permalink
Browse files

`RCTShadowViews`'s `cssNode` property was renamed to `yogaNode`

Reviewed By: javache

Differential Revision: D4590104

fbshipit-source-id: 7767aaa62bcbdce2746c3a26543052dd46be63e0
  • Loading branch information...
shergin authored and facebook-github-bot committed Feb 21, 2017
1 parent a7d3940 commit e361ce86733e505cf763b957c80c4de08efa5942
@@ -29,9 +29,9 @@ - (void)setUp
[super setUp];
self.parentView = [RCTRootShadowView new];
YGNodeStyleSetFlexDirection(self.parentView.cssNode, YGFlexDirectionColumn);
YGNodeStyleSetWidth(self.parentView.cssNode, 440);
YGNodeStyleSetHeight(self.parentView.cssNode, 440);
YGNodeStyleSetFlexDirection(self.parentView.yogaNode, YGFlexDirectionColumn);
YGNodeStyleSetWidth(self.parentView.yogaNode, 440);
YGNodeStyleSetHeight(self.parentView.yogaNode, 440);
self.parentView.reactTag = @1; // must be valid rootView tag
}
@@ -82,10 +82,10 @@ - (void)testApplyingLayoutRecursivelyToShadowView
YGNodeStyleSetFlex(node, 1);
}];
YGNodeStyleSetPadding(self.parentView.cssNode, YGEdgeLeft, 10);
YGNodeStyleSetPadding(self.parentView.cssNode, YGEdgeTop, 10);
YGNodeStyleSetPadding(self.parentView.cssNode, YGEdgeRight, 10);
YGNodeStyleSetPadding(self.parentView.cssNode, YGEdgeBottom, 10);
YGNodeStyleSetPadding(self.parentView.yogaNode, YGEdgeLeft, 10);
YGNodeStyleSetPadding(self.parentView.yogaNode, YGEdgeTop, 10);
YGNodeStyleSetPadding(self.parentView.yogaNode, YGEdgeRight, 10);
YGNodeStyleSetPadding(self.parentView.yogaNode, YGEdgeBottom, 10);
[self.parentView insertReactSubview:headerView atIndex:0];
[self.parentView insertReactSubview:mainView atIndex:1];
@@ -167,8 +167,8 @@ - (void)testDoesNotOverrideDimensionStyleWithSuggestedDimensions
- (void)testDoesNotAssignSuggestedDimensionsWhenStyledWithFlexAttribute
{
float parentWidth = YGNodeStyleGetWidth(self.parentView.cssNode).value;
float parentHeight = YGNodeStyleGetHeight(self.parentView.cssNode).value;
float parentWidth = YGNodeStyleGetWidth(self.parentView.yogaNode).value;
float parentHeight = YGNodeStyleGetHeight(self.parentView.yogaNode).value;
[self _withShadowViewWithStyle:^(YGNodeRef node) {
YGNodeStyleSetFlex(node, 1);
}
@@ -194,7 +194,7 @@ - (void)_withShadowViewWithStyle:(void(^)(YGNodeRef node))configBlock
- (RCTShadowView *)_shadowViewWithConfig:(void(^)(YGNodeRef node))configBlock
{
RCTShadowView *shadowView = [RCTShadowView new];
configBlock(shadowView.cssNode);
configBlock(shadowView.yogaNode);
return shadowView;
}
@@ -73,7 +73,7 @@ - (instancetype)init
_writingDirection = NSWritingDirectionNatural;
_cachedEffectiveLayoutDirection = UIUserInterfaceLayoutDirectionLeftToRight;
YGNodeSetMeasureFunc(self.cssNode, RCTMeasure);
YGNodeSetMeasureFunc(self.yogaNode, RCTMeasure);
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(contentSizeMultiplierDidChange:)
@@ -94,14 +94,14 @@ - (NSString *)description
return [[superDescription substringToIndex:superDescription.length - 1] stringByAppendingFormat:@"; text: %@>", [self attributedString].string];
}
- (BOOL)isCSSLeafNode
- (BOOL)isYogaLeafNode
{
return YES;
}
- (void)contentSizeMultiplierDidChange:(NSNotification *)note
{
YGNodeMarkDirty(self.cssNode);
YGNodeMarkDirty(self.yogaNode);
[self dirtyText];
}
@@ -166,7 +166,7 @@ - (void)applyLayoutToChildren:(YGNodeRef)node
NSRange characterRange = [layoutManager characterRangeForGlyphRange:glyphRange actualGlyphRange:NULL];
[layoutManager.textStorage enumerateAttribute:RCTShadowViewAttributeName inRange:characterRange options:0 usingBlock:^(RCTShadowView *child, NSRange range, BOOL *_) {
if (child) {
YGNodeRef childNode = child.cssNode;
YGNodeRef childNode = child.yogaNode;
float width = YGNodeStyleGetWidth(childNode).value;
float height = YGNodeStyleGetHeight(childNode).value;
if (YGFloatIsUndefined(width) || YGFloatIsUndefined(height)) {
@@ -324,8 +324,8 @@ - (NSAttributedString *)_attributedStringWithFontFamily:(NSString *)fontFamily
[attributedString appendAttributedString:[[NSAttributedString alloc] initWithString:shadowRawText.text ?: @""]];
[child setTextComputed];
} else {
float width = YGNodeStyleGetWidth(child.cssNode).value;
float height = YGNodeStyleGetHeight(child.cssNode).value;
float width = YGNodeStyleGetWidth(child.yogaNode).value;
float height = YGNodeStyleGetHeight(child.yogaNode).value;
if (YGFloatIsUndefined(width) || YGFloatIsUndefined(height)) {
RCTLogError(@"Views nested within a <Text> must have a width and height");
}
@@ -365,7 +365,7 @@ - (NSAttributedString *)_attributedStringWithFontFamily:(NSString *)fontFamily
// create a non-mutable attributedString for use by the Text system which avoids copies down the line
_cachedAttributedString = [[NSAttributedString alloc] initWithAttributedString:attributedString];
YGNodeMarkDirty(self.cssNode);
YGNodeMarkDirty(self.yogaNode);
return _cachedAttributedString;
}
@@ -33,10 +33,10 @@ - (instancetype)init
float availableWidth = _availableSize.width == INFINITY ? YGUndefined : _availableSize.width;
float availableHeight = _availableSize.height == INFINITY ? YGUndefined : _availableSize.height;
YGNodeCalculateLayout(self.cssNode, availableWidth, availableHeight, _baseDirection);
YGNodeCalculateLayout(self.yogaNode, availableWidth, availableHeight, _baseDirection);
NSMutableSet<RCTShadowView *> *viewsWithNewFrame = [NSMutableSet set];
[self applyLayoutNode:self.cssNode viewsWithNewFrame:viewsWithNewFrame absolutePosition:CGPointZero];
[self applyLayoutNode:self.yogaNode viewsWithNewFrame:viewsWithNewFrame absolutePosition:CGPointZero];
return viewsWithNewFrame;
}
@@ -44,7 +44,7 @@ typedef void (^RCTApplierBlock)(NSDictionary<NSNumber *, UIView *> *viewRegistry
- (void)removeReactSubview:(RCTShadowView *)subview NS_REQUIRES_SUPER;
@property (nonatomic, weak, readonly) RCTShadowView *superview;
@property (nonatomic, assign, readonly) YGNodeRef cssNode;
@property (nonatomic, assign, readonly) YGNodeRef yogaNode;
@property (nonatomic, copy) NSString *viewName;
@property (nonatomic, strong) UIColor *backgroundColor; // Used to propagate to children
@property (nonatomic, copy) RCTDirectEventBlock onLayout;
@@ -211,11 +211,11 @@ typedef void (^RCTApplierBlock)(NSDictionary<NSNumber *, UIView *> *viewRegistry
absolutePosition:(CGPoint)absolutePosition;
/**
* Return whether or not this node acts as a leaf node in the eyes of Yoga. For example
* RCTShadowText has children which it does not want Yoga to lay out so in the eyes of
* Yoga it is a leaf node.
* Return whether or not this node acts as a leaf node in the eyes of Yoga.
* For example `RCTShadowText` has children which it does not want Yoga
* to lay out so in the eyes of Yoga it is a leaf node.
*/
- (BOOL)isCSSLeafNode;
- (BOOL)isYogaLeafNode;
- (void)dirtyPropagation NS_REQUIRES_SUPER;
- (BOOL)isPropagationDirty;
@@ -246,3 +246,13 @@ typedef void (^RCTApplierBlock)(NSDictionary<NSNumber *, UIView *> *viewRegistry
- (BOOL)viewIsDescendantOf:(RCTShadowView *)ancestor;
@end
@interface RCTShadowView (Deprecated)
@property (nonatomic, assign, readonly) YGNodeRef cssNode
__deprecated_msg("Use `yogaNode` instead.");
- (BOOL)isCSSLeafNode
__deprecated_msg("Use `isYogaLeafNode` instead.");
@end
Oops, something went wrong.

0 comments on commit e361ce8

Please sign in to comment.