NativeBase icon indicating copy to clipboard operation
NativeBase copied to clipboard

onPress triggers twice, when activated via Enter key

Open seemX17 opened this issue 2 years ago • 0 comments

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 <Button onPress={onPressHandler}> 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
  • [X] Expo
  • [ ] iOS
  • [ ] Next

Other Platform

No response

Additional Information

No response

seemX17 avatar Feb 12 '24 16:02 seemX17