From ff64cad8db80cb77616446a1f428d1ffe37f2db6 Mon Sep 17 00:00:00 2001 From: Zakary Date: Mon, 6 Feb 2023 10:36:12 +0800 Subject: [PATCH] =?UTF-8?q?fix(react):=20=E7=A6=81=E7=94=A8=20react=20?= =?UTF-8?q?=E5=90=88=E6=88=90=E4=BA=8B=E4=BB=B6=E6=8A=9B=E5=87=BA=20fix=20?= =?UTF-8?q?#13223?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/taro-components-library-react/scripts/fix.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/packages/taro-components-library-react/scripts/fix.js b/packages/taro-components-library-react/scripts/fix.js index 93581f7c91aa..4b29b6639007 100644 --- a/packages/taro-components-library-react/scripts/fix.js +++ b/packages/taro-components-library-react/scripts/fix.js @@ -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) }