Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions packages/react-native/Libraries/Types/CoreEventTypes.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,24 +11,24 @@
import type {HostInstance} from '../../src/private/types/HostInstance';

export type NativeSyntheticEvent<out T> = Readonly<{
bubbles: ?boolean,
cancelable: ?boolean,
bubbles: boolean,
cancelable: boolean,
currentTarget: number | HostInstance,
defaultPrevented: ?boolean,
defaultPrevented: boolean,
dispatchConfig: Readonly<{
registrationName: string,
}>,
eventPhase: ?number,
eventPhase: number,
preventDefault: () => void,
isDefaultPrevented: () => boolean,
stopPropagation: () => void,
isPropagationStopped: () => boolean,
isTrusted: ?boolean,
isTrusted: boolean,
nativeEvent: T,
persist: () => void,
target: ?number | HostInstance,
timeStamp: number,
type: ?string,
type: string,
}>;

export type ResponderSyntheticEvent<T> = Readonly<{
Expand Down
12 changes: 6 additions & 6 deletions packages/react-native/ReactNativeApi.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3180,19 +3180,19 @@ declare type NativeScrollVelocity = {
readonly y: number
}
declare type NativeSyntheticEvent<T> = {
readonly bubbles: boolean | undefined
readonly cancelable: boolean | undefined
readonly bubbles: boolean
readonly cancelable: boolean
readonly currentTarget: HostInstance | number
readonly defaultPrevented: boolean | undefined
readonly defaultPrevented: boolean
readonly dispatchConfig: {
readonly registrationName: string
}
readonly eventPhase: number | undefined
readonly isTrusted: boolean | undefined
readonly eventPhase: number
readonly isTrusted: boolean
readonly nativeEvent: T
readonly target: (number | undefined) | HostInstance
readonly timeStamp: number
readonly type: string | undefined
readonly type: string
readonly isDefaultPrevented: () => boolean
readonly isPropagationStopped: () => boolean
readonly persist: () => void
Expand Down
3 changes: 3 additions & 0 deletions packages/react-native/__typetests__/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -391,6 +391,9 @@ processColor(Symbol('test'));
const testNativeSyntheticEvent = <T extends {}>(
e: NativeSyntheticEvent<T>,
): void => {
const baseEvent: React.BaseSyntheticEvent = e;
baseEvent.preventDefault();

e.isDefaultPrevented();
e.preventDefault();
e.isPropagationStopped();
Expand Down
Loading