React-Native-Web 错误:rnw_blogpost.bundle.js:1414 Uncaught TypeError: 无法读取未定义的属性(读取“isBatchingLegacy”)

fra*_*e13 8 react-native react-native-web

将包添加react-native-web到现有的 RN 应用程序(使用 制作react-native init)。按照此站点的设置进行操作:

https://arry.medium.com/how-to-add-react-native-web-to-an-existing-react-native-project-eb98c952c12f

该项目编译成功,但在浏览器中出现空白屏幕和循环错误:

Uncaught TypeError: Cannot read properties of undefined (reading 'isBatchingLegacy')
Run Code Online (Sandbox Code Playgroud)

我找不到有关此错误的任何信息,我已跟踪相关文件,但不知道如何继续。

小智 19

在将react-test-renderer包从v17升级到v18后运行测试时,我遇到了相同的错误消息。因此,就我而言,我必须将react-test-renderer从v18降级到v17 ,或者将react从v17升级到v18也可以纠正这个错误。

根据此讨论,isBatchingLegacy 是react-test-renderer中已弃用的函数。

所以,我不确定这一点,因为我不知道你现有的 RN 应用程序中有哪些包,但你可以检查你拥有的包版本,看看错误是否来自这里。