mirror of
https://github.com/zoriya/react-native-web.git
synced 2026-05-13 03:22:56 +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,
|
||||
onPress,
|
||||
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) {
|
||||
onPressIn(event);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user