The line pixel error
We try to make an application with the FlexLayout. The error occurs from the gap between Yoga library calculated value and the actual value for a UIView.
In a case...
In Yoga.cpp, func YGNodelayoutImpl() { ... } else if (alignItem == YGAlignCenter) { //leadingCrossDim += round(remainingCrossDim / 2); //Try to fix leadingCrossDim += remainingCrossDim / 2; } else { ... }
the remainingCrossDim is 37.5 remainingCrossDim / 2 is "18.75"
In YGLayout.mm func YGApplyLayoutToViewHierarchy() { ...
const CGPoint origin = preserveOrigin ? view.frame.origin : CGPointZero; view.frame = (CGRect) { .origin = { .x = YGRoundPixelValue(topLeft.x + origin.x), .y = YGRoundPixelValue(topLeft.y + origin.y), }, .size = { .width = YGRoundPixelValue(bottomRight.x) - YGRoundPixelValue(topLeft.x), .height = YGRoundPixelValue(bottomRight.y) - YGRoundPixelValue(topLeft.y), }, }; ... }
the topLeft.x returns "19"
The gap (between 18.75 and 19 = 0.25) makes the application view hidden in a case.
if we put the source below, the problem is solved. leadingCrossDim += round(remainingCrossDim / 2); //Try to fix
please check and confirm this.