onPress not called after holding a button for longer than a second (iOS) (since 0.62)
See original GitHub issueDescription
Since upgrading to 0.62.2 it seems that every “React Native” button (Button, TouchableHighlight etc.) cancels the onPress when pressing a button for longer than a second. I have an app still running on 0.61.5 and there it will still call the onPress after holding a button for longer than a second and releasing it. Is this any new intended behavior? Native libraries like: https://github.com/react-native-community/segmented-control don’t have this behavior.
React Native version:
0.62.2
Steps To Reproduce
- Create a new project with
npx react-native init AwesomeProject
- Press any of the buttons below “Learn More” for longer than a second and release.
Expected Results
I expected that the onPress would be called and I am redirected to the corresponding docs. In an Expo snack, I am still seeing the expected results: https://snack.expo.io/@dylancom/2d8052 Probably due to that Expo SDK 37 is using React Native 0.61
Code example:
import { Button } from 'react-native';
<Button
onPress={() => alert('I should be called')}
title="Hold for > a second and release"
/>
Issue Analytics
- State:
- Created 3 years ago
- Comments:11 (7 by maintainers)
Top Results From Across the Web
React Native onPress being called automatically
The reason is that onPress takes a function as an argument. In your code, you are calling the function and returning the result...
Read more >React Native v0.63.3 Release - GitClear
onPress not called after holding a button for longer than a second (iOS) (since 0.62) ... Fix default nxapi port setting when use_ssl...
Read more >Restart your iPhone - Apple Support
Press and hold either volume button and the side button until the power-off slider appears. The volume button is located on the left...
Read more >Press home button to upgrade (broken home button) - iFixit
I FOUND THE FIX! After a successful update or restore, plug the device into itunes, then set up as new ipad. Go to...
Read more >React Native touchable vs. pressable components
Feel free to jump around this post, too, since we'll be covering a lot: React Native touchable components. Creating a native button ......
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top 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
Ahh… good catch. This was a mistake on my part in the migration for
TouchableBounce
(not technically exported in the Public API) andTouchableHighlight
. I’ll send a fix for it right now.@TomasSestak Correct. If
onLongPress
is not supplied,onPress
will be fired regardless of how long a user presses down.