Skip to content

Commit 9aed4d7

Browse files
authored
fix: touchable opacity ignores event on press (#2423)
1 parent fa25c34 commit 9aed4d7

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/components/touchableOpacity/index.tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import _ from 'lodash';
2-
import React, {PureComponent} from 'react';
2+
import React, {BaseSyntheticEvent, PureComponent} from 'react';
33
import {TouchableOpacity as RNTouchableOpacity, TouchableOpacityProps as RNTouchableOpacityProps} from 'react-native';
44
import {
55
asBaseComponent,
@@ -155,12 +155,12 @@ class TouchableOpacity extends PureComponent<Props, {active: boolean}> {
155155
);
156156
}
157157

158-
onPress() {
159-
this.props.onPress?.(this.props);
158+
onPress(event: BaseSyntheticEvent) {
159+
this.props.onPress?.({...this.props, ...event});
160160
}
161161

162-
onLongPress = () => {
163-
this.props.onLongPress?.(this.props);
162+
onLongPress = (event: BaseSyntheticEvent) => {
163+
this.props.onLongPress?.({...this.props, ...event});
164164
};
165165
}
166166

0 commit comments

Comments
 (0)