kdeloach/react-lineto

Drawn lines not displaying correctly

lema-fr opened this issue · 3 comments

@kdeloach

Hello, I'm using react-lineto in my app to draw lines between elements, but when a page is rendered for the first time, lines are not displaying correctly, for example, should be a vertical line between B&C, but when the page loads for the first time, this line doesn't go from "B" to "C", it goes way up from "C" and displays correctly only if I refresh the page or change screen size.
Could you please provide any tips on how to fix this?

Thank you.

Same problem

I had this problem, rendering the designated DOM elements, and then later rendering the worked for me. For instance, use a setTimeout to trigger the state change that adds the to the DOM

You can use the delay property to render lines after the target DOM elements are added. It uses setTimeout under the hood.