Skip to content

[bug]: Animation flickers on React Native New Architecture #2369

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
1 of 5 tasks
wojtekmaj opened this issue Apr 28, 2025 · 2 comments
Open
1 of 5 tasks

[bug]: Animation flickers on React Native New Architecture #2369

wojtekmaj opened this issue Apr 28, 2025 · 2 comments
Labels
template: bug This issue might be a bug

Comments

@wojtekmaj
Copy link
Contributor

wojtekmaj commented Apr 28, 2025

Which react-spring target are you using?

  • @react-spring/web
  • @react-spring/three
  • @react-spring/native
  • @react-spring/konva
  • @react-spring/zdog

What version of react-spring are you using?

9.7.5

What's Wrong?

Animation flickers:

Nagranie.z.ekranu.2025-04-28.o.23.19.37.mov

To Reproduce

Nothing fancy really:

  const wrapperTransitions = useTransition(isOpen, {
    from: {
      opacity: 0,
      scale: 0.7,
    },
    enter: {
      opacity: 1,
      scale: 1,
    },
    leave: {
      opacity: 0,
      scale: 0.7,
    },
    config: config.gentle,
    onDestroyed: () => {
      if (isOpen) {
        return;
      }

      onDestroyed?.();
    },
  });

  return wrapperTransitions(
    (props, showDialog) =>
      showDialog && (
        <Overlay>
          <Wrapper
            as={AnimatedWrapper}
            aria-label={ariaLabelString}
            style={{
              transform: [{ scale: props.scale }],
              opacity: props.opacity,
            }}
          >
            <TitleAndContentWrapper>
              <Title>{title}</Title>
              <ContentWrapper>{children}</ContentWrapper>
            </TitleAndContentWrapper>
          </Wrapper>
        </Overlay>
      ),
  );

Expected Behaviour

No flicker

Link to repo

Can't provide a sandbox for RN

@wojtekmaj wojtekmaj added the template: bug This issue might be a bug label Apr 28, 2025
@wojtekmaj
Copy link
Contributor Author

wojtekmaj commented Apr 28, 2025

Interesting: adding

Globals.assign({
  requestAnimationFrame: setImmediate,
});

makes it buttery smooth again.

Warning

This workaround has a significant side effect, where animations are no longer played concurrently. This may or may not be a problem in your app.

@dagatsoin
Copy link
Contributor

Indeed this feels weird. As there was a desync.
Maybe it is due to the new RN architecture which is now in sync ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
template: bug This issue might be a bug
Projects
None yet
Development

No branches or pull requests

2 participants