react-native-windows
react-native-windows copied to clipboard
onKeyPress does not register 'Backspace' until the TextInput is empty
Problem Description
Not sure if this is by design or not, but when you are using backspace to clear text in a TextInput, the onKeyPress event doesnt fire until the length of the TextInput value is zero.
Delete doesn't fire onKeyPress ever.
Would be handy if these worked as we use the onKeyPress on our autocomplete control in windows.
Steps To Reproduce
- Add a TextInput to a page including onKeyPress.
- Add console.warn(e.nativeEvent.key); to the onKeyPress
- Add text, then delete it using backspace or delete
Expected Results
Expected result is to see onKeyPress fire on all keys.
CLI version
13.6.9
Environment
System:
OS: Windows 11 10.0.22631
CPU: (32) x64 13th Gen Intel(R) Core(TM) i9-13950HX
Memory: 48.50 GB / 63.65 GB
Binaries:
Node:
version: 18.17.0
path: C:\Program Files\nodejs\node.EXE
Yarn:
version: 3.6.4
path: C:\Program Files (x86)\Yarn\bin\yarn.CMD
npm:
version: 9.6.7
path: C:\Program Files\nodejs\npm.CMD
Watchman: Not Found
SDKs:
Android SDK: Not Found
Windows SDK:
AllowDevelopmentWithoutDevLicense: Enabled
AllowAllTrustedApps: Enabled
Versions:
- 10.0.18362.0
- 10.0.19041.0
- 10.0.22000.0
- 10.0.22621.0
IDEs:
Android Studio: Not Found
Visual Studio:
- 17.8.34601.278 (Visual Studio Professional 2022)
Languages:
Java: 11.0.18
Ruby: Not Found
npmPackages:
"@react-native-community/cli": Not Found
react:
installed: 18.2.0
wanted: 18.2.0
react-native:
installed: 0.74.3
wanted: 0.74.3
react-native-windows:
installed: 0.74.11
wanted: 0.74.11
npmGlobalPackages:
"*react-native*": Not Found
Android:
hermesEnabled: true
newArchEnabled: false
iOS:
hermesEnabled: Not found
newArchEnabled: Not found
Community Modules
No response
Target Platform Version
None
Target Device(s)
No response
Visual Studio Version
None
Build Configuration
None
Snack, code example, screenshot, or link to a repository
No response
@Yajur-Grover Can you see what the behavior is here? TextInput might be eating the event when there's text so we never fire the JS event (unless the input is empty, then the event comes through).