Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set and require android:supportsRtl="true" for RTL layout #44538

Closed
wants to merge 1 commit into from

Conversation

NickGerleman
Copy link
Contributor

Summary:
Android originated without RTL support. When RTL support was added, Applications needed to set android:supportsRtl="true" in their manifest, to allow Android to do RTL specific layout and drawing. This became the default for new projects created by Android Studio at some point.

React Native was not setting this in template, which means apps created from it do not do any of Android's RTL layout, text alignment, or drawing (e.g. in D3652980 8 years ago, a native drawer component came from the wrong side of the screen). RN would still layout the app using Yoga in RTL if in RTL locale though.

This change sets android:supportsRtl in template matching default new Android projects, and to avoid mismatched states in the future, will only tell I18NManager that RTL is allowed if android:supportsRtl is also set. This is breaking, since existing apps may not get Yoga RTL support unless telling Android that the application should support RTL layout.

Changelog:
[Android][Breaking] - Set and require android:supportsRtl="true" for RTL layout

Differential Revision: D57248205

@facebook-github-bot facebook-github-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 11, 2024
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D57248205

@analysis-bot
Copy link

analysis-bot commented May 11, 2024

Platform Engine Arch Size (bytes) Diff
android hermes arm64-v8a 19,558,630 -6
android hermes armeabi-v7a n/a --
android hermes x86 n/a --
android hermes x86_64 n/a --
android jsc arm64-v8a 22,928,778 +16
android jsc armeabi-v7a n/a --
android jsc x86 n/a --
android jsc x86_64 n/a --

Base commit: 3f17c8b
Branch: main

…4538)

Summary:

Android originated without RTL support. When RTL support was added, Applications needed to set `android:supportsRtl="true"` in their manifest, to allow Android to do RTL specific layout and drawing. This became the default for new projects created by Android Studio at some point.

React Native was not setting this in template, which means apps created from it do not do any of Android's RTL layout, text alignment, or drawing (e.g. in D3652980 8 years ago, a native drawer component came from the wrong side of the screen). RN would still layout the app using Yoga in RTL if in RTL locale though.

This change sets `android:supportsRtl` in template matching default new Android projects, and to avoid mismatched states in the future, will only tell I18NManager that RTL is allowed if `android:supportsRtl` is also set. This is breaking, since existing apps may not get Yoga RTL support unless telling Android that the application should support RTL layout.

Changelog:
[Android][Breaking] - Set and require `android:supportsRtl="true"` for RTL layout

Differential Revision: D57248205
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D57248205

@facebook-github-bot facebook-github-bot added the Merged This PR has been merged. label May 17, 2024
@facebook-github-bot
Copy link
Contributor

This pull request has been merged in 82c6f8a.

Copy link

This pull request was successfully merged by @NickGerleman in 82c6f8a.

When will my fix make it into a release? | How to file a pick request?

blakef added a commit to blakef/react-native that referenced this pull request May 17, 2024
Summary:
Contributed in D57248205 / facebook#44538

From:
```
buck2 run //xplat/js/scripts/rn-api:generate-rn-api-metadata
```

Changelog: [Internal]

Reviewed By: rshest

Differential Revision: D57487065
facebook-github-bot pushed a commit that referenced this pull request May 17, 2024
Summary:
Pull Request resolved: #44599

Contributed in D57248205 / #44538

From:
```
buck2 run //xplat/js/scripts/rn-api:generate-rn-api-metadata
```

Changelog: [Internal]

Reviewed By: rshest

Differential Revision: D57487065

fbshipit-source-id: 35308c7a1ef7368b4b1792fe26cf057e45de1360
blakef pushed a commit to react-native-community/template that referenced this pull request Jun 4, 2024
Summary:
Pull Request resolved: facebook/react-native#44538

Android originated without RTL support. When RTL support was added, Applications needed to set `android:supportsRtl="true"` in their manifest, to allow Android to do RTL specific layout and drawing. This became the default for new projects created by Android Studio at some point.

React Native was not setting this in template, which means apps created from it do not do any of Android's RTL layout, text alignment, or drawing (e.g. in D3652980 8 years ago, a native drawer component came from the wrong side of the screen). RN would still layout the app using Yoga in RTL if in RTL locale though.

This change sets `android:supportsRtl` in template matching default new Android projects, and to avoid mismatched states in the future, will only tell I18NManager that RTL is allowed if `android:supportsRtl` is also set. This is breaking, since existing apps may not get Yoga RTL support unless telling Android that the application should support RTL layout.

Changelog:
[Android][Breaking] - Set and require `android:supportsRtl="true"` for RTL layout

Reviewed By: joevilches

Differential Revision: D57248205

fbshipit-source-id: 3f60c9f855db26f8d34a2e05d460f95961f5ffeb

Original: facebook/react-native@82c6f8a
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. fb-exported Merged This PR has been merged. p: Facebook Partner: Facebook Partner
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants