react-spring icon indicating copy to clipboard operation
react-spring copied to clipboard

[bug]: Crash to white screen

Open leo-petrucci opened this issue 1 year ago • 10 comments

Which react-spring target are you using?

  • [ ] @react-spring/web
  • [ ] @react-spring/three
  • [x] @react-spring/native
  • [ ] @react-spring/konva
  • [ ] @react-spring/zdog

What version of react-spring are you using?

10.0.0

What's Wrong?

I'm trying to use react-spring in an Expo React Native app however the app crashes to white screen as soon as I open it.

To Reproduce

  1. I installed @react-spring/native
  2. I imported import { useSpring, animated } from "@react-spring/native";
  3. Add useSpring to a component
  4. App crashes with white screen.

Expected Behaviour

App shouldn't crash.

Link to repo

https://github.com/leo-petrucci/react-spring-native-bug/tree/master

leo-petrucci avatar May 14 '25 19:05 leo-petrucci

I just noticed 10.0.0 got released. I updated and now I'm only getting a white screen :/

leo-petrucci avatar May 14 '25 20:05 leo-petrucci

@leo-petrucci I can reproduce it indeed :( It affect also the web version. I have no work around for now. I will try to take a look this evening.

dagatsoin avatar May 15 '25 09:05 dagatsoin

@dagatsoin Thank you! I think the initial issue was caused by me trying to use it with React 19. I'll update the OP/Title

leo-petrucci avatar May 15 '25 14:05 leo-petrucci

resolved by #2372

joshuaellis avatar May 21 '25 07:05 joshuaellis

@joshuaellis I don't think the last fix solves this, it seems to be an other root cause.

dagatsoin avatar May 21 '25 08:05 dagatsoin

On my test, the loop property blocks the process, so the blank page. Happens on web and native.

dagatsoin avatar May 21 '25 09:05 dagatsoin

@leo-petrucci there is a work around. It seems to work if you use the function props. In your case:

useSpring(() => ({
    from: { rotate: "0deg" },
    to: [
      { rotate: "0deg" },
      { rotate: "-5deg" },
      { rotate: "5deg" },
      { rotate: "0deg" },
    ],
    config: { duration: 100 },
    loop: true,
}), []);

dagatsoin avatar May 21 '25 09:05 dagatsoin

This is working for me without the workaround mentioned by @dagatsoin 👀

Thank you for fixing this!

leo-petrucci avatar May 28 '25 08:05 leo-petrucci

@leo-petrucci ok that's weird but happy to read! Sorry @joshuaellis you can re-close it. The bug persists for me, but the root cause may be elsewhere 🛸

dagatsoin avatar May 28 '25 08:05 dagatsoin

Hi maintainers 👋 I’d like to work on this issue. Please let me know if it’s already assigned to someone. Thanks!

hrishikesh2810 avatar Jan 12 '26 05:01 hrishikesh2810