android react native svg错误子级,isClassAccessorProperty不是将react native从68.1升级到70.6时的函数

cyej8jka  于 2023-01-07  发布在  Android
关注(0)|答案(1)|浏览(241)

先谢了
当我尝试将react native从68. 1升级到70. 6时,收到了下面的错误。我在android中尝试了这个。
我运行了react-native run-android,一切都很顺利。运行应用程序后,metro bundler开始加载99%,并在红色屏幕上显示此错误

error: node_modules/react-native-svg/src/elements/Shape.tsx: /Users/jarenk/Documents/myApp/node_modules/react-native-svg/src/elements/Shape.tsx: child.isClassAccessorProperty is not a function

有人能帮我一下吗。
我使用的是react原生SVG,它的版本太旧了。我也把它更新到了最新版本。(13.6.0)但是仍然出现了同样的错误。

    • 详细信息中的错误(如果我进行构建)**
./gradlew assembleRelease
    • 出现以下错误**
error node_modules/react-native-svg/src/elements/Shape.tsx: /Users/jarenk/Documents/myApp/node_modules/react-native-svg/src/elements/Shape.tsx: child.isClassAccessorProperty is not a function.
TypeError: /Users/jarenk/Documents/myApp/node_modules/react-native-svg/src/elements/Shape.tsx: child.isClassAccessorProperty is not a function
    at /Users/jarenk/Documents/myApp/node_modules/@babel/plugin-transform-typescript/lib/index.js:361:89
    at Array.forEach (<anonymous>)
    at PluginPass.Class (/Users/jarenk/Documents/myApp/node_modules/@babel/plugin-transform-typescript/lib/index.js:353:31)
    at newFn (/Users/jarenk/Documents/myApp/node_modules/@babel/traverse/lib/visitors.js:171:21)
    at NodePath._call (/Users/jarenk/Documents/myApp/node_modules/@babel/traverse/lib/path/context.js:53:20)
    at NodePath.call (/Users/jarenk/Documents/myApp/node_modules/@babel/traverse/lib/path/context.js:40:17)
    at NodePath.visit (/Users/jarenk/Documents/myApp/node_modules/@babel/traverse/lib/path/context.js:90:31)
    at TraversalContext.visitQueue (/Users/jarenk/Documents/myApp/node_modules/@babel/traverse/lib/context.js:110:16)
    at TraversalContext.visitQueue (/Users/jarenk/Documents/myApp/node_modules/@babel/traverse/lib/context.js:116:21)
info Run CLI with --verbose flag for more details.

再次感谢你。

xzv2uavs

xzv2uavs1#

更新package.json文件帮助我解决了这个问题。
只是降级巴别塔的版本如下

同时确保package-lock.json文件中包含以下相同版本

"@babel/core": "7.12.9",
"@babel/runtime": "7.12.5"

相关问题