kdeloach / react-lineto

Draw a line between two elements in React
MIT License
234 stars 63 forks source link

Not working in render #25

Closed francisco1508 closed 5 years ago

francisco1508 commented 5 years ago

Hello, I am using react-lineto in my app, but when my component is rendered the first time it is not working, until I make an event and it is rendered again the connection I want to use appears.

Also when I add a new line it appears scattered, then when it returns to render the component takes its proper place.

jjant commented 5 years ago

@francisco1508 Why did you close this? Same thing's happening to me. @kdeloach Any ideas?

kdeloach commented 5 years ago

Could you provide a code snippet to reproduce this error?

jjant commented 5 years ago

@kdeloach Yeah, it was a pretty complex thing, but shaved it off to this

const A = () =>
  <>
    <div style={{ width: 50, height: 50, marginRight: 40, background: 'white' }} className="c1" />
    <div style={{ width: 50, height: 50, background: 'white' }} className="c2" />
    <LineTo from="c1" to="c2" />
  </>

I added a timeout for the line to render (500ms) and it works

Ivannnnn commented 4 years ago

Had the same problem. If you set delay property to 0 it works just fine.

AmeyPai-dev commented 4 years ago

Hi, So when i render an element on dom, the elements are connected. However when i scroll down, the lines remain fixed on the window and get detached from the dom elements that they are supposed to stay connected with.

itsankitjha commented 1 year ago

Hi, So when i render an element on dom, the elements are connected. However when i scroll down, the lines remain fixed on the window and get detached from the dom elements that they are supposed to stay connected with.

did you able to resolve this?