Differentiate between onPress, onPressIn and onPressOut
See original GitHub issueIs this a bug report?
Yes (write your answer here)
Have you read the Bugs section of the Contributing to React Native Guide?
Yes (Write your answer here.)
Environment
react-native -v:
0.46.2
node -v:
6.4.0
npm -v:
3.10.3
yarn --version (if you use Yarn):
Then, specify:
- Target Platform: iOS
- Development Operating System: Mac OSX ELC
- Build tools:
Steps to Reproduce
<ToucableOpacity
onPress={()=>console.log('onPress')}
onPressIn={()=>console.log('onPressIn')}
onPressOut={()=>console.log('onPressOut')}
delayPressIn={100}
/>
The onPress
event should not fire if onPressIn
is triggered. If delayPressIn
and delayPressOut
passes, only the pressIn and pressOut should be triggered.
(Write your steps here:)
Expected Behavior
Dont fire pressIn
(Write what you thought would happen.)
Actual Behavior
pressIn is fired inspite of holding it.
(Write what happened. Add screenshots!)
Reproducible Demo
(Paste the link to an example project and exact instructions to reproduce the issue.)
Issue Analytics
- State:
- Created 6 years ago
- Comments:8 (1 by maintainers)
Top Results From Across the Web
react native onpressin and onpressout - Stack Overflow
I tried to create a long press button to keep counting, however the interval wont stop when I release the onPressOut
Read more >Example of onPressIn onPressOut in Pressable React Native
onPressIn :- It calls immediately when user touch the Pressable but before onPress and onPressOut. · onPressOut :- It calls when user release...
Read more >React Native touchable vs. pressable components
Learn the difference between touchable and pressable components in ... the onPress , onPressIn , onPressOut , and onLongPress callbacks.
Read more >Why We Should Use Pressable In React Native
As a React Native developer, you've probably visited the ... onPressIn — is activated, after pressing onPressIn → onPressOut — onPress ...
Read more >Pressable vs. Touchable in React Native | by MahYar - Medium
delayLongPress: Duration in milliseconds from onPressIn by the time ... of the view which a touch is considered a press, before onPressOut ...
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 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
After
onPressIn
event is fired, i see theonPress
event is fired to, whenonPressIn
andonPress
handlers are added on the same<TouchableHighlight>
. Basically I was trying to emulate click to capture and press and hold to record and release to stop recording on the same button.This should patch the RNTouchable components. and works as expected. Reproduces the behavior of snapchat or instagram touch and hold shutter botton
Implementation