Fixes #606 #610

Closed
kovpas wants to merge 4 commits from fix-606 into master
Showing only changes of commit 010d1bb0c2 - Show all commits

View File

@@ -304,10 +304,14 @@ static YGSize YGMeasureView(
const CGFloat constrainedHeight = (heightMode == YGMeasureModeUndefined) ? CGFLOAT_MAX: height;
d16r commented 2017-08-16 13:45:20 -07:00 (Migrated from github.com)
Review

why do we have to check it's a UIView or not?

why do we have to check it's a `UIView` or not?
kovpas commented 2017-08-16 22:47:48 -07:00 (Migrated from github.com)
Review

Because the other classes (like UILabel) return correct size for sizeThatFits if there are no subviews

Because the other classes (like UILabel) return correct size for sizeThatFits if there are no subviews
d16r commented 2017-08-21 12:15:18 -07:00 (Migrated from github.com)
Review

I wonder if there is a cleaner way to do this...I don't want us to check the class of a view every time yoga measures it.

I wonder if there is a cleaner way to do this...I don't want us to check the class of a view every time yoga measures it.
kovpas commented 2017-08-21 12:39:56 -07:00 (Migrated from github.com)
Review

Do you have ideas by any chance? The problem is that it seems that it's only UIView that results in this "odd" behavior - returns current size when it's empty.

Do you have ideas by any chance? The problem is that it seems that it's only UIView that results in this "odd" behavior - returns current size when it's empty.
kovpas commented 2017-08-22 02:18:26 -07:00 (Migrated from github.com)
Review

An option could be to create a flag isUIView in YGLayout and initialize it in initWithView:. What would you say?

An option could be to create a flag `isUIView` in `YGLayout` and initialize it in `initWithView:`. What would you say?
d16r commented 2017-08-22 08:05:04 -07:00 (Migrated from github.com)
Review

I like it! Lets give it a shot.

I like it! Lets give it a shot.
UIView *view = (__bridge UIView*) YGNodeGetContext(node);
priteshrnandgaonkar commented 2018-01-25 03:07:39 -08:00 (Migrated from github.com)
Review

Instead of pointing to the issue. Can you comment in the code, why this check is added.

Instead of pointing to the issue. Can you comment in the code, why this check is added.
priteshrnandgaonkar commented 2018-01-25 03:34:52 -08:00 (Migrated from github.com)
Review

I think !view.yoga.isUIView this check is not required. Happy to hear about your inputs

I think `!view.yoga.isUIView` this check is not required. Happy to hear about your inputs
kovpas commented 2018-01-25 03:54:45 -08:00 (Migrated from github.com)
Review

this condition practically says "we want to invoke sizeThatFits only in case if the measured view is not a UIView instance or it's a UIView, but has got children". The check is needed because we do want to invoke sizeThatFits for a UILabel (for example) that has got no subviews, but returns a correct value as a result of invocation of sizeThatFits

this condition practically says "we want to invoke `sizeThatFits` only in case if the measured view is not a `UIView` instance or it's a `UIView`, but has got children". The check is needed because we do want to invoke `sizeThatFits` for a UILabel (for example) that has got no subviews, but returns a correct value as a result of invocation of `sizeThatFits`
kovpas commented 2018-01-25 03:58:49 -08:00 (Migrated from github.com)
Review

Done.

Done.
priteshrnandgaonkar commented 2018-01-25 03:59:10 -08:00 (Migrated from github.com)
Review

Aah Got it. Can you add a comment(in brief) explaining this before the condition?

Aah Got it. Can you add a comment(in brief) explaining this before the condition?
kovpas commented 2018-01-25 04:02:34 -08:00 (Migrated from github.com)
Review

Done

Done
const CGSize sizeThatFits = [view sizeThatFits:(CGSize) {
.width = constrainedWidth,
.height = constrainedHeight,
}];
CGSize sizeThatFits = CGSizeZero;
if ([view.subviews count] > 0) {
sizeThatFits = [view sizeThatFits:(CGSize) {
.width = constrainedWidth,
.height = constrainedHeight,
}];
}
return (YGSize) {
.width = YGSanitizeMeasurement(constrainedWidth, sizeThatFits.width, widthMode),