Skip to content

Commit bcfe8f2

Browse files
rubennortefacebook-github-bot
authored andcommitted
Remove unnecessary Event and CustomEvent polyfills (#50495)
Summary: Pull Request resolved: #50495 Changelog: [internal] This migrates the last remaining usages of these polyfills to the built-in classes. Reviewed By: yungsters Differential Revision: D67828652 fbshipit-source-id: 5ff039d7413aed49d882ff03e722531cdd195488
1 parent 0173839 commit bcfe8f2

File tree

4 files changed

+2
-350
lines changed

4 files changed

+2
-350
lines changed

packages/react-native/Libraries/Events/CustomEvent.js

Lines changed: 0 additions & 32 deletions
This file was deleted.

packages/react-native/Libraries/Events/EventPolyfill.js

Lines changed: 0 additions & 239 deletions
This file was deleted.

packages/react-native/Libraries/ReactPrivate/ReactNativePrivateInterface.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,14 @@
88
* @flow strict-local
99
*/
1010

11+
import typeof CustomEvent from '../../src/private/webapis/dom/events/CustomEvent';
1112
import typeof BatchedBridge from '../BatchedBridge/BatchedBridge';
1213
import typeof legacySendAccessibilityEvent from '../Components/AccessibilityInfo/legacySendAccessibilityEvent';
1314
import typeof TextInputState from '../Components/TextInput/TextInputState';
1415
import typeof ExceptionsManager from '../Core/ExceptionsManager';
1516
import typeof RawEventEmitter from '../Core/RawEventEmitter';
1617
import typeof ReactFiberErrorDialog from '../Core/ReactFiberErrorDialog';
1718
import typeof RCTEventEmitter from '../EventEmitter/RCTEventEmitter';
18-
import typeof CustomEvent from '../Events/CustomEvent';
1919
import typeof {
2020
createPublicInstance,
2121
createPublicRootInstance,
@@ -99,7 +99,7 @@ module.exports = {
9999
return require('../Core/RawEventEmitter').default;
100100
},
101101
get CustomEvent(): CustomEvent {
102-
return require('../Events/CustomEvent').default;
102+
return require('../../src/private/webapis/dom/events/CustomEvent').default;
103103
},
104104
get createAttributePayload(): createAttributePayload {
105105
return require('../ReactNative/ReactFabricPublicInstance/ReactNativeAttributePayload')

packages/react-native/Libraries/__tests__/__snapshots__/public-api-test.js.snap

Lines changed: 0 additions & 77 deletions
Original file line numberDiff line numberDiff line change
@@ -4166,83 +4166,6 @@ declare export default typeof RCTNativeAppEventEmitter;
41664166
"
41674167
`;
41684168

4169-
exports[`public API should not change unintentionally Libraries/Events/CustomEvent.js 1`] = `
4170-
"type CustomEvent$Options = $ReadOnly<{
4171-
bubbles?: boolean,
4172-
cancelable?: boolean,
4173-
composed?: boolean,
4174-
detail?: { ... },
4175-
}>;
4176-
declare class CustomEvent extends EventPolyfill {
4177-
detail: ?{ ... };
4178-
constructor(typeArg: string, options: CustomEvent$Options): void;
4179-
}
4180-
declare export default typeof CustomEvent;
4181-
"
4182-
`;
4183-
4184-
exports[`public API should not change unintentionally Libraries/Events/EventPolyfill.js 1`] = `
4185-
"type Event$Init = {
4186-
bubbles?: boolean,
4187-
cancelable?: boolean,
4188-
composed?: boolean,
4189-
scoped?: boolean,
4190-
...
4191-
};
4192-
interface IEvent {
4193-
constructor(type: string, eventInitDict?: Event$Init): void;
4194-
+type: string;
4195-
+target: EventTarget;
4196-
+srcElement: Element;
4197-
+currentTarget: EventTarget;
4198-
composedPath(): Array<EventTarget>;
4199-
+NONE: number;
4200-
+AT_TARGET: number;
4201-
+BUBBLING_PHASE: number;
4202-
+CAPTURING_PHASE: number;
4203-
+eventPhase: number;
4204-
stopPropagation(): void;
4205-
stopImmediatePropagation(): void;
4206-
+bubbles: boolean;
4207-
+cancelable: boolean;
4208-
preventDefault(): void;
4209-
+defaultPrevented: boolean;
4210-
+composed: boolean;
4211-
+isTrusted: boolean;
4212-
+timeStamp: number;
4213-
+deepPath?: () => EventTarget[];
4214-
+scoped: boolean;
4215-
initEvent(type: string, bubbles: boolean, cancelable: boolean): void;
4216-
}
4217-
declare class EventPolyfill implements IEvent {
4218-
type: string;
4219-
bubbles: boolean;
4220-
cancelable: boolean;
4221-
composed: boolean;
4222-
scoped: boolean;
4223-
isTrusted: boolean;
4224-
defaultPrevented: boolean;
4225-
timeStamp: number;
4226-
NONE: number;
4227-
AT_TARGET: number;
4228-
BUBBLING_PHASE: number;
4229-
CAPTURING_PHASE: number;
4230-
eventPhase: number;
4231-
currentTarget: EventTarget;
4232-
target: EventTarget;
4233-
srcElement: Element;
4234-
constructor(type: string, eventInitDict?: Event$Init): void;
4235-
composedPath(): Array<EventTarget>;
4236-
preventDefault(): void;
4237-
initEvent(type: string, bubbles: boolean, cancelable: boolean): void;
4238-
stopImmediatePropagation(): void;
4239-
stopPropagation(): void;
4240-
setSyntheticEvent(value: mixed): void;
4241-
}
4242-
declare export default typeof EventPolyfill;
4243-
"
4244-
`;
4245-
42464169
exports[`public API should not change unintentionally Libraries/Image/AssetRegistry.js 1`] = `
42474170
"declare const AssetRegistry: {
42484171
registerAsset: (asset: PackagerAsset) => number,

0 commit comments

Comments
 (0)