react / react/react-native

In IOS TextInput does not update style if copy and pasted string is bigger then maxLength

Offen
#46,458 8 Kommentare 1 Reaktion 0 zugewiesene Personen Auf GitHub ansehen

Dieses Issue hat noch niemand übernommen.

Component: TextInput Issue: Author Provided Repro Newer Patch Available Platform: iOS
Vorherrschende Sprache
C++
Sterne
127k
Forks
25.3k
Ø Merge
1 T. 23 Std.
Gemergte PRs (30 T.)
4

Beschreibung

Description

In IOS the TextInput component does not update properly the style when copy and pasted string is bigger then maxLength, issue does not happen on Android. In the minimal reproducible example, there is a simple TextInput that should change text color to red, if text length is bigger or equal then 100 characters. If we copy and paste (using paste with long press) a string longer then 100, the color does not update to red. If user removes and adds last character manually, we can see color changing correctly to red.

Steps to reproduce
  1. Run yarn && npx pod-install && yarn ios
  2. Copy a string bigger then 100 characters
  3. Paste (using long press) the string
  4. Might be necessary to repeat steps 2 and 3 one more time
  5. Noticed color is still green and not red
React Native Version

0.75.2

Affected Platforms

Runtime - iOS

Output of npx react-native info
System:
  OS: macOS 14.5
  CPU: (12) arm64 Apple M2 Pro
  Memory: 91.03 MB / 32.00 GB
  Shell:
    version: "5.9"
    path: /bin/zsh
Binaries:
  Node:
    version: 18.12.1
    path: ~/.nvm/versions/node/v18.12.1/bin/node
  Yarn:
    version: 3.6.4
    path: ~/.nvm/versions/node/v18.12.1/bin/yarn
  npm:
    version: 8.19.2
    path: ~/.nvm/versions/node/v18.12.1/bin/npm
  Watchman: Not Found
Managers:
  CocoaPods:
    version: 1.15.2
    path: /opt/homebrew/bin/pod
SDKs:
  iOS SDK:
    Platforms:
      - DriverKit 23.5
      - iOS 17.5
      - macOS 14.5
      - tvOS 17.5
      - visionOS 1.2
      - watchOS 10.5
  Android SDK: Not Found
IDEs:
  Android Studio: 2024.1 AI-241.15989.150.2411.11948838
  Xcode:
    version: 15.4/15F31d
    path: /usr/bin/xcodebuild
Languages:
  Java:
    version: 17.0.10
    path: /usr/bin/javac
  Ruby:
    version: 2.6.10
    path: /Users/aureobeck/.rbenv/shims/ruby
npmPackages:
  "@react-native-community/cli": Not Found
  react:
    installed: 18.3.1
    wanted: 18.3.1
  react-native:
    installed: 0.75.2
    wanted: 0.75.2
  react-native-macos: Not Found
npmGlobalPackages:
  "*react-native*": Not Found
Android:
  hermesEnabled: true
  newArchEnabled: false
iOS:
  hermesEnabled: true
  newArchEnabled: false
Stacktrace or Logs
No logs
Reproducer

https://github.com/aureosouza/TextInputDemo

Screenshots and Videos

Simulator Screenshot - iPhone 15 Pro - 2024-09-12 at 17 17 19

Beitragsleitfaden

Beitragsleitfaden öffnen

Erste Schritte

  1. Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
  3. Forke das Repository und arbeite in einem Branch.
  4. Öffne einen Pull Request, der die Issue-Nummer nennt.

Rechercherichtung

Beginne mit dem verknüpften TextInputDemo-Reproduzierer und befolge die dokumentierten Schritte yarn, pod-install und yarn ios. Untersuche das Verhalten von iOS TextInput beim Einfügen von mehr als 100 Zeichen und überprüfe anschließend, dass sich die Farbe konsistent ändert, wenn die Länge maxLength erreicht; Android sollte unverändert bleiben.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
react-native
Bereich
mobile
Issue-Typ
Bug
Schwierigkeit
4/5
Geschätzter Aufwand
3-5 Tage
Aktivitätsstatus
Veraltet
Klarheit
Größtenteils klar
Anfängerfreundlichkeit
32/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.