Skip to content

πŸ› Android: Cursor jumps to right when clearing centered TextInputΒ #55457

@DevarajuluR

Description

@DevarajuluR

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

TextAlign.issue.webm

Metadata

Metadata

Assignees

No one assigned

    Labels

    Component: TextInputRelated to the TextInput component.Needs: AttentionIssues where the author has responded to feedback.Needs: ReproThis issue could be improved with a clear list of steps to reproduce the issue.Platform: AndroidAndroid applications.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions