Commit e4a5ed3
Add comment to clarify how I18nManager works (#51661)
Summary:
iOS I18nManager.isRTL is not wrong but often misinterpreted.
This PR adds a comment to clarify what the native call does, since Apple doesn't.
Undocumented behavior made me waste several hours hunting for an i18n issue that incorrectly made me think RN had a bug. It's impossible to know this code is working as intended as original commit does not state why the code exist, only that it was changed, no mentions in changelogs, and no official docs from neither RN nor from Apple explains the combined or individual behavior.
## Changelog:
<!-- Help reviewers and the release process by writing your own changelog entry.
Pick one each for the category and type tags:
[ANDROID|GENERAL|IOS|INTERNAL] [BREAKING|ADDED|CHANGED|DEPRECATED|REMOVED|FIXED|SECURITY] - Message
For more details, see:
https://reactnative.dev/contributing/changelogs-in-pull-requests
-->
[iOS] [Added] - Added comment to clarify why i18nManager.isRTL may not return the expected value
Pull Request resolved: #51661
Test Plan:
This project demonstrates that compiling and running will give you the "wrong"/unexpected isRTL value when using Hebrew
https://github.com/scarlac/rtl-test
When Hebrew is added to the Xcode project under "Internationalization" then you will observe that `.isRTL` starts returning `true`.
Note that Xcode has a nasty caching bug that means that removing Hebrew:
1. Will Not remove Hebrew (you need to remove it twice)
2. Will Not cause `.isRTL` to revert behavior
The solution is to remove Hebrew 2x, and then to clear DerivedData (or Product -> Clean Build Folder..., or CMD+Shift+K)
In addition to these issues, it's important to note that calling .forceRTL or .allowRTL are persisted across restarts. This is clearly intentional but also not clearly documented, so you cannot "clear" these states. A reinstall is necessary, or a counter-value call is necessary. The demo project does not use these calls, so it's not an issue there.
Reviewed By: javache
Differential Revision: D108129627
Pulled By: cortinico
fbshipit-source-id: 34f5b5509f48c0f102d4234f0315c5f58e30e7731 parent 4ea4db6 commit e4a5ed3
1 file changed
Lines changed: 3 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
95 | 95 | | |
96 | 96 | | |
97 | 97 | | |
98 | | - | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
99 | 101 | | |
100 | 102 | | |
101 | 103 | | |
| |||
0 commit comments