Commit eaa9d7f
Use ConfigurationCompat for device locale lookup (#58723)
Summary:
Pull Request resolved: #58723
`I18nUtil` directly called `Configuration.getLocales()`, which is unavailable before API 24. Read the preferred locale through `ConfigurationCompat` instead and fall back to the process default when the locale list is empty.
Add an API-23 Robolectric regression test that exercises RTL detection on an Arabic locale.
Changelog:
[Android][Fixed] - Prevent a crash when resolving RTL layout direction on Android 6
Reviewed By: cortinico
Differential Revision: D122147089
fbshipit-source-id: 461c8606f9abc45aa995c6e13254a2ad3f925c661 parent ca0ae36 commit eaa9d7f
2 files changed
Lines changed: 43 additions & 2 deletions
File tree
- packages/react-native/ReactAndroid/src
- main/java/com/facebook/react/modules/i18nmanager
- test/java/com/facebook/react/modules/i18nmanager
Lines changed: 5 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
| 13 | + | |
13 | 14 | | |
| 15 | + | |
14 | 16 | | |
15 | 17 | | |
16 | 18 | | |
| |||
61 | 63 | | |
62 | 64 | | |
63 | 65 | | |
64 | | - | |
65 | | - | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
66 | 69 | | |
67 | 70 | | |
68 | 71 | | |
| |||
Lines changed: 38 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
0 commit comments