Pogue Leader
Pogue Leader
TTCTheo's Typesafe Cult
Created by Pogue Leader on 12/23/2023 in #questions
Using Intl.formatList in Expo
I'm using expo-localization and react-intl together in order to try to use formatList. I have in my babel.config.js:
plugins: [
[
"formatjs",
{
idInterpolationPattern: "[sha512:contenthash:base64:6]",
ast: true,
},
],
],
plugins: [
[
"formatjs",
{
idInterpolationPattern: "[sha512:contenthash:base64:6]",
ast: true,
},
],
],
In my template:
...
import { useIntl } from "react-intl";

export default function Page() {
const intl = useIntl();

intl.listFormat(someArrayOfStrings);

...
}
...
import { useIntl } from "react-intl";

export default function Page() {
const intl = useIntl();

intl.listFormat(someArrayOfStrings);

...
}
My _layout.tsx is wrapped in <IntlProvider locale="en">. I get the following error:
ERROR [Error: Intl.ListFormat is not available in this environment.
Try polyfilling it using "@formatjs/intl-listformat"
]
ERROR [Error: Intl.ListFormat is not available in this environment.
Try polyfilling it using "@formatjs/intl-listformat"
]
I was under the (probably mistaken) impression that I do not need to polyfill when using expo-localization. What am I missing? Also saw some notes on changing the jsc flavor to intl+ for Android, but again, not sure if that's necessary.
1 replies