react / react/react-native

TextInput broken with writingDirection

Open
#54,399 3 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Component: TextInput Issue: Author Provided Repro Needs: React Native Team Attention
Dominant language
C++
Stars
127k
Forks
25.3k
Avg merge
1d 23h
Merged PRs (30d)
4

Description

Description

TextInput UI was broken with writingDirection, both ltr and rtl. It will display correctly if we focus the input

import { TextInput, View } from 'react-native'

export default function HomeScreen() {
  return (
    <View style={{ flex: 1, paddingTop: 50, backgroundColor: '#FFF' }}>
      <View style={{ flexDirection: 'row', gap: 8 }}>
        <TextInput
          value={
            'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Velit morbi nisi aptent condimentum nisi fringilla rutrum sociis senectus ac. Torquent mauris risus ultricies aenean vitae erat mollis congue dui mus'
          }
          placeholder='Enter your text here'
          numberOfLines={1}
          multiline={false}
          style={{
            borderWidth: 1,
            borderColor: 'black',
            borderRadius: 5,
            alignSelf: 'stretch',
            writingDirection: 'rtl',
            paddingHorizontal: 2,
            height: 40
          }}
        />
      </View>
    </View>
  )
}

Image
Steps to reproduce

Use the code snippet above

React Native Version

0.81.5

Affected Platforms

Runtime - iOS

Output of npx @react-native-community/cli info
% npx @react-native-community/cli info
error: unknown command 'info'
(Did you mean init?)
Stacktrace or Logs
none
MANDATORY Reproducer

https://github.com/maphongba008/input-writing-direction-issue

Screenshots and Videos
Image

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by running the mandatory reproducer at https://github.com/maphongba008/input-writing-direction-issue with React Native 0.81.5 on iOS, using the supplied TextInput example and testing both ltr and rtl writingDirection values. Done means the text renders correctly before the input receives focus, without relying on focusing it.

Written by the indexing model from the issue text.

Assessment

Tech stack
react-native
Domain
mobile
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.