From 6fa1fdb46df200c61987684ee844911d3f304c51 Mon Sep 17 00:00:00 2001 From: * <8> Date: Thu, 10 Mar 2022 16:54:28 +0800 Subject: [PATCH 1/2] Match-id-977b8ef12a4b099ecca12564c3063b508f3e3b82 --- libs/horizon/src/event/customEvents/EventFactory.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/libs/horizon/src/event/customEvents/EventFactory.ts b/libs/horizon/src/event/customEvents/EventFactory.ts index db6bfc17..3bad01d4 100644 --- a/libs/horizon/src/event/customEvents/EventFactory.ts +++ b/libs/horizon/src/event/customEvents/EventFactory.ts @@ -10,11 +10,14 @@ const uniqueKeyMap = new Map([ ['Del', 'Delete'], ]); +const noop = () => {}; // 创建普通自定义事件对象实例,和原生事件对应 export function decorateNativeEvent(customEventName, nativeEvtName, nativeEvent) { nativeEvent.isDefaultPrevented = () => nativeEvent.defaultPrevented; nativeEvent.isPropagationStopped = () => nativeEvent.cancelBubble; + // 适配React16事件api + nativeEvent.persist = noop; // custom事件自定义属性 nativeEvent.customEventName = customEventName; From bec923e83dfcaf3c01047d0dda2db9afb45707cc Mon Sep 17 00:00:00 2001 From: * <8> Date: Thu, 10 Mar 2022 17:37:08 +0800 Subject: [PATCH 2/2] Match-id-a965dbe9849e2f595a38731982d03499bc2ef956 --- libs/horizon/src/event/customEvents/EventFactory.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libs/horizon/src/event/customEvents/EventFactory.ts b/libs/horizon/src/event/customEvents/EventFactory.ts index 3bad01d4..8ca28579 100644 --- a/libs/horizon/src/event/customEvents/EventFactory.ts +++ b/libs/horizon/src/event/customEvents/EventFactory.ts @@ -16,7 +16,7 @@ export function decorateNativeEvent(customEventName, nativeEvtName, nativeEvent) nativeEvent.isDefaultPrevented = () => nativeEvent.defaultPrevented; nativeEvent.isPropagationStopped = () => nativeEvent.cancelBubble; - // 适配React16事件api + // 适配老版本事件api nativeEvent.persist = noop; // custom事件自定义属性