Skip to content

TextInput textAlign center + value/defaultValue prop causes cursor to jump to the right end of input #26512

Closed
@janpe

Description

@janpe

Having a TextInput that gets a value or defaultValue prop and has textAlign: 'center' in its styles causes a bug that puts the cursor at the right end of the input when the input is cleared.

React Native version:
0.60.5

Steps To Reproduce

  1. Have a TextInput that gets a value or defaultValue prop passed to it and has style textAlign: center.
  2. Type some text into the input.
  3. Clear the input.
  4. The input cursor jumps to the right end of the input.

Describe what you expected to happen:

Have the cursor at the center of the input after clearing the input.

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

<TextInput
  style={{textAlign: 'center'}}
  value={value}
/>```

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugComponent: TextInputRelated to the TextInput component.StaleThere has been a lack of activity on this issue and it may be closed soon.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions