Skip to content

fix(text): support start and end text alignment#57007

Closed
SJvaca30 wants to merge 1 commit into
react:mainfrom
SJvaca30:feat-textalign-start-end
Closed

fix(text): support start and end text alignment#57007
SJvaca30 wants to merge 1 commit into
react:mainfrom
SJvaca30:feat-textalign-start-end

Conversation

@SJvaca30

Copy link
Copy Markdown
Contributor

Summary:

Closes #45255.

Adds textAlign: 'start' | 'end' support for Text and TextInput across the JS types, Android, iOS, and Fabric text conversion paths.

  • Android legacy Text and TextInput now accept logical start/end alignment values.
  • Fabric preserves start/end as distinct TextAlignment values and resolves them against layout direction for iOS paragraph layout.
  • Existing left/right behavior is left unchanged to avoid changing current RTL semantics.

Changelog:

[GENERAL] [ADDED] - Add support for textAlign: 'start' and textAlign: 'end'.

Test Plan:

  • yarn build-types
  • yarn test-typescript
  • yarn flow-check
  • ./node_modules/.bin/prettier --check packages/react-native/Libraries/Components/TextInput/TextInput.d.ts packages/react-native/Libraries/Components/TextInput/TextInput.flow.js packages/react-native/Libraries/StyleSheet/StyleSheetTypes.d.ts packages/react-native/Libraries/StyleSheet/StyleSheetTypes.js packages/react-native/types/__typetests__/index.tsx packages/react-native/ReactNativeApi.d.ts
  • ./gradlew ktfmtCheck -Preact.internal.useHermesStable=true --no-daemon
  • ./gradlew :packages:react-native:ReactAndroid:testDebugUnitTest --tests com.facebook.react.views.textinput.ReactTextInputPropertyTest.testTextAlign --tests com.facebook.react.views.text.TextAttributePropsTest -Preact.internal.useHermesStable=true --rerun-tasks --no-daemon
  • ./gradlew ':packages:react-native:ReactAndroid:buildCMakeDebug[arm64-v8a][hermestooling,jsi,etc]' -Preact.internal.useHermesStable=true --no-daemon
  • git diff --check

I also attempted to run iOS RNTester unit tests locally, but CocoaPods setup fails before tests start in this checkout because the workspace path contains non-ASCII characters (incompatible character encodings: UTF-8 and BINARY (ASCII-8BIT)) and the workspace has no generated Pods checked in.

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label May 30, 2026
@github-actions

Copy link
Copy Markdown

Warning

JavaScript API change detected

This PR commits an update to ReactNativeApi.d.ts, indicating a change to React Native's public JavaScript API.

  • Please include a clear changelog message.
  • This change will be subject to additional review.

This change was flagged as: POTENTIALLY_BREAKING

@SJvaca30 SJvaca30 force-pushed the feat-textalign-start-end branch from 4cf06e3 to e431f6f Compare May 30, 2026 17:10
@facebook-github-tools facebook-github-tools Bot added the Shared with Meta Applied via automation to indicate that an Issue or Pull Request has been shared with the team. label May 30, 2026
@SJvaca30

Copy link
Copy Markdown
Contributor Author

Replaced by #57201. The original fork is locked, so I can no longer update this branch.

@SJvaca30 SJvaca30 closed this Jun 15, 2026
meta-codesync Bot pushed a commit that referenced this pull request Jul 1, 2026
Summary:
Closes #45255.

Adds `textAlign: 'start' | 'end'` support for Text and TextInput across the JS types, Android, iOS, and Fabric text conversion paths.

- Android legacy Text and TextInput now accept logical `start`/`end` alignment values.
- Fabric preserves `start`/`end` as distinct `TextAlignment` values and resolves them against layout direction for iOS paragraph layout.
- Existing `left`/`right` behavior is left unchanged to avoid changing current RTL semantics.

This replaces #57007 because the original fork became locked and could not be updated after the upstream conflict.

## Changelog:

[GENERAL] [ADDED] - Add support for `textAlign: 'start'` and `textAlign: 'end'`.

Pull Request resolved: #57201

Test Plan:
- `yarn build-types`
- `yarn test-typescript`
- `yarn flow-check`
- `./node_modules/.bin/prettier --check packages/react-native/Libraries/Components/TextInput/TextInput.d.ts packages/react-native/Libraries/Components/TextInput/TextInput.flow.js packages/react-native/Libraries/StyleSheet/StyleSheetTypes.d.ts packages/react-native/Libraries/StyleSheet/StyleSheetTypes.js packages/react-native/types/__typetests__/index.tsx packages/react-native/ReactNativeApi.d.ts`
- `./gradlew ktfmtCheck -Preact.internal.useHermesStable=true --no-daemon`
- `./gradlew :packages:react-native:ReactAndroid:testDebugUnitTest --tests com.facebook.react.views.textinput.ReactTextInputPropertyTest.testTextAlign --tests com.facebook.react.views.text.TextAttributePropsTest -Preact.internal.useHermesStable=true --no-daemon`
- `./gradlew ':packages:react-native:ReactAndroid:buildCMakeDebug[arm64-v8a][hermestooling,jsi,etc]' -Preact.internal.useHermesStable=true --no-daemon`
- `git diff --check`

The Android unit test and CMake checks were run from an ASCII-only temporary worktree because Kotlin unit test compilation in my main checkout fails before running these tests when the workspace path contains non-ASCII characters.

Reviewed By: christophpurrer

Differential Revision: D108628602

Pulled By: javache

fbshipit-source-id: 28111d0553451d7de0424a07e956f71bda8787ca
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. Shared with Meta Applied via automation to indicate that an Issue or Pull Request has been shared with the team.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add support for textAlign:start/end

1 participant