expo-fmt-consteval-fix
v1.0.0
Published
Expo config plugin that fixes the fmt 11.0.2 "call to consteval function ... is not a constant expression" iOS build error on Xcode 26.4+ (Apple Clang 21) for React Native / Expo projects that build from source.
Maintainers
Readme
expo-fmt-consteval-fix
An Expo config plugin that fixes the fmt consteval iOS build error on Xcode 26.4+ (Apple Clang 21) for React Native / Expo projects that compile fmt from source.
If your previously healthy iOS build suddenly fails with something like this — and nothing in your own code changed — this plugin is for you:
❌ ios/Pods/fmt/include/fmt/format-inl.h:59
call to consteval function
'fmt::basic_format_string<char, ...>::basic_format_string<FMT_COMPILE_STRING, 0>'
is not a constant expressionWhy this happens
Xcode 26.4 ships Apple Clang 21, which enforces stricter C++20 consteval rules: a consteval call site must itself be a constant expression. The version of fmt bundled by React Native (11.0.2, used by RCT-Folly) relies on FMT_STRING(...) compile-time checks that no longer satisfy those rules, so the build fails — through no fault of your code.
The fix landed upstream by bumping fmt to 12.1.0, which only reached React Native ≥ 0.83.9 / 0.85.x (Expo SDK 56). It was not back-ported to the 0.81–0.83.2 line, so projects on Expo SDK 52–55 / React Native < 0.83.9 that build from source still hit it on Xcode 26.4+.
Who needs this
You're affected if all of the following are true:
- React Native < 0.83.9 (Expo SDK 52–55), and
- you compile native code with Xcode 26.4 or newer (locally, or on a CI image that uses it), and
fmtis compiled from source — e.g.expo-build-propertieswithios.buildReactNativeFromSource: true, or any setup that doesn't use prebuilt React Native binaries.
Note on EAS Build: EAS pins a per-SDK image. As of writing, the
sdk-54image uses Xcode 26.0 and thesdk-55/latestimage uses Xcode 26.2 — both below 26.4 — so EAS builds for those SDKs are typically unaffected. The error shows up first on local machines that have updated to Xcode 26.4/26.5, and on any image pinned to Xcode 26.4+. This plugin makes the build safe regardless of which Xcode compiles it.
Install
npm install --save-dev expo-fmt-consteval-fix
# or
yarn add -D expo-fmt-consteval-fixUsage
Add it to the plugins array in your app.json / app.config.js / app.config.ts:
{
"expo": {
"plugins": ["expo-fmt-consteval-fix"]
}
}Then regenerate the native project and reinstall pods:
npx expo prebuild -p ios
# (or run pod install if you manage ios/ yourself)Do a clean build afterwards (in Xcode: Product → Clean Build Folder) so stale derived data from the failed build doesn't mask the result.
No options to configure — adding it to plugins is all it takes.
How it works
During expo prebuild, the plugin injects a small snippet into your Podfile's existing post_install hook. On pod install, that snippet rewrites the vendored fmt/include/fmt/base.h to force:
- # define FMT_USE_CONSTEVAL 1
+ # define FMT_USE_CONSTEVAL 0With consteval disabled, fmt validates format strings at runtime instead of compile time, which avoids Apple Clang 21's stricter rules. This is a build-time-only switch — the produced binary behaves identically, since fmt's internal format strings are fixed literals that are always correct. A build that compiles with this patch is behaviorally equivalent to one compiled on an older Xcode without it.
The patch is idempotent: after the first run there are no FMT_USE_CONSTEVAL 1 lines left, so it safely no-ops on every subsequent pod install, and it does nothing if fmt isn't present.
When to remove this
This is a transitional workaround, not a permanent dependency. Remove it once you upgrade to React Native ≥ 0.83.9 / Expo SDK 56 (which bundle fmt 12.1.0 and build cleanly on Xcode 26.4+):
- Remove
"expo-fmt-consteval-fix"from yourpluginsarray. npm uninstall expo-fmt-consteval-fix.npx expo prebuild -p ios --clean.
Compatibility
- Expo SDK: 52–55 (React Native 0.76–0.83.2). Built and tested against SDK 54 (
@expo/config-plugins54.x). @expo/config-plugins:>=7.0.0(uses the long-stablewithDangerousModAPI).- Platforms: iOS only (no-op on Android).
References
- facebook/react-native#55601 — Xcode 26.4 FMT compile errors
- expo/expo#44229 — iOS build from source fails on Xcode 26.4
- fmtlib/fmt#4740 — FMT_STRING consteval error with Apple clang 21
