Skip to content

Commit

Permalink
fix(react): 禁用 react 合成事件抛出 fix #13223
Browse files Browse the repository at this point in the history
  • Loading branch information
ZakaryCode committed Feb 7, 2023
1 parent 55de2b6 commit ff64cad
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion packages/taro-components-library-react/scripts/fix.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,10 @@ if (fs.existsSync(componentsPath)) {

if (fs.existsSync(attachPropsPath)) {
const codeBuffer = fs.readFileSync(attachPropsPath)
const code = codeBuffer.toString().replace(/const\seventNameLc\s=.+;/g, 'const eventNameLc = eventName.toLowerCase();')
let code = codeBuffer.toString().replace(/const\seventNameLc\s=.+;/g, 'const eventNameLc = eventName.toLowerCase();')

// Note: 禁用 react 合成事件抛出
code = code.replace(/export\sconst\sisCoveredByReact.*(\s\s.*)*\n};/g, 'export const isCoveredByReact = (__eventNameSuffix: string) => false;')

fs.writeFileSync(attachPropsPath, code)
}

0 comments on commit ff64cad

Please sign in to comment.