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.

refs on primitives (animation with react-spring)

See original GitHub issue

Is there a way to obtain a ref on objects?

I would like to create a native react-pixi target for react-spring, then you could use it to “natively” animate things outside of react. For instance here’s an example for react-konva:

using hooks: https://codesandbox.io/s/71xj546m46 using render props: https://codesandbox.io/s/4z2vx0l86x

And this was react-blessed: https://twitter.com/0xca0a/status/1000513216672403456

All i need to enable this is a ref and something to update properties. For instance, here’s the kova implementation: https://github.com/drcmda/react-spring/blob/master/src/targets/konva/index.js#L14-L21

Unfortunately ref={r => console.log®} returns currently null, i could still just animate elements with rendering them 60fps with new props, but that is extremely expensive.

Issue Analytics

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

github_iconTop GitHub Comments

1reaction
drcmdacommented, Oct 30, 2018

Seems to work, thanks for the help! https://codesandbox.io/embed/0qkll4y5nw 🙂 This is animating 60fps, no React/forceUpdate involved. Would be ready for react hooks as well.

I only needed this for an article explaining on how to write custom targets on the react-spring site. But if you like we could make this into a real target. All it needs is a better understanding on what objects to set.

0reactions
michalochmancommented, Feb 7, 2019

#95 shows an example how to implement Animated that will skip React’s forceUpdate.

Read more comments on GitHub >

github_iconTop Results From Across the Web

React Spring Imperatives & Refs - GeeksforGeeks
In this article, we will learn how Imperatives and Refs work. React spring is an animation library that makes animating UI elements simple....
Read more >
Getting started | React Spring
React Spring is a library for building interactive, data-driven, and animated UI components. It can animate HTML, SVG, Native Elements, Three.js, and more....
Read more >
All You Need to Know About React Spring Jammed Into 1 Article
In this tutorial, we walk you through using React Spring library to provide awesome animations to your CRA (React App) and enhance your...
Read more >
React Spring Tutorial: Making Animated React Apps | Shakuro
We'll start this React Spring animation tutorial with the simplest hook – useSpring. It transforms the passed values into animated ones. For the ......
Read more >
@play-when-visible/react-spring - npm
@play-when-visible/react-spring provides a set of hooks prefixed with usePWV to create animations. The hooks return a tuple [ref, animation] ...
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