react-native: TypeError: undefined is not an object (evaluating 'ReactCurrentActQueue$1.isBatchingLegacy')
Description
Since this morning, I cannot launch my app in debug mode on Android.
My app build successfully but, I got this in metro: ` BUNDLE ./index.js
LOG Running “MyApp” with {“rootTag”:1} ERROR TypeError: undefined is not an object (evaluating ‘ReactCurrentActQueue$1.isBatchingLegacy’) ERROR TypeError: undefined is not an object (evaluating ‘ReactCurrentActQueue$1.isBatchingLegacy’) `
My app has a blank page.
This is my dependencies:
"dependencies": { "@react-native-masked-view/masked-view": "^0.2.6", "@react-navigation/bottom-tabs": "^6.3.1", "@react-navigation/native": "^6.0.10", "@react-navigation/native-stack": "^6.6.2", "@react-navigation/stack": "^6.2.1", "react": "18.0.0", "react-native": "0.69.0", "react-native-gesture-handler": "^2.4.2", "react-native-pager-view": "^5.4.15", "react-native-safe-area-context": "^4.2.5", "react-native-screens": "^3.13.1", "react-native-svg": "^12.3.0", "react-native-tab-view": "^3.1.1", "react-native-vector-icons": "^9.1.0" },
I tried to downgrade/updgrade some dependencies (react and react-native in particular) but nothing works. Also tried to clear cache from metro, gradlew…
Thanks for your help 😃
Version
0.69.0
Output of npx react-native info
System: OS: macOS 12.4 CPU: (4) x64 Intel® Core™ i5-6267U CPU @ 2.90GHz Memory: 370.74 MB / 8.00 GB Shell: 5.8.1 - /bin/zsh Binaries: Node: 14.16.1 - /usr/local/bin/node Yarn: 1.22.10 - /usr/local/bin/yarn npm: 6.14.12 - /usr/local/bin/npm Watchman: Not Found Managers: CocoaPods: 1.10.1 - /usr/local/bin/pod SDKs: iOS SDK: Platforms: DriverKit 21.4, iOS 15.5, macOS 12.3, tvOS 15.4, watchOS 8.5 Android SDK: Not Found IDEs: Android Studio: 4.2 AI-202.7660.26.42.7351085 Xcode: 13.4.1/13F100 - /usr/bin/xcodebuild Languages: Java: 16.0.1 - /Library/Java/JavaVirtualMachines/jdk-16.0.1.jdk/Contents/Home/bin/javac npmPackages: @react-native-community/cli: Not Found react: 18.0.0 => 18.0.0 react-native: 0.69.0 => 0.69.0 react-native-macos: Not Found npmGlobalPackages: react-native: Not Found
Steps to reproduce
npm i npx react-native run-android
Snack, code example, screenshot, or link to a repository
Maybe, use this configuration
"dependencies": { "@react-native-masked-view/masked-view": "^0.2.6", "@react-navigation/bottom-tabs": "^6.3.1", "@react-navigation/native": "^6.0.10", "@react-navigation/native-stack": "^6.6.2", "@react-navigation/stack": "^6.2.1", "react": "18.0.0", "react-native": "0.69.0", "react-native-gesture-handler": "^2.4.2", "react-native-pager-view": "^5.4.15", "react-native-safe-area-context": "^4.2.5", "react-native-screens": "^3.13.1", "react-native-svg": "^12.3.0", "react-native-tab-view": "^3.1.1", "react-native-vector-icons": "^9.1.0" },
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Comments: 22 (2 by maintainers)
Commits related to this issue
- docs: improve documentation 17.11.2023 (#2613) ## docs fixes - improve setup of project - remove not working scripts and urls - I managed to get Android example app to work, but unfortunately no... — committed to dooboolab-community/react-native-iap by cervebar 7 months ago
- docs: improve documentation 17.11.2023 (#2613) ## docs fixes - improve setup of project - remove not working scripts and urls - I managed to get Android example app to work, but unfortunately no... — committed to arthurgeron/react-native-iap by cervebar 7 months ago
I had to do something more drastic, by upgrading react 17->18.2.0 and react-native 0.64->0.69.1, like so: npm install react@latest react-dom@latest --force npm audit fix --force
Changes to: “react”: “^18.2.0”, “react-dom”: “^18.2.0”, “react-native”: “^0.69.1”,
I was then able to run the native base typescript template
Adding this to my
package.json
(at the root of my monorepo) fixed it for me:No need to downgrade anything. You can also set that
react
version to any 18+ version you’re using.Upgrading
react
from 17.0.2 to 18.0.0 and adding it to the resolutions worked for me“react”: “18.2.0”,
“react-native”: “0.69.3”,
Solved the issue for me
I think this is a version compatibility issue. When I had the same error, I downgraded to this RN version: “npm install react-native@0.68.2 --force”. And it worked for me.
This probably means that, for whatever reason, React 18 is not being used despite being set in the dependencies. For me, I had resolutions set up to use React 17 in the root package.json of my lerna monorepo.