Remote Debugger breaks onPress on Touchable Components
See original GitHub issueReact Native version: 0.61.2
Steps To Reproduce
- Enable the remote debugger
- Tap a TouchableOpacity with
onPress
andonLongPress
parameters - Note that
onLongPress
is fired and notonPress
even on short taps - Works correctly if not in remote debugging
Describe what you expected to happen:
Upon a quick tap the component onLongPress
fires, expected onPress
to fire.
Minimal example
import React, { Component } from 'react';
import { Alert, Text, TouchableOpacity, View } from 'react-native';
class ExampleComponent extends Component<Props> {
public render() {
return (
<View>
<TouchableOpacity
onPress={() => Alert.alert('Press')}
onLongPress={() => Alert.alert('Long Press')}>
<Text>Hello World</Text>
</TouchableOpacity>
</View>
);
}
}
When in remote debugging onLongPress always fires.
Issue Analytics
- State:
- Created 4 years ago
- Reactions:37
- Comments:58
Top Results From Across the Web
onLongPress triggers instead of onPress for single tap
I have a card item with TouchableOpacity which has both onPress and onLongPress ... This is happening only when remote debugger is enabled....
Read more >How do I…? | Input System | 1.0.2 - Unity - Manual
Go to Windows > Analysis > Input Debugger(Debugging.md), then double click on a Device to see its Controls. You can also click the...
Read more >How To Customize React Components with Props
After adding props to your component, you will use PropTypes to define ... If you are running this from a remote server, the...
Read more >Manage touch events in a ViewGroup - Android Developers
To make sure that each view correctly receives the touch events ... some other touch operation, such as touching on-screen elements.
Read more >Debugging - Expo Documentation
Remote debugging with Chrome Developer Tools ... You can debug React Native apps using the Chrome debugger tools. Rather than running your app's...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I believe I ended up tracking this down to an issue with there being a time difference between the host and device. Since the time is off, the calculation for whether it was a short press or long press is broken (or something like that). You can verify this by running
adb shell "date" && date
to see if the times are off. I think I was usually able to fix this by going into the device settings, disabling automatic time resolution, and then re-enabling it. I think there was also a way to do this via anadb
command but can’t recall what it is.I have 1 second difference that I can’t fix. And app doesn’t trigger onPress. Nice to see that this issue isn’t fixed from Oct 25.