Skip to content

Commit a534672

Browse files
sherginfacebook-github-bot
authored andcommitted
Fixed problem in Text measurent on iOS
Summary: See the comment it code. Reviewed By: mmmulani Differential Revision: D7074168 fbshipit-source-id: e6eda9a47552142ccb0ba8e7bd9a103b0cb4f9f9
1 parent 8a073c1 commit a534672

File tree

4 files changed

+5
-2
lines changed

4 files changed

+5
-2
lines changed

Libraries/Text/Text/RCTTextShadowView.m

+5-2
Original file line numberDiff line numberDiff line change
@@ -355,9 +355,12 @@ static YGSize RCTTextShadowViewMeasure(YGNodeRef node, float width, YGMeasureMod
355355
MIN(RCTCeilPixelValue(size.height), maximumSize.height)
356356
};
357357

358+
// Adding epsilon value illuminates problems with converting values from
359+
// `double` to `float`, and then rounding them to pixel grid in Yoga.
360+
CGFloat epsilon = 0.001;
358361
return (YGSize){
359-
RCTYogaFloatFromCoreGraphicsFloat(size.width),
360-
RCTYogaFloatFromCoreGraphicsFloat(size.height)
362+
RCTYogaFloatFromCoreGraphicsFloat(size.width + epsilon),
363+
RCTYogaFloatFromCoreGraphicsFloat(size.height + epsilon)
361364
};
362365
}
363366

Loading
Loading

0 commit comments

Comments
 (0)