add missed props to synthetic event

This commit is contained in:
Alexaner T
2018-06-12 11:18:22 +03:00
parent 3b8b13474e
commit 446da95f1c
2 changed files with 28 additions and 1 deletions

View File

@@ -10,6 +10,7 @@
// Manuel Alabor <https://github.com/swissmanu>
// Michele Bombardi <https://github.com/bm-software>
// Tanguy Krotoff <https://github.com/tkrotoff>
// Alexander T. <https://github.com/a-tarasyuk>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.6
@@ -360,6 +361,9 @@ export interface NativeSyntheticEvent<T> {
eventPhase: number;
isTrusted: boolean;
nativeEvent: T;
isPropagationStopped(): boolean;
isDefaultPrevented(): boolean;
persist(): void;
preventDefault(): void;
stopPropagation(): void;
target: NodeHandle;

View File

@@ -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 (
<TouchableNativeFeedback
onPress={this.onPressButton}
>
<View style={{width: 150, height: 100, backgroundColor: 'red'}}>
<Text style={{margin: 30}}>Button</Text>
</View>
</TouchableNativeFeedback>
)
}
}
// App State
function appStateListener(state: string) {