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

onPress triggers twice, when activated via Enter key #5800

Open
1 of 5 tasks
seemX17 opened this issue Feb 12, 2024 · 0 comments
Open
1 of 5 tasks

onPress triggers twice, when activated via Enter key #5800

seemX17 opened this issue Feb 12, 2024 · 0 comments

Comments

@seemX17
Copy link

seemX17 commented Feb 12, 2024

Description

When using the onPress prop on the Button component the function get's called twice when used a enter key via keyboard

CodeSandbox/Snack link

https://snack.expo.dev/@seemran.xec/nativebase-template

Steps to reproduce

First time onPress is called when pressing the Enter key down and the second time it is called when releasing the Enter key.

Expected behavior
onPress is only called once, like it is when using Space key oder pressing the button with the mouse.

Steps to reproduce
Use and apply an onPress handler to it
Set a disabled state inside the onPress handler
Put some console.log inside the onPress handler
Activate your button using the keyboard (tab), pressing the Enter key
See your console.log twice in the console

Workaround
Need to use onPressIn instead of onPress

NativeBase Version

3.4.28

Platform

  • Android
  • CRA
  • Expo
  • iOS
  • Next

Other Platform

No response

Additional Information

No response

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

No branches or pull requests

1 participant