Skip to content

width calculation error after setting flexBasis and flexWrap attribute #838

Description

@0x30

AsyncDisplayKit some Waring

Width calculation error after setting flexBasis attribute

I don’t know if I’m dealing with this issue

When I set flexWrap using ASStackLayoutSpec I found this problem. In the end I found out that because of the calculation, the width was out of range. This main problem appears in the following code
ASInternalHelpers ASCeilPixelValue

CGFloat ASCeilPixelValue(CGFloat f)
{
  CGFloat scale = ASScreenScale();
  return ceil(f * scale) / scale;
}

For example
in iPhoneX, the width is 375 and flexBasis is set to 0.5. The scale is 3.
The result is 186.666666666666....
Caused the width to exceed 375

Reproduce this problem

AsyncCeilWidthError

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions