mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-05-11 19:42:23 +08:00
Merge pull request #26474 from a-tarasyuk/bug/add-missed-props-to-synthetic-event
[react-native] - Add missed props to synthetic event
This commit is contained in:
4
types/react-native/index.d.ts
vendored
4
types/react-native/index.d.ts
vendored
@@ -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;
|
||||
|
||||
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user