Skip to content

Commit

Permalink
fix(react): 修复使用第三方组件不能触发 onClick 事件的问题,fix #7182
Browse files Browse the repository at this point in the history
  • Loading branch information
Chen-jj committed Jul 30, 2020
1 parent 5a5d123 commit 980e145
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions packages/taro-react/src/props.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { TaroElement, Style, document, FormElement } from '@tarojs/runtime'
import { isFunction, isString, isObject, isNumber } from '@tarojs/shared'
import { isFunction, isString, isObject, isNumber, internalComponents, capitalize, toCamelCase } from '@tarojs/shared'
import { CommonEvent } from '@tarojs/components'

export type Props = Record<string, unknown>
Expand Down Expand Up @@ -39,7 +39,11 @@ function setEvent (dom: TaroElement, name: string, value: unknown, oldValue?: un
eventName = eventName.slice(0, -7)
}

if (eventName === 'click') {
const compName = capitalize(toCamelCase(dom.tagName.toLowerCase()))

console.log('compName: ', compName, compName in internalComponents)

if (eventName === 'click' && compName in internalComponents) {
eventName = 'tap'
}

Expand Down

0 comments on commit 980e145

Please sign in to comment.