Skip to content
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

Can't find variable: setImmediate #824

Closed
emroot opened this issue May 29, 2020 · 2 comments
Closed

Can't find variable: setImmediate #824

emroot opened this issue May 29, 2020 · 2 comments
Labels

Comments

@emroot
Copy link

emroot commented May 29, 2020

Description

I'm using setImmediate with expo, react-native, and next.js for the web client.
When I build my project for the web, any page using react-native-reanimated works fine on Chrome (after I added a polyfill), works on the first load on Safari, but not on subsequent page reloads. I get Can't find variable: setImmediate error. Only happens when I run a production build.
Next.js disabled setImmediate back in Feb. vercel/next.js#10612
Curious if there could be another alternative instead of setImmediate that could be used here.
The mozilla website says this regarding the use of setImmediate:
https://developer.mozilla.org/en-US/docs/Web/API/Window/setImmediate

Non-standard
This feature is non-standard and is not on a standards track. Do not use it on production sites facing the Web: it will not work for every user. There may also be large incompatibilities between implementations and the behavior may change in the future.

Screenshots

image

Steps To Reproduce

  1. Create an expo/next.js project
  2. install react-native-reanimated
  3. Build a production build
  4. Run in Safari/Chrome and observe.

Expected behavior

It shouldn't trigger setImmediate is not defined error.

Actual behavior

It triggers setImmediate is not defined

Snack or minimal code example

Can provide this tomorrow.

Package versions

  • React: ~16.9.0
  • React Native: ~0.61.5
  • React Native Reanimated: ^1.9.0
  • Expo: ^37.0.8
  • Next: ^9.4.4
@emroot
Copy link
Author

emroot commented May 29, 2020

Actually, ignore this. I found a way to inject the polyfill right before I make my call to react-native-reanimated, lower down the chain instead of pages/_app.tsx and it fixes the issue.

@pleaseshutup
Copy link

Actually, ignore this. I found a way to inject the polyfill right before I make my call to react-native-reanimated, lower down the chain instead of pages/_app.tsx and it fixes the issue.

Please tell me how you did it!!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants