Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The Button On Press event are not firing in the correct order #4406

Open
Msuf123 opened this issue Dec 24, 2024 · 0 comments
Open

The Button On Press event are not firing in the correct order #4406

Msuf123 opened this issue Dec 24, 2024 · 0 comments

Comments

@Msuf123
Copy link

Msuf123 commented Dec 24, 2024

Description

Hey i was reading through your react-native-docs that's where i noticed this line

On an element wrapped by Pressable:

onPressIn is called when a press is activated.
onPressOut is called when the press gesture is deactivated.

After pressing onPressIn, one of two things will happen:

The person will remove their finger, triggering onPressOut followed by onPress.

What is the problem?

The problem is that in my code when i implemented it in the expo
<Pressable style={styles.opa} onPressIn={()=>setState('Usser pressedIn')} onPressOut={()=>{setState("User pressed out")}}
onPress={()=>{setState("User clicked button");alert('ha ha')}} delayLongPress={2000} onLongPress={()=>setState("long press")}>
--Text-- I am a button --/Text--
--/Pressable--
The onPressOut was firing somehow later like the final state that i see is User pressed out but it should be User Clicked button now if i hold my button for 2 seconds then the order is correct the onPress is called after the onPressOut. onPress is being called but in wrong order if i click and lift my finger immediately

How can we address it?

Why is it important?

Who needs this?

When should this happen (use version numbers if needed)?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant