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.

onPress works after delay on Android

See original GitHub issue

"react-native-draggable-flatlist": "2.0.10", "react-native": "0.61.5",

Simple instance.

<DraggableFlatList
   data={this.props.words}
   renderItem={this.renderItem}
   ...
/>

Any touchable components inside of renderItem component works only after some press delay. Only click is not working, it needs press and wait a bit. Looks like it’s about 100-200 ms. iOS works perfectly, problem is only on Adroid.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:5
  • Comments:28 (15 by maintainers)

github_iconTop GitHub Comments

8reactions
theashguycommented, Jan 28, 2020

Hi there all / @computerjazz!

I can confirm that applying the react-native-gesture-handler touchables works well to solve this one. In my case I’m applying them as an alternative component based on the platform to my ListItem as follows (this example is incomplete obviously):

import {
  Platform,
  TouchableHighlight
} from 'react-native';

import {
  FlatList,
  TouchableNativeFeedback
} from 'react-native-gesture-handler';

<FlatList
    ...props...
    renderItem={({ item }) => (
        <ListItem
            ...props...
            Component={Platform.select({
                android: TouchableNativeFeedback as any,
                default: TouchableHighlight
            })}
            onPress={() =>
                // Do your thing
            }
         />
    )}
/>

Likely should still be looked into as a bug, but this workaround is fully functional and doesn’t seem to have any negative effects. Enjoy!

2reactions
gyuruicommented, Jan 16, 2020

Same issue here. I used this workaround but I am not so satisfied with it:

https://github.com/computerjazz/react-native-draggable-flatlist/issues/99#issuecomment-569099474

Read more comments on GitHub >

github_iconTop Results From Across the Web

React Native onPress event delay - Stack Overflow
when I touch TouchableOpacity or TouchableWithoutFeedback in Android there is some second delay for trigger onPress event and I don't know why.
Read more >
TouchableWithoutFeedback - React Native
Importantly, TouchableWithoutFeedback works by cloning its child and applying ... This time period can be customized with delayLongPress .
Read more >
Buttons | React Native Gesture Handler - Software Mansion
function that gets triggered when the button gets pressed for at least delayLongPress milliseconds. rippleColor (Android only)​. defines color of native ripple ...
Read more >
Button | Android Developers
To specify an action when the button is pressed, set a click listener on the button object ... android:scrollbarDefaultDelayBeforeFade, Defines the delay in ......
Read more >
[Resolve]-React Native onPress event delay - appsloveworld
when I touch TouchableOpacity or TouchableWithoutFeedback in Android there is some second delay for trigger onPress event and I don't know why. anyone...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

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