Skip to content

Commit

Permalink
Fixed problem in Text measurent on iOS
Browse files Browse the repository at this point in the history
Summary: See the comment it code.

Reviewed By: mmmulani

Differential Revision: D7074168

fbshipit-source-id: e6eda9a47552142ccb0ba8e7bd9a103b0cb4f9f9
  • Loading branch information
shergin authored and facebook-github-bot committed Feb 25, 2018
1 parent 8a073c1 commit a534672
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions Libraries/Text/Text/RCTTextShadowView.m
Original file line number Diff line number Diff line change
Expand Up @@ -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)
};
}

Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit a534672

Please sign in to comment.