facebook / react-native

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

[iOS] Toggling `secureTextEntry` prop causes cursor to jump to the end of TextInput #38676

Open pac-guerreiro opened 1 year ago

pac-guerreiro commented 1 year ago

Description

In iOS, when the secureTextEntry prop is toggled while the TextInput is focused, the cursor position always jumps to the end of the input no matter what the previous position was.

React Native Version

0.71.2

Output of npx react-native info

System: OS: macOS 13.4.1 CPU: (10) arm64 Apple M1 Pro Memory: 89.78 MB / 32.00 GB Shell: 5.9 - /bin/zsh Binaries: Node: 16.15.1 - ~/.nvm/versions/node/v16.15.1/bin/node Yarn: 1.22.15 - ~/.nvm/versions/node/v16.15.1/bin/yarn npm: 8.11.0 - ~/.nvm/versions/node/v16.15.1/bin/npm Watchman: Not Found Managers: CocoaPods: Not Found SDKs: iOS SDK: Platforms: DriverKit 22.4, iOS 16.4, macOS 13.3, tvOS 16.4, watchOS 9.4 Android SDK: API Levels: 28, 29, 30, 31, 32, 33 Build Tools: 28.0.3, 30.0.3, 33.0.0 System Images: android-31 | Android TV ARM 64 v8a, android-31 | Google APIs ARM 64 v8a, android-32 | Google Play ARM 64 v8a, android-33 | Google APIs ARM 64 v8a Android NDK: 21.3.6528147 IDEs: Android Studio: 2022.1 AI-221.6008.13.2211.9514443 Xcode: 14.3.1/14E300c - /usr/bin/xcodebuild Languages: Java: 17.0.8 - /usr/bin/javac npmPackages: @expensify/react-native: 0.71.2-alpha.3 @react-native-community/cli: Not Found react: 18.2.0 => 18.2.0 react-native: Not Found react-native-macos: Not Found npmGlobalPackages: react-native: Not Found

Steps to reproduce

  1. Write something on a TextInput, in iOS
  2. Move the cursor position to a different position
  3. Toggle secureTextEntry
  4. Notice that the cursor jumped to the end of the input

Snack, screenshot, or link to a repository

Snack: https://snack.expo.dev/IL4nCHYAQ

Demo: https://github.com/facebook/react-native/assets/48553277/afd61900-bcd6-47d2-9d38-120c3611e885

github-actions[bot] commented 1 year ago
:warning: Newer Version of React Native is Available!
:information_source: You are on a supported minor version, but it looks like there's a newer patch available - 0.71.12. Please upgrade to the highest patch for your minor or latest and verify if the issue persists (alternatively, create a new project and repro the issue in it). If it does not repro, please let us know so we can close out this issue. This helps us ensure we are looking at issues that still exist in the most recent releases.
pac-guerreiro commented 10 months ago

bump

pac-guerreiro commented 9 months ago

Bump

cortinico commented 9 months ago

@pac-guerreiro can you test on React Native 0.73 and confirm if this issue is still happening?

pac-guerreiro commented 9 months ago

@cortinico Thank you for your reply, I'll test it and let you know if it works

github-actions[bot] commented 8 months ago

This issue is waiting for author's feedback since 24 days. Please provide the requested feedback or this will be closed in 7 days.

github-actions[bot] commented 8 months ago

This issue was closed because the author hasn't provided the requested feedback after 7 days.

pac-guerreiro commented 7 months ago

@cortinico Sorry for the delay, I had to wait for our app to be updated to RN 0.73!

The bug still persists on "react-native": "0.73.2", as you can see below:

https://github.com/facebook/react-native/assets/48553277/746a67d6-b2a8-4fbe-9eee-bc5314274e40

pac-guerreiro commented 7 months ago

With my fix it will behave like this:

https://github.com/facebook/react-native/assets/48553277/4955124a-b45a-47bd-ac5d-7f5135c34b6e

pac-guerreiro commented 7 months ago

Friendly bump 😄

pac-guerreiro commented 7 months ago

Bumpty bumpty 😄

pac-guerreiro commented 6 months ago

Bump @cortinico