react-native icon indicating copy to clipboard operation
react-native copied to clipboard

Secure text entry flickers on iOS

Open atlj opened this issue 1 year ago • 8 comments

Description

On iOS (With a Simulator or a real device), if you have a TextInput component with secureTextEntry={true} and a custom font, the text flickers when you enter a character and remove it.

Note: this also happens with the old renderer.

Steps to reproduce

  1. Install the application with yarn ios
  2. Focus on the text input
  3. Enter a character and then remove it

React Native Version

0.74.3

Affected Platforms

Runtime - iOS

Areas

Fabric - The New Renderer

Output of npx react-native info

System:
  OS: macOS 14.3
  CPU: (10) arm64 Apple M1 Pro
  Memory: 98.19 MB / 16.00 GB
  Shell:
    version: 0.91.0
    path: /Users/burakguner/.cargo/bin/nu
Binaries:
  Node:
    version: 21.7.1
    path: ~/.nix-profile/bin/node
  Yarn:
    version: 4.3.1
    path: ~/.nix-profile/bin/yarn
  npm:
    version: 10.5.0
    path: ~/.nix-profile/bin/npm
  Watchman:
    version: 2024.01.22.00
    path: /Users/burakguner/.nix-profile/bin/watchman
Managers:
  CocoaPods:
    version: 1.15.2
    path: /Users/burakguner/.local/share/gem/ruby/3.1.0/bin/pod
SDKs:
  iOS SDK:
    Platforms:
      - DriverKit 23.0
      - iOS 17.0
      - macOS 14.0
      - tvOS 17.0
      - watchOS 10.0
  Android SDK: Not Found
IDEs:
  Android Studio: Hedgehog 2023.1.1 Patch 2 Hedgehog 2023.1.1 Patch 2
  Xcode:
    version: 15.0.1/15A507
    path: /usr/bin/xcodebuild
Languages:
  Java:
    version: 17.0.8
    path: /usr/bin/javac
  Ruby:
    version: 3.1.4
    path: /Users/burakguner/.nix-profile/bin/ruby
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-macos: Not Found
npmGlobalPackages:
  "*react-native*": Not Found
Android:
  hermesEnabled: true
  newArchEnabled: false
iOS:
  hermesEnabled: true
  newArchEnabled: true


### Stacktrace or Logs

```text
There is no stack trace.

Reproducer

https://github.com/atlj/secure-text-entry-flicker

Screenshots and Videos

https://github.com/facebook/react-native/assets/23079646/7a260380-eb2c-434c-97f3-af14dd51a5af

atlj avatar Jul 09 '24 15:07 atlj

It's not reproducible at my end. React-native: 0.74.3 iOS: iPhone 15 Pro 17.0 New Architecture enabled @atlj Attached a reference. Is this device specific? https://github.com/facebook/react-native/assets/85783070/cc2028ff-d754-4332-9f6a-310b67367b13

shubhamguptadream11 avatar Jul 09 '24 15:07 shubhamguptadream11

Hey @shubhamguptadream11 I was able to see the issue on:

  • iPhone 15 simulator
  • iPhone 14 Plus (iOS 18 Beta 2)
  • iPhone SE third gen (iOS 16.0.2)

Are you using an external keyboard? You have to use the screen keyboard, otherwise the characters you just entered aren't visible

atlj avatar Jul 09 '24 15:07 atlj

With flickers do you mean the dots moving slightly up and down?

cortinico avatar Jul 09 '24 17:07 cortinico

With flickers do you mean the dots moving slightly up and down?

Yes exactly and it gets more noticable when the fontSize is larger

atlj avatar Jul 09 '24 19:07 atlj

Hey @atlj, I tried this again with simulator keyboard. Not reproducible at my end.

Device info are same as shared above.

https://github.com/facebook/react-native/assets/85783070/32f43f7c-22b4-4da9-98e5-2da3f2511144

shubhamguptadream11 avatar Jul 10 '24 06:07 shubhamguptadream11

Hey @shubhamguptadream11 I'm not entirely sure why but it looks like your app still uses the default font since it's not bold. The letters you typed seem a bit light to me and I can verify there is no issue with the default font.

atlj avatar Jul 10 '24 07:07 atlj

I cloned @atlj's reproducer, ran it in Simulator, enabled software keyboard, entered some letters, and could observe the same issue. Then I ran it on iPhone 12 and got the same result.

https://github.com/facebook/react-native/assets/8790386/fe5a93a8-2e9d-4a55-bc35-8bf47d1186a5

cc @shubhamguptadream11

DimitarNestorov avatar Jul 10 '24 09:07 DimitarNestorov

use secureTextEntry={true} to fix that

Hammad089 avatar Jul 10 '24 12:07 Hammad089