fix(ios): support static frameworks under Expo SDK 57 precompiled pipeline#4245
Merged
Conversation
…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).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Fixes #4242
On Expo SDK 56+'s precompiled iOS pipeline with
useFrameworks: static, the library failed to build two ways:pod installhitverify_no_static_framework_transitive_dependencies(ourpre_installflips the Mapbox pods to dynamic, but Expo forces most back to static — leavingMapboxMapsdynamic with static deps), and compilation hit'rnmapbox_maps/rnmapbox_maps-Swift.h' file not found(theRNMBX_USE_FRAMEWORKSmacro took the framework import path while the pod was actually built static).Fix: resolve the Swift header with
__has_includeso it follows the pod's real build type (same pattern asRNMBXFollyConvert.h; the unusedRNMBX_USE_FRAMEWORKSflag 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): cleanpod installand a successfulrnmapbox-mapscompile.Checklist
CONTRIBUTING.mdyarn generateComponent 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: