question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Remote Debugger breaks onPress on Touchable Components

See original GitHub issue

React Native version: 0.61.2

Steps To Reproduce

  1. Enable the remote debugger
  2. Tap a TouchableOpacity with onPress and onLongPress parameters
  3. Note that onLongPress is fired and not onPress even on short taps
  4. 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:open
  • Created 4 years ago
  • Reactions:37
  • Comments:58

github_iconTop GitHub Comments

145reactions
alexciarlillocommented, Feb 27, 2020

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 an adb command but can’t recall what it is.

17reactions
Jlexyccommented, Jun 10, 2020

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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found