We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 1d4568d commit abc4abbCopy full SHA for abc4abb
packages/react-native-web/src/modules/useLocale/isLocaleRTL.js
@@ -60,9 +60,16 @@ export function isLocaleRTL(locale: string): boolean {
60
let isRTL = false;
61
// $FlowFixMe
62
if (Intl.Locale) {
63
- // $FlowFixMe
64
- const script = new Intl.Locale(locale).maximize().script;
65
- isRTL = rtlScripts.has(script);
+ try {
+ // $FlowFixMe
+ const script = new Intl.Locale(locale).maximize().script;
66
+ isRTL = rtlScripts.has(script);
67
+ } catch {
68
+ // RangeError: Incorrect locale information provided
69
+ // Fallback to inferring from language
70
+ const lang = locale.split('-')[0];
71
+ isRTL = rtlLangs.has(lang);
72
+ }
73
} else {
74
// Fallback to inferring from language
75
const lang = locale.split('-')[0];
0 commit comments