Fixed problem in Text measurent on iOS

Summary: See the comment it code.

Reviewed By: mmmulani

Differential Revision: D7074168

fbshipit-source-id: e6eda9a47552142ccb0ba8e7bd9a103b0cb4f9f9
This commit is contained in:
Valentin Shergin
2018-02-25 09:23:23 -08:00
committed by Facebook Github Bot
parent 8a073c1d8b
commit a534672e13
4 changed files with 5 additions and 2 deletions

View File

@@ -355,9 +355,12 @@ static YGSize RCTTextShadowViewMeasure(YGNodeRef node, float width, YGMeasureMod
MIN(RCTCeilPixelValue(size.height), maximumSize.height)
};
// Adding epsilon value illuminates problems with converting values from
// `double` to `float`, and then rounding them to pixel grid in Yoga.
CGFloat epsilon = 0.001;
return (YGSize){
RCTYogaFloatFromCoreGraphicsFloat(size.width),
RCTYogaFloatFromCoreGraphicsFloat(size.height)
RCTYogaFloatFromCoreGraphicsFloat(size.width + epsilon),
RCTYogaFloatFromCoreGraphicsFloat(size.height + epsilon)
};
}