react / react/react-native

Setting the value of a controlled TextInput breaks when autocorrect suggestion present

Ouverte
#27,019 21 commentaires 6 réactions 0 personnes assignées Voir sur GitHub

Personne n'a encore pris cette issue.

Bug Component: TextInput Issue: Author Provided Repro Platform: iOS
Langage dominant
C++
Étoiles
127k
Forks
25.3k
Merge moyen
1 j 23 h
PR mergées (30 j)
4

Description

On iOS, something wonky happens when the value of a TextInput is programmatically modified (via setState and the value property of said TextInput) and an autocorrect suggestion is present.

The value of the text input ends up being set to the combination of the autocorrect suggestion and the programmatic value. This only happens when multiline={true}. When multiline={false}, all is fine.

This seems only to be reproducible on iOS. I was not able to reproduce on the Snack iOS simulator. This can be reproduced using the software keyboard in the Snack iOS simulator with multiline={true}. The Snack iOS simulator does not reproduce with multiline={false}, but this does reproduce on a device.

React Native version: 0.59-0.76

Steps To Reproduce

  1. Start the reproducer: https://snack.expo.dev/@mhoran/trusting-peanut
  2. Type "Yo mh" and wait for the auto-correct suggestion of "my"
  3. Click "Bananas!"
  4. Notice that the value set programmatically will become a combination of the autocorrect value and the programmatic value.

Describe what you expected to happen:

I expected the value to be set to "Yo mhoran".

Snack, code example, screenshot, or link to a repository:

https://snack.expo.dev/@mhoran/trusting-peanut

Guide de contribution

Ouvrir le guide de contribution

Par où commencer

  1. Lisez l'issue en entier, puis le guide de contribution du projet.
  2. Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
  3. Forkez le dépôt et travaillez sur une branche.
  4. Ouvrez une pull request qui référence le numéro de l'issue.

Piste de recherche

Commencez par le reproducteur Snack lié et par le comportement de React Native TextInput impliquant setState, la propriété value, la saisie multiligne et la correction automatique d’iOS. Reproduisez le problème sur un appareil iOS et comparez la valeur obtenue à la valeur attendue "Yo mhoran" ; le travail est considéré comme terminé lorsque les mises à jour programmatiques ne sont plus combinées avec la suggestion de correction automatique en attente.

Rédigé par le modèle d'indexation à partir du texte de l'issue.

Évaluation

Stack technique
ios, react-native
Domaine
mobile-dev
Type d'issue
Bug
Difficulté
4/5
Temps estimé
3-5 jours
Activité
À l'abandon
Clarté
Plutôt claire
Accessibilité débutants
35/100

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.