mirror of
https://github.com/zoriya/react-native-web.git
synced 2026-06-03 02:42:05 +00:00
Fix TouchableOpacity onPressStart with React 17
React 17 changed something that means the dispatchConfig is not included in synthetic events. Fix #1833
This commit is contained in:
@@ -88,7 +88,11 @@ function TouchableOpacity(props: Props, forwardedRef): React.Node {
|
|||||||
onLongPress,
|
onLongPress,
|
||||||
onPress,
|
onPress,
|
||||||
onPressStart(event) {
|
onPressStart(event) {
|
||||||
setOpacityActive(event.dispatchConfig.registrationName === 'onResponderGrant' ? 0 : 150);
|
const isGrant =
|
||||||
|
event.dispatchConfig != null
|
||||||
|
? event.dispatchConfig.registrationName === 'onResponderGrant'
|
||||||
|
: event.type === 'keydown';
|
||||||
|
setOpacityActive(isGrant ? 0 : 150);
|
||||||
if (onPressIn != null) {
|
if (onPressIn != null) {
|
||||||
onPressIn(event);
|
onPressIn(event);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user