mirror of
https://github.com/zhigang1992/react-native.git
synced 2026-04-24 04:16:00 +08:00
Pass the parent size to YGNodeCalculateLayout instead of the node size
Reviewed By: astreet Differential Revision: D4611417 fbshipit-source-id: 2fb0eedffa17f0ec89b601722a1717a72e216b9e
This commit is contained in:
committed by
Facebook Github Bot
parent
f52d66c311
commit
702564fb60
@@ -33,6 +33,16 @@
|
||||
float availableWidth = _availableSize.width == INFINITY ? YGUndefined : _availableSize.width;
|
||||
float availableHeight = _availableSize.height == INFINITY ? YGUndefined : _availableSize.height;
|
||||
|
||||
YGUnit widthUnit = YGNodeStyleGetWidth(self.yogaNode).unit;
|
||||
if (widthUnit == YGUnitUndefined || widthUnit == YGUnitAuto) {
|
||||
YGNodeStyleSetWidthPercent(self.yogaNode, 100);
|
||||
}
|
||||
|
||||
YGUnit heightUnit = YGNodeStyleGetHeight(self.yogaNode).unit;
|
||||
if (heightUnit == YGUnitUndefined || heightUnit == YGUnitAuto) {
|
||||
YGNodeStyleSetHeightPercent(self.yogaNode, 100);
|
||||
}
|
||||
|
||||
YGNodeCalculateLayout(self.yogaNode, availableWidth, availableHeight, _baseDirection);
|
||||
|
||||
NSMutableSet<RCTShadowView *> *viewsWithNewFrame = [NSMutableSet set];
|
||||
|
||||
@@ -242,6 +242,9 @@ static void RCTProcessMetaPropsBorder(const YGValue metaProps[META_PROP_COUNT],
|
||||
hidden:(BOOL)hidden
|
||||
absolutePosition:(CGPoint)absolutePosition
|
||||
{
|
||||
// This is not the core layout method. It is only used by RCTShadowText to layout
|
||||
// nested views.
|
||||
|
||||
if (_hidden != hidden) {
|
||||
// The hidden state has changed. Even if the frame hasn't changed, add
|
||||
// this ShadowView to viewsWithNewFrame so the UIManager will process
|
||||
|
||||
Reference in New Issue
Block a user