Skip to content

fix(ios): support static frameworks under Expo SDK 57 precompiled pipeline#4245

Merged
mfazekas merged 1 commit into
mainfrom
fix/expo-precompiled-static-frameworks
Jul 5, 2026
Merged

fix(ios): support static frameworks under Expo SDK 57 precompiled pipeline#4245
mfazekas merged 1 commit into
mainfrom
fix/expo-precompiled-static-frameworks

Conversation

@mfazekas

@mfazekas mfazekas commented Jul 5, 2026

Copy link
Copy Markdown
Contributor

Description

Fixes #4242

On Expo SDK 56+'s precompiled iOS pipeline with useFrameworks: static, the library failed to build two ways: pod install hit verify_no_static_framework_transitive_dependencies (our pre_install flips the Mapbox pods to dynamic, but Expo forces most back to static — leaving MapboxMaps dynamic with static deps), and compilation hit 'rnmapbox_maps/rnmapbox_maps-Swift.h' file not found (the RNMBX_USE_FRAMEWORKS macro took the framework import path while the pod was actually built static).

Fix: resolve the Swift header with __has_include so it follows the pod's real build type (same pattern as RNMBXFollyConvert.h; the unused RNMBX_USE_FRAMEWORKS flag is removed), and skip the Mapbox dynamic-framework flip when Expo's precompiled pipeline is active (EXPO_USE_PRECOMPILED_MODULES=1). Non-Expo builds are unaffected.

Verified on a fresh Expo SDK 57 / RN 0.86 app with useFrameworks: static (Xcode 26.6): clean pod install and a successful rnmapbox-maps compile.

Checklist

  • I've read CONTRIBUTING.md
  • I updated the doc/other generated code with running yarn generate
  • Tested on a fresh Expo SDK 57 app (New Architecture / ios)

Component to reproduce the issue you're fixing

Fresh Expo SDK 57 repro (config + component)

app.json (Expo's precompiled pipeline is on by default in SDK 56+):

{
  "expo": {
    "plugins": [
      ["@rnmapbox/maps", { "RNMapboxMapsVersion": "11.20.3" }],
      ["expo-build-properties", { "ios": { "useFrameworks": "static" } }]
    ]
  }
}

App.js:

import Mapbox from '@rnmapbox/maps';
import { StyleSheet } from 'react-native';

const App = () => (
  <Mapbox.MapView style={styles.map}>
    <Mapbox.Camera centerCoordinate={[15.97, 45.81]} zoomLevel={14} />
  </Mapbox.MapView>
);

const styles = StyleSheet.create({ map: { flex: 1 } });

export default App;
npx expo prebuild --clean -p ios
cd ios && pod install   # fails on unpatched build

…eline

Building @rnmapbox/maps with Expo SDK 56+'s precompiled iOS pipeline and
`useFrameworks: static` (e.g. required by react-native-firebase) failed at
two stages:

1. `pod install` raised `verify_no_static_framework_transitive_dependencies`.
   rnmapbox's pre_install flips the Mapbox pods to dynamic frameworks, then
   Expo's precompiled hook downgrades most of them back to static libraries -
   but not MapboxMaps, leaving a dynamic pod with static dependencies.

2. Even past that, compilation failed with
   `'rnmapbox_maps/rnmapbox_maps-Swift.h' file not found`. The
   RNMBX_USE_FRAMEWORKS macro was frozen at podspec-eval time from the
   USE_FRAMEWORKS env, so the Swift header shim took the framework import path
   while Expo actually built the pod as a static library.

Fixes:
- Resolve the generated Swift header with `__has_include`, which follows the
  pod's actual build output instead of a stale macro (same pattern already
  used in RNMBXFollyConvert.h). The now-unused RNMBX_USE_FRAMEWORKS flag is
  removed.
- Skip the Mapbox dynamic-framework flip when Expo's precompiled pipeline is
  active (EXPO_USE_PRECOMPILED_MODULES=1) so all Mapbox pods stay consistently
  static.

Verified on a fresh Expo SDK 57 (RN 0.86) app with useFrameworks: static:
clean pod install and a successful rnmapbox-maps compile (Xcode 26.6).
@mfazekas mfazekas merged commit 12c7751 into main Jul 5, 2026
7 checks passed
@mfazekas mfazekas deleted the fix/expo-precompiled-static-frameworks branch July 5, 2026 05:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: 'rnmapbox_maps/rnmapbox_maps-Swift.h' file not found — RNMBX_USE_FRAMEWORKS mismatch under Expo SDK 57 with static linkage

1 participant