Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Border width is not respected in leaf nodes #67

Closed
emilsjolander opened this issue Apr 12, 2017 · 1 comment
Closed

Border width is not respected in leaf nodes #67

emilsjolander opened this issue Apr 12, 2017 · 1 comment

Comments

@emilsjolander
Copy link
Contributor

When we set border color and border width on container components (such as Row/Column or any layout spec), it is drawn correctly respecting the boundaries of child items. However, when we set border on a leaf node (such as TextSpec or any mount spec) the border is overlapping with the actual content of that leaf node. Let's see these two cases:

Case 1: This works fine, i.e. the text content is not overlapped with border:

Column.create(c)
             .child(Text.create(c)
                        .text("Lorem ipsum")
                        .textSizeDip(18))
             .borderColor(Color.GREEN)
             .borderWidthDip(YogaEdge.LEFT, 6)
             .borderWidthDip(YogaEdge.TOP, 6)

Case 2: Here the border is overlapping with the content:

Text.create(c)
             .text("Lorem ipsum")
             .textSizeDip(18)
             .withLayout()
             .borderColor(Color.GREEN)
             .borderWidthDip(YogaEdge.LEFT, 6)
             .borderWidthDip(YogaEdge.TOP, 6)

Possible solution could be to offset the LayoutOutput's bounds when it's calculated (https://github.com/facebook/litho/blob/master/litho-core/src/main/java/com/facebook/litho/LayoutState.java#L215) in the same way as we do with padding.

Point of contact: @muraziz

@colriot
Copy link
Contributor

colriot commented Jun 4, 2019

Already fixed

@colriot colriot closed this as completed Jun 4, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants