警告:forwardRef 渲染函数只接受两个参数:props 和 ref。您是否忘记使用 ref 参数?native base

Ahm*_*ter 14 react-native native-base

启动新的 expo Native Base js 项目 Native Base 3.2.0 expo 4.12.0 每个包都很好,没有问题,运行项目时出现此错误:-

at node_modules/react/cjs/react.development.js:315:4 in printWarning
at node_modules/react/cjs/react.development.js:287:16 in error
at node_modules/react/cjs/react.development.js:1424:13 in forwardRef
at node_modules/native-base/src/components/composites/Skeleton/SkeletonCircle.tsx:12:20 in <global>
at node_modules/native-base/src/components/composites/Skeleton/index.tsx:3:0 in <global>
at node_modules/native-base/src/components/composites/index.ts:37:0 in <global>
at node_modules/native-base/src/index.tsx:7:0 in <global>
at App.js:2:0 in <global>
at node_modules/expo/AppEntry.js:3:0 in <global>
at http://packager.gi-qyq.anonymous.my-furniture.exp.direct/node_modules/expo/AppEntry.bundle?platform=android&dev=true&hot=false&minify=false:202324:3 in global code````
Run Code Online (Sandbox Code Playgroud)

小智 12

将 native-base 更新到 3.2.1。

"dependencies": {
     "native-base": "^3.2.1"  
},
Run Code Online (Sandbox Code Playgroud)

  • 正确的版本是“3.2.1-rc.1”,我确认这确实会使堆栈跟踪消失。 (2认同)

小智 1

你使用的是react-navigation 6.x吗?如果是这样,请尝试使用钩子,例如 useRoute、useNavigation,而不是将它们作为 props 传递。