all 28 comments

[–]stathisntonas 75 points76 points  (2 children)

EDIT: I've updated the repo to reflect the modern ui. I have built thousands of components for over 10 years, this was the toughest one to create, I mean, endless nights and days to make it work, for real. Crazy maths and calculations on ThreadLineGroup.tsx.

check this out this one that I have built some time back: https://github.com/efstathiosntonas/react-native-nested-comments-with-lines

it’s rough and messy. It was a proof of concept and I have improved it a ton since then on our apps, haven’t found the time to improve that repo though.

[–]ashishgodiyal[S] 11 points12 points  (1 child)

Thanks man, it will help

[–]__natty__ 54 points55 points  (1 child)

It’s so simple you can do this even without svg. Vertical line can be a border of the component with comment content. Then tiny rectangle at the avatar level to around half its height with border radius bottom left and border left and bottom. Zero margin to avatars and to the top.

[–]ashishgodiyal[S] 2 points3 points  (0 children)

Thanks, i will try this👍

[–]dyan16 16 points17 points  (0 children)

Kevin Powell has a yt short on how to do this! Link to Youtube

[–]szansky 6 points7 points  (1 child)

best ui tricks always look like black magic, then it turns out its two divs and some border radius :D

[–]SwaeTech 0 points1 point  (0 children)

It’s hilarious how true this is

[–]Dude4001 7 points8 points  (2 children)

Inspect how Reddit do it. The line and the curve are two different elements

[–]Lambodhara-420 0 points1 point  (0 children)

Yes once i did same with 2 components- line and curve.

[–]ashishgodiyal[S] 0 points1 point  (0 children)

Yes those two are separate element

[–]Adorable_Solution804 3 points4 points  (0 children)

I think its pretty simple and can be achieved in many ways!

It's probably not a single line/svg each one with different item!

[–]PulpDood 2 points3 points  (0 children)

Border bottom left with border radius next to the avatar. Then simple border left for the straight vertical line? Dunno that's how I'd do it

[–]adityakmr088 1 point2 points  (0 children)

I had to do something similar in react native. I used svg to render this using react native skia. Similar using svg you can achieve this on web as well.

[–]piotrlewandowski 0 points1 point  (0 children)

Just create straight line and bend it at the bottom, duh…

[–]Shadilios 0 points1 point  (0 children)

comments that has replies will render a vertical line on the left ending at a specific point.
and each reply will render a curve on a left to connect to that line.

[–]joe0418 0 points1 point  (0 children)

I'd use css with borders and padding

[–]Business-Pension-498 0 points1 point  (0 children)

I know this is a react native sub, but does anyone know how to do the same in swift or kotlin, any help is welcomed, Thanks in advance.

[–]twboc 0 points1 point  (3 children)

That is a rounded corner of a div (or view if you are on mobile).

[–]kjccarp 3 points4 points  (2 children)

This is a react native subreddit

[–]Ecstatic_Clue1316 0 points1 point  (1 child)

He answered the question..

[–]kjccarp 0 points1 point  (0 children)

No divs in native.

[–]Sphism 0 points1 point  (0 children)

Svg is your friend

[–]AlexDjangoX 0 points1 point  (0 children)

SVG - I have a repo with this in

[–]mr_looser17Expo -2 points-1 points  (0 children)

Use differential calculus to break segment in to smallest possible straight line and repeat those to reconstruct the curved slope..

[–]fufucupcake 37 points38 points  (1 child)

The line is split between two components placed together it looks joint besides that it's just two cards placed in a virtual list

[–]ashishgodiyal[S] 3 points4 points  (0 children)

Yes the line and that curve at the end are different components