'React-Native-Web error: rnw_blogpost.bundle.js:1414 Uncaught TypeError: Cannot read properties of undefined (reading 'isBatchingLegacy')
Adding react-native-web
package to existing RN app (made with react-native init
). Following the setup from this site:
https://arry.medium.com/how-to-add-react-native-web-to-an-existing-react-native-project-eb98c952c12f
The project compiles successfully, but in the browser I get a blank white screen and an error that loops:
Uncaught TypeError: Cannot read properties of undefined (reading 'isBatchingLegacy')
I can't find anything about this error, I have traced the relevant files and am not sure how to proceed.
Solution 1:[1]
I had the same error message while running test after upgrading react-test-renderer package from v17 to v18. So in my case, I had to downgrade react-test-renderer from v18 to v17 or upgrading react from v17 to v18 also worked to correct this error.
According to this discussion, isBatchingLegacy is a deprecated function in react-test-renderer.
So, I'm not sure about it, because I don't know which packages do you have in your existing RN app, but you can maybe check the packages version you have in order to see if the error could come from here.
Solution 2:[2]
I run into the same problem. Make sure all React dependencies are on the same version in your package.json
.
"react": "~18.0.0",
"react-dom": "^18.0.0",
"react-test-renderer": "^18.0.0"
Solution 3:[3]
Thanks for this, I just spent 4 hours trying to figure out why I got the same error as you with react-native-testing-library
import { render } from "@testing-library/react-native";
I downgraded the types on my package.json
"devDependencies": {
"@testing-library/react-native": "^9.1.0",
"jest": "26",
...
--"@types/react-test-renderer": "18.0.0",
++"@types/react-test-renderer": "17.0.1",
}
It's working now
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | nboyet |
Solution 2 | lillybilly |
Solution 3 | David Leuliette |