3.X版本开启debugReact后picker组件控制台出现Each child in a list should have a unique "key" prop.
NutUI React 包名
@nutui/nutui-react-taro
NutUI React 版本号
3.0.7
平台
weapp
重现链接
https://github.com/2286721642/nutui-issue-picker
重现步骤
在config/dev.ts文件里设置mini.debugReact: true
简单地创建picker组件
打开picker组件 此时微信开发者工具报Warning: Each child in a list should have a unique "key" prop.
在picker组件上点击取消或者确定按钮微信开发者工具报Warning: Failed prop type: Right-hand side of 'instanceof' is not an object
期望的结果是什么?
无任何警告和报错
实际的结果是什么?
出现Warning: Each child in a list should have a unique "key" prop. 和Warning: Failed prop type: Right-hand side of 'instanceof' is not an object
环境信息
👽 Taro v4.0.9
Taro CLI 4.0.9 environment info: System: OS: macOS 12.7.6 Shell: 5.8.1 - /bin/zsh Binaries: Node: 22.14.0 - /opt/local/bin/node npm: 10.9.0 - /opt/local/bin/npm npmPackages: @tarojs/cli: 4.0.9 => 4.0.9 @tarojs/components: 4.0.9 => 4.0.9 @tarojs/helper: 4.0.9 => 4.0.9 @tarojs/plugin-framework-react: 4.0.9 => 4.0.9 @tarojs/plugin-html: 4.0.9 => 4.0.9 @tarojs/plugin-platform-alipay: 4.0.9 => 4.0.9 @tarojs/plugin-platform-h5: 4.0.9 => 4.0.9 @tarojs/plugin-platform-jd: 4.0.9 => 4.0.9 @tarojs/plugin-platform-qq: 4.0.9 => 4.0.9 @tarojs/plugin-platform-swan: 4.0.9 => 4.0.9 @tarojs/plugin-platform-tt: 4.0.9 => 4.0.9 @tarojs/plugin-platform-weapp: 4.0.9 => 4.0.9 @tarojs/react: 4.0.9 => 4.0.9 @tarojs/runtime: 4.0.9 => 4.0.9 @tarojs/shared: 4.0.9 => 4.0.9 @tarojs/taro: 4.0.9 => 4.0.9 @tarojs/taro-loader: 4.0.9 => 4.0.9 @tarojs/webpack5-runner: 4.0.9 => 4.0.9 babel-preset-taro: 4.0.9 => 4.0.9 eslint-config-taro: 4.0.9 => 4.0.9 react: ^18.0.0 => 18.3.1
其他补充信息
No response
我的问题是Dialog组件, 也是报: Right-hand side of 'instanceof' is not an object 错误
Warning: Failed prop type: Right-hand side of 'instanceof' is not an object
at CSSTransition (http://127.0.0.1:12669/appservice/vendors.js:44156:35)
at Overlay (http://127.0.0.1:12669/appservice/vendors.js:2031:130)
at view
at BaseDialog (http://127.0.0.1:12669/appservice/pages/jd-modal/index.js:406:91)
at JDModal (http://127.0.0.1:12669/appservice/pages/jd-modal/index.js:937:66)
at view
at JDPageScroll (http://127.0.0.1:12669/appservice/common.js:320:23)
at view
at JDPageWrap (http://127.0.0.1:12669/appservice/common.js:347:23)
at Index (http://127.0.0.1:12669/appservice/pages/jd-modal/index.js:769:142)
at root
at PageWrapper (http://127.0.0.1:12669/appservice/taro.js:564:146)
at view
at App (http://127.0.0.1:12669/appservice/app.js:28:21)
at AppWrapper (http://127.0.0.1:12669/appservice/taro.js:666:144)
我是Popup组件,也是报这个错误: Warning: Failed prop type: Right-hand side of 'instanceof' is not an object at CSSTransition (http://127.0.0.1:22299/appservice/sub-booking/sub-vendors.js:1844:39)
我是Popup组件,也是报这个错误: Warning: Failed prop type: Right-hand side of 'instanceof' is not an object at CSSTransition (http://127.0.0.1:22299/appservice/sub-booking/sub-vendors.js:1844:39)
CSSTransition 中用的 element.ownerDocument.defaultView.Element 判断是不是 Element 但是 Taro 中 Element.prototype.ownerDocument.defaultView.Element 为空,可以手动设置
Element.prototype.ownerDocument.defaultView.Element = Element
https://github.com/reactjs/react-transition-group/blob/2989b5b87b4b4d1001f21c8efa503049ffb4fe8d/src/Transition.js#L421