From 446da95f1cde78313db74661bee66ecfac386175 Mon Sep 17 00:00:00 2001 From: Alexaner T Date: Tue, 12 Jun 2018 11:18:22 +0300 Subject: [PATCH] add missed props to synthetic event --- types/react-native/index.d.ts | 4 ++++ types/react-native/test/index.tsx | 25 ++++++++++++++++++++++++- 2 files changed, 28 insertions(+), 1 deletion(-) diff --git a/types/react-native/index.d.ts b/types/react-native/index.d.ts index eaa2dcccfc..b06d877c4c 100644 --- a/types/react-native/index.d.ts +++ b/types/react-native/index.d.ts @@ -10,6 +10,7 @@ // Manuel Alabor // Michele Bombardi // Tanguy Krotoff +// Alexander T. // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.6 @@ -360,6 +361,9 @@ export interface NativeSyntheticEvent { eventPhase: number; isTrusted: boolean; nativeEvent: T; + isPropagationStopped(): boolean; + isDefaultPrevented(): boolean; + persist(): void; preventDefault(): void; stopPropagation(): void; target: NodeHandle; diff --git a/types/react-native/test/index.tsx b/types/react-native/test/index.tsx index 1f506eb124..9fbad8a870 100644 --- a/types/react-native/test/index.tsx +++ b/types/react-native/test/index.tsx @@ -49,10 +49,12 @@ import { NativeModules, MaskedViewIOS, TextInput, + TouchableNativeFeedback, TextInputFocusEventData, InputAccessoryView, StatusBar, - NativeSyntheticEvent + NativeSyntheticEvent, + GestureResponderEvent } from "react-native"; declare module "react-native" { @@ -195,6 +197,27 @@ class Welcome extends React.Component { export default Welcome; +// SyntheticEventsTest +export class SyntheticEventsTest extends React.Component { + onPressButton(e: GestureResponderEvent) { + e.persist(); + e.isPropagationStopped(); + e.isDefaultPrevented(); + } + + render() { + return ( + + + Button + + + ) + } +} + // App State function appStateListener(state: string) {