question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Add support for borderRadius

See original GitHub issue

We already have support for specifying border width and border color on a component. Now we would like to have an ability to specify the border radius which will draw curved edges on the component. The API might look like this:

Row.create(c)
        .child(
            Row.create(c)
                ....)
        .child(
            Text.create(c)
                .text("Sample with border radius")
                .textSizeDip(14))
        .child(
            Row.create(c)
                ....)
        .borderColor(Color.BLUE)
        .borderWidthDip(YogaEdge.BOTTOM, 33)
        .borderRadiusDip(TOPLEFT, 2)
        .borderRadiusDip(TOPRIGHT, 2)
        .build();

Or you can specify one value for all edges something like:

Row.create(c)
       .....
        .borderRadiusDip(ALL, 2)
        .build();

Besides specifying radius in Dip, you should be able to specify it in pixel value, resource attribute, dimension, similar to how borderWidth is defined.

Point of contact: @muraziz

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:5
  • Comments:8 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
murazizcommented, Sep 1, 2017

Yes, Border API supports not only border radius, but also other effects such as dotted, dash, multi-color borders. Entry at docs about this API is coming soon.

0reactions
murazizcommented, Dec 6, 2017

Rounded corner borders are already supported, now you can add border radius like this:

Row.create(c)
  .child(
    Text.create(c)
      .text("Hello Litho")
      .textSizeSp(16))
  .border(
    Border.create(c)
      .widthDip(YogaEdge.ALL, 5)
      .color(YogaEdge.ALL, 0xfff36b7f)
      // We set a corner radius of 10 here
      .cornerEffect(10f)
      .build())
  .build();

See https://fblitho.com/docs/borders

Read more comments on GitHub >

github_iconTop Results From Across the Web

border-radius - CSS: Cascading Style Sheets - MDN Web Docs
The border-radius CSS property rounds the corners of an element's outer border edge. You can set a single radius to make circular corners, ......
Read more >
border-radius - CSS-Tricks
You can give any element “rounded corners” by applying a border-radius through CSS. You'll only notice if there is a color change involved....
Read more >
CSS border-radius property - W3Schools
The border-radius property defines the radius of the element's corners. Tip: This property allows you to add rounded corners to elements!
Read more >
How to add border radius on table row - css - Stack Overflow
The code is as follows (and as theazureshadow noted, for earlier browser support, the various vendor prefixes for border-radius need added).
Read more >
border-radius - Can I email
Partially supported in Outlook, Yahoo! Mail. ... The border-radius CSS property rounds the corners of an element's outer border edge.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found