Skip to content

[TextInput] dynamic textAlign is inconsistent in iOS(repro provided) #52785

Description

@panda0603

Description

Hi,

I am setting dynamic textAlign prop('left', 'center', 'right') to TextInput component using useState.

The behavior for setting textAlign prop seems to be inconsistent in iOS, sometimes it works, sometimes it wont. I'm not sure of the circumstances that trigger them.

Please refer to the attached video below

First Case - dynamic textAlign works without any characters, but won't if characters are typed

rep2.mov

Second Case - Behavior differs by keyboard language

rep.mov

When the keyboard is english, this works well.

Upon changing the keyboard language other than English, textAlign prop stops working.

Reproduced in iOS simulator, haven't tried real device. Android seems to work fine with both cases

Steps to reproduce

  1. dynamically set textAlign prop with useState
  2. change the keyboard language other than English(reproduction video is in Korean)

React Native Version

0.80.1

Affected Platforms

Runtime - iOS

Output of npx @react-native-community/cli info

System:
  OS: macOS 15.5
  CPU: (10) arm64 Apple M1 Pro
  Memory: 116.75 MB / 32.00 GB
  Shell:
    version: "5.9"
    path: /bin/zsh
Binaries:
  Node:
    version: 22.17.0
    path: ~/.nvm/versions/node/v22.17.0/bin/node
  Yarn: Not Found
  npm:
    version: 11.4.2
    path: ~/Desktop/Dev/proj/node_modules/.bin/npm
  Watchman: Not Found
Managers:
  CocoaPods:
    version: 1.16.2
    path: /opt/homebrew/bin/pod
SDKs:
  iOS SDK:
    Platforms:
      - DriverKit 24.5
      - iOS 18.5
      - macOS 15.5
      - tvOS 18.5
      - visionOS 2.5
      - watchOS 11.5
  Android SDK: Not Found
IDEs:
  Android Studio: 2025.1 AI-251.25410.109.2511.13752376
  Xcode:
    version: 16.4/16F6
    path: /usr/bin/xcodebuild
Languages:
  Java:
    version: 17.0.12
    path: /usr/bin/javac
  Ruby:
    version: 2.6.10
    path: /usr/bin/ruby
npmPackages:
  "@react-native-community/cli":
    installed: 19.0.0
    wanted: 19.0.0
  react:
    installed: 19.1.0
    wanted: 19.1.0
  react-native:
    installed: 0.80.1
    wanted: 0.80.1
  react-native-macos: Not Found
npmGlobalPackages:
  "*react-native*": Not Found
Android:
  hermesEnabled: true
  newArchEnabled: true
iOS:
  hermesEnabled: true
  newArchEnabled: true

Stacktrace or Logs

no logs since not an error

MANDATORY Reproducer

import React, { useState } from 'react'
import { View, TextInput, Button, StyleSheet } from 'react-native'

const ORDER = ['left', 'center', 'right']

export default function App() {
  const [align, setAlign] = useState('left')

  const toggle = () => {
    const next = ORDER[(ORDER.indexOf(align) + 1) % ORDER.length]
    setAlign(next)
  }

  return (
    <View style={styles.root}>
      <Button title={`align: ${align}`} onPress={toggle} />
      <TextInput
        multiline
        style={styles.input}
        // style={[styles.input, { textAlign: align }]} tried this as well
        textAlign={align}
        textAlignVertical="top"
        scrollEnabled={false}
        autoCorrect={false}
      />
    </View>
  )
}

const styles = StyleSheet.create({
  root: { flex: 1, padding: 24 },
  input: {
    height: 300,
    borderWidth: 1,
    borderColor: '#ccc',
    borderRadius: 8,
    padding: 12,
    fontSize: 16,
    marginTop: 16,
    width: '100%',
  },
})

Screenshots and Videos

rep2.mov
rep.mov

Metadata

Metadata

Assignees

No one assigned

    Labels

    API: KeyboardComponent: 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.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