-
Notifications
You must be signed in to change notification settings - Fork 113
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
[expo49, router v2] Metro error: requestAnimationFrame is not defined using drawer #718
Comments
This issue cannot be fixed by modifying the code in this repo |
HI guys, Any workaround to this problem? |
@arivanbastos ✅ expo-router checked |
Hi, I tried running this using Also I'm new to this, what's causing this error and is this due to something being configured wrong? |
Any updates? |
@rohit1804567 Which |
@itsdenispavlovic Did you try my patch-package gist? |
@bhyoo99 It's working now on Expo |
<!-- Thanks for submitting a pull request! We appreciate you spending the time to work on these changes. Please follow the template so that the reviewers can easily understand what the code changes affect. --> ## Summary - expo/router#718 - [Twitter thread](https://twitter.com/bhyoo99/status/1675302401677615104?s=20) In Node.js environments such as when static rendering with Expo Router, requestAnimationFrame is not defined. This results in an error when using libraries that depend on react-native-reanimated like Drawer or when using react-native-reanimated directly in Expo Router with static rendering, causing a hydration mismatch due to rendering errors. In this PR, I added a fallback to setImmediate if requestAnimationFrame is not defined in `globalThis`. I did not simply replace requestAnimationFrame with setImmediate because [`setImmediate` is slower than requestAnimationFrame](#1521) in CSR environments. This issue is not applicable to static rendering environments however, so setImmediate is fine there. <!-- Explain the motivation for this PR. Include "Fixes #<number>" if applicable. --> ## Test plan - See [this issue](expo/router#718 (comment) Minimal reproducible example <!-- Provide a minimal but complete code snippet that can be used to test out this change along with instructions how to run it and a description of the expected behavior. --> --------- Co-authored-by: Tomasz Żelawski <[email protected]> Co-authored-by: Tomek Zawadzki <[email protected]>
For me its not working with the exact same versions when i use the Drawer component |
@IordanisSap Please create a new issue with a reproducible example. This could be a new issue, a problem with your lockfile, etc - we don't know without more information. |
Had this error using drawer. Resolved with deleting yarn.lock and yarn. |
Note: to anyone finding this (including future me), this issue exists in react-native-reanimated 3.3.0, but is now resolved in 3.5.4. |
@tyrauber , but now Always get this warning:
Also tried the latest version of react-native-reanimated (@3.6.1) ... same warning |
@chidexebere, Only if you are using Expo Go. You'd need to use the Expo Dev Client and make a development build, or wait until SDK 50 Release (January 31st) and for the updated Expo Go Client sometime thereafter. |
Which package manager are you using? (Yarn is recommended)
yarn
Summary
Twitter thread
I recently installed a package following the guidelines on this link: https://expo.github.io/router/docs/migration/react-navigation/drawer.
(installed package versions "@react-navigation/drawer": "^6.6.3", "react-native-gesture-handler": "~2.12.0", and "react-native-reanimated": "~3.3.0".)
When I access the page using the
expo start
command, a certain log message appears. However, the web page does not crash.The issue arises when I try to export. I receive an error message
and the build fails.
Minimal reproducible example
yarn create expo --template tabs@beta
cd my-app
change
app/(tab)
folder toapp/(auth)/dashboard
https://expo.github.io/router/docs/migration/react-navigation/drawer
npx expo install @react-navigation/drawer react-native-gesture-handler react-native-reanimated
and change babel.config.js
than change app/(auth)/dashboard/_layout.tsx to
The text was updated successfully, but these errors were encountered: