react-native-reanimated: [v3][Web] `setImmediate` is not defined

Description

This bug has appeared over the years many times. The solution has been to use requestAnimationFrame instead of setImmediate on Web.

The regression came from https://github.com/software-mansion/react-native-reanimated/pull/3970

See: https://github.com/software-mansion/react-native-reanimated/pull/2622 https://github.com/software-mansion/react-native-reanimated/pull/152.

Steps to reproduce

Use Reanimated on Next.js.

Snack or a link to a repository

https://stackblitz.com/edit/nextjs-pxczpl?file=pages%2Findex.js,next.config.js,package.json

Reanimated version

3.0.0

React Native version

0.71

Platforms

Web

JavaScript runtime

None

Workflow

None

Architecture

None

Build type

None

Device

None

Device model

No response

Acknowledgements

Yes

About this issue

  • Original URL
  • State: closed
  • Created a year ago
  • Comments: 17 (7 by maintainers)

Commits related to this issue

Most upvoted comments

I solved this by:

npm i setimmediate and before importing react-native-reanimated:

import "setimmediate"
import "react-native-reanimated"

However I’d prefer not to have this shim necessary

Adding

import “setimmediate”

in App.tsx root file solve my problem