【问题标题】:Warning: forwardRef render functions accept exactly two parameters: props and ref. Did you forget to use the ref parameter?native base警告:forwardRef 渲染函数只接受两个参数:props 和 ref。您是否忘记使用 ref 参数?本机基础
【发布时间】:2021-09-24 14:06:02
【问题描述】:

在启动新的 expo 本机基础 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````

【问题讨论】:

  • 我也明白这一点并赞成这个问题,但你应该澄清:这是一个警告,而不是一个错误。

标签: react-native native-base


【解决方案1】:

将原生基础更新到 3.2.1。

"dependencies": {
     "native-base": "^3.2.1"  
},

【讨论】:

  • 正如目前所写,您的答案尚不清楚。请edit 添加其他详细信息,以帮助其他人了解这如何解决所提出的问题。你可以找到更多关于如何写好答案的信息in the help center
  • 有什么理由可以解决这个问题吗?我仍然遇到 3.2.0 的问题
  • 正确的版本是3.2.1-rc.1,我确认这确实会使堆栈跟踪消失。
  • 我可以确认它有效,但我对修复引用转发的更改感兴趣(它是关于什么元素)?
  • 同时发布了native-base 3.2.1。我也可以确认。更新解决了这个问题。
【解决方案2】:

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

【讨论】:

  • 我不使用 react-navigation else .that 是新项目 'hello World' 不使用任何东西
猜你喜欢
  • 1970-01-01
  • 2021-01-07
  • 2014-10-01
  • 1970-01-01
  • 2011-04-16
  • 2019-05-01
  • 1970-01-01
  • 2018-11-11
  • 2018-01-21
相关资源
最近更新 更多