Skip to content

onKeyPress does not register 'Backspace' until the TextInput is empty #13515

@jbcullis

Description

@jbcullis

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

  1. Add a TextInput to a page including onKeyPress.
  2. Add console.warn(e.nativeEvent.key); to the onKeyPress
  3. 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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Area: PaperArea: TextInputOld ArchitectureBroad category for issues that apply to the RN "old" architecture of Cxx Modules + PaperWorkstream: Component ParityClose the parity gap between RNW and RN for core RN components and their supporting APIs.bug

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions