Skip to content

Commit

Permalink
[0.73] Rework EventPhase type to avoid using TS enum (#12909)
Browse files Browse the repository at this point in the history
* Rework EventPhase type to avoid using TS enum

* Change files
  • Loading branch information
acoates-ms committed Apr 23, 2024
1 parent f674ba3 commit 8991de3
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 10 deletions.
@@ -0,0 +1,7 @@
{
"type": "patch",
"comment": "Rework EventPhase type to avoid using TS enum",
"packageName": "react-native-windows",
"email": "30809111+acoates-ms@users.noreply.github.com",
"dependentChangeType": "patch"
}
24 changes: 14 additions & 10 deletions vnext/src/Libraries/Components/View/ViewPropTypes.d.ts
Expand Up @@ -172,16 +172,16 @@ export interface ViewPropsAndroid {

// [Windows

export enum EventPhase {
None = 0,
Capturing,
AtTarget,
Bubbling,
export namespace EventPhase {
export const None = 0;
export const Capturing = 1;
export const AtTarget = 2;
export const Bubbling = 3;
}

export enum HandledEventPhase {
Capturing = EventPhase.Capturing,
Bubbling = EventPhase.Bubbling,
export namespace HandledEventPhase {
const Capturing = EventPhase.Capturing;
const Bubbling = EventPhase.Bubbling;
}

export interface INativeKeyboardEvent {
Expand All @@ -191,7 +191,11 @@ export interface INativeKeyboardEvent {
shiftKey: boolean;
key: string;
code: string;
eventPhase: EventPhase;
eventPhase:
| EventPhase.None
| EventPhase.Capturing
| EventPhase.AtTarget
| EventPhase.Bubbling;
}

export interface IHandledKeyboardEvent {
Expand All @@ -200,7 +204,7 @@ export interface IHandledKeyboardEvent {
metaKey?: boolean;
shiftKey?: boolean;
code: string;
handledEventPhase?: HandledEventPhase;
handledEventPhase?: EventPhase.Capturing | EventPhase.Bubbling;
}

export type IKeyboardEvent = NativeSyntheticEvent<INativeKeyboardEvent>;
Expand Down

0 comments on commit 8991de3

Please sign in to comment.