🐛 Android: Cursor jumps to right when clearing centered TextInput
Nessuno ha ancora preso questa issue.
- Lingua principale
- C++
- Stelle
- 127k
- Fork
- 25.3k
- Merge medio
- 1g 23h
- PR unite (30g)
- 4
Descrizione
Description
When using a TextInput with textAlign: "center" on Android, clearing the input causes the cursor to move to the right end of the input instead of staying centered.
This does not happen on iOS — iOS behaves correctly.
This issue makes centered numeric or OTP-style inputs feel broken on Android.
Steps to reproduce
1)Render a TextInput with textAlign: "center"
2)Type any value
3)Clear the value (backspace or programmatically)
4)Observe cursor position
`import React, { useState } from "react";
import { View, TextInput, StyleSheet } from "react-native";
export default function App() {
const [value, setValue] = useState("");
return (
);
}
const styles = StyleSheet.create({
container: {
flex: 1,
justifyContent: "center",
padding: 20,
},
input: {
borderWidth: 1,
height: 48,
fontSize: 18,
textAlign: "center",
},
});
`
React Native Version
0.83.0
Affected Platforms
Runtime - Android
Output of npx @react-native-community/cli info
N/A
Stacktrace or Logs
N/A
MANDATORY Reproducer
https://reactnative.dev/docs/textinput
Screenshots and Videos
https://github.com/user-attachments/assets/20586de1-a4fc-40d5-8495-2d6cc29ace5f
Guida per i contributori
Apri la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Direzione di ricerca
Inizia con il riproduttore TextInput obbligatorio nella documentazione di React Native e riproduci il comportamento su Android con textAlign impostato su center. Traccia il comportamento Android di TextInput coinvolto nella cancellazione del testo di un input controllato. Il lavoro è completato quando il cursore rimane centrato dopo la cancellazione tramite backspace o programmaticamente, senza modificare il corretto comportamento di iOS.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- react-native
- Ambito
- mobile
- Tipo di issue
- Bug
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Stato di attività
- Tranquilla
- Chiarezza
- Abbastanza chiara
- Idoneità per principianti
- 58/100