pmndrs / react-three-flex

💪📦 Flexbox for react-three-fiber
MIT License
1.64k stars 42 forks source link

React-spring compatibility #8

Open giulioz opened 4 years ago

giulioz commented 4 years ago

We should add some examples and investigate how to integrate them nicely with the reflow

promontis commented 3 years ago

I would also love to see some examples 🤗

bbohlender commented 3 years ago

I think the best way for a react-spring integration would be a decoupling between r3f/flex and three where

      group.position.copy(position)

is set. If instead of setting the position directly, the Box-Element can pass a callback that is saved to the boxRefs, which can still just set the position or use a spring to change the position or execute any other function. This would enable much more control over when and why an element is repositioned while still persisting the current functionality.

I would love to hear your thoughts, and I would also offer to implement this as a PR and make an example 😃