We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
H5
浏览器版本: chrome 使用框架: React
import React from 'react' import { View } from '@tarojs/components' import './index.styl' function Index() { const [count, setCount] = React.useState(0) return ( <View className="nutui-react-demo"> <View className="custom-btn" onClick={count >= 0 ? undefined : () => { setCount(count + 1) }} > {count} </View> </View> ) } export default Index
View 初始绑定 onClick 为 undefined,点击报错
View 初始绑定 onClick 为 undefined,点击不报错
👽 Taro v3.6.26 Taro CLI 3.6.26 environment info: System: OS: macOS 12.1 Shell: 5.8 - /bin/zsh Binaries: Node: 16.20.0 - ~/.nvm/versions/node/v16.20.0/bin/node Yarn: 1.22.19 - ~/.nvm/versions/node/v16.20.0/bin/yarn npm: 8.19.4 - ~/.nvm/versions/node/v16.20.0/bin/npm npmPackages: @tarojs/cli: 3.6.26 => 3.6.26 @tarojs/components: 3.6.26 => 3.6.26 @tarojs/helper: 3.6.26 => 3.6.26 @tarojs/mini-runner: 3.6.26 => 3.6.26 @tarojs/plugin-framework-react: 3.6.26 => 3.6.26 @tarojs/plugin-html: 3.6.26 => 3.6.26 @tarojs/plugin-platform-alipay: 3.6.26 => 3.6.26 @tarojs/plugin-platform-h5: 3.6.26 => 3.6.26 @tarojs/plugin-platform-jd: 3.6.26 => 3.6.26 @tarojs/plugin-platform-qq: 3.6.26 => 3.6.26 @tarojs/plugin-platform-swan: 3.6.26 => 3.6.26 @tarojs/plugin-platform-tt: 3.6.26 => 3.6.26 @tarojs/plugin-platform-weapp: 3.6.26 => 3.6.26 @tarojs/react: 3.6.26 => 3.6.26 @tarojs/runtime: 3.6.26 => 3.6.26 @tarojs/shared: 3.6.26 => 3.6.26 @tarojs/taro: 3.6.26 => 3.6.26 @tarojs/webpack-runner: 3.6.26 => 3.6.26 babel-preset-taro: 3.6.26 => 3.6.26 eslint-config-taro: 3.6.26 => 3.6.26 react: ^18.0.0 => 18.0.0 npmGlobalPackages: typescript: 5.0.4
attachProps.ts 代码中,未判断 newEventHandler 不存在的情况,绑定报错
const listener: EventCenter.EventCallback = eventStore[eventName] = function (e: Event) { // React batch event updates unstable_batchedUpdates(() => newEventHandler.call(this, e)) // 控制是否更新受控组件的 value 值 finishedEventHandler(node) } listener.fn = newEventHandler node.addEventListener( eventName, listener ) }
taro/packages/taro-components-library-react/src/react-component-lib/utils/attachProps.ts
Lines 98 to 130 in b3e4a35
The text was updated successfully, but these errors were encountered:
Successfully merging a pull request may close this issue.
相关平台
H5
浏览器版本: chrome
使用框架: React
复现步骤
View 初始绑定 onClick 为 undefined,点击报错
期望结果
View 初始绑定 onClick 为 undefined,点击不报错
实际结果
View 初始绑定 onClick 为 undefined,点击报错
环境信息
补充信息
报错原因
attachProps.ts 代码中,未判断 newEventHandler 不存在的情况,绑定报错
taro/packages/taro-components-library-react/src/react-component-lib/utils/attachProps.ts
Lines 98 to 130 in b3e4a35
The text was updated successfully, but these errors were encountered: