facebook / react-native

A framework for building native applications using React
https://reactnative.dev
MIT License
118.17k stars 24.21k forks source link

When using TextInput with secureTextEntry={true} on iOS, pressing the back button erases the entire text instead of just the last character. #46154

Open S170209 opened 3 weeks ago

S170209 commented 3 weeks ago

Description

When using TextInput with secureTextEntry={true} on iOS, pressing the back button erases the entire text instead of just the last character.

Expected Behavior: The back button should erase only the last character of the input in the TextInput.

Current Behavior: The entire text is erased when pressing the back button once.

Steps to reproduce

  1. Enter text in a TextInput with secureTextEntry={true}.
  2. Focus out of the input (e.g., move to the next input field).
  3. Refocus on the TextInput.
  4. Press the back button to erase text.

React Native Version

0.72.5

Affected Platforms

Runtime - iOS

Output of npx react-native info

System:
  OS: macOS 14.5
  CPU: (8) arm64 Apple M2
  Memory: 49.34 MB / 8.00 GB
  Shell:
    version: "5.9"
    path: /bin/zsh
Binaries:
  Node:
    version: 20.16.0
    path: ~/.nvm/versions/node/v20.16.0/bin/node
  Yarn:
    version: 1.22.22
    path: /opt/homebrew/bin/yarn
  npm:
    version: 10.8.1
    path: ~/.nvm/versions/node/v20.16.0/bin/npm
  Watchman:
    version: 2024.08.05.00
    path: /opt/homebrew/bin/watchman
Managers:
  CocoaPods: Not Found
SDKs:
  iOS SDK:
    Platforms:
      - DriverKit 23.2
      - iOS 17.2
      - macOS 14.2
      - tvOS 17.2
      - visionOS 1.0
      - watchOS 10.2
  Android SDK: Not Found
IDEs:
  Android Studio: 2024.1 AI-241.18034.62.2411.12071903
  Xcode:
    version: 15.2/15C500b
    path: /usr/bin/xcodebuild
Languages:
  Java:
    version: 17.0.12
    path: /Library/Java/JavaVirtualMachines/zulu-17.jdk/Contents/Home/bin/javac
  Ruby:
    version: 3.1.4
    path: /Users/testUser/.rbenv/shims/ruby
npmPackages:
  "@react-native-community/cli": Not Found
  react:
    installed: 18.2.0
    wanted: 18.2.0
  react-native:
    installed: 0.72.5
    wanted: 0.72.5
  react-native-macos: Not Found
npmGlobalPackages:
  "*react-native*": Not Found
Android:
  hermesEnabled: true
  newArchEnabled: false
iOS:
  hermesEnabled: false
  newArchEnabled: false

Stacktrace or Logs

### Stacktrace or Logs

N/A

Reproducer

https://github.com/S170209/TextInputIssueRepro.git

Screenshots and Videos

https://github.com/user-attachments/assets/fcb30253-405d-48d2-9636-2c4b576e5b51

react-native-bot commented 3 weeks ago
:warning: Unsupported Version of React Native
:information_source: It looks like your issue or the example you provided uses an unsupported version of React Native.

Due to the number of issues we receive, we're currently only accepting new issues against one of the supported versions. Please upgrade to latest and verify if the issue persists (alternatively, create a new project and repro the issue in it). If you cannot upgrade, please open your issue on StackOverflow to get further community support.
react-native-bot commented 3 weeks ago
:warning: Unsupported Version of React Native
:information_source: It looks like your issue or the example you provided uses an unsupported version of React Native.

Due to the number of issues we receive, we're currently only accepting new issues against one of the supported versions. Please upgrade to latest and verify if the issue persists (alternatively, create a new project and repro the issue in it). If you cannot upgrade, please open your issue on StackOverflow to get further community support.
shubhamguptadream11 commented 3 weeks ago

@S170209 Can you provide a reproducer using this template. It will be helpful for us.

meetdhanani17 commented 2 weeks ago

Hello @S170209 could you provide reproduce code so it would be better

deepanshushuklad11 commented 2 weeks ago

@S170209 Can you validate on newArch as well

shubhamguptadream11 commented 2 weeks ago

This seems to be fixed here: https://github.com/facebook/react-native/pull/45964

angvp commented 1 week ago

@meetdhanani17 @deepanshushuklad11 care to check #45964 ? thanks!