Skip to content

chore: add support for macos platform key in autolinking config#2995

Open
gabrieldonadel wants to merge 1 commit into
microsoft:mainfrom
gabrieldonadel:@gabrieldonadel/expo-autolinking
Open

chore: add support for macos platform key in autolinking config#2995
gabrieldonadel wants to merge 1 commit into
microsoft:mainfrom
gabrieldonadel:@gabrieldonadel/expo-autolinking

Conversation

@gabrieldonadel

Copy link
Copy Markdown

Summary:

The CocoaPods autolinking script hard-codes the ios platform key when reading the react-native config JSON, which assumes the upstream config provider always emits its project root and per-package config under ios. For proper out-of-tree platform support, autolinking should honor --platform macos and read package["platforms"]["macos"], otherwise config["project"]["ios"] is nil and pod install crashes.

Test Plan:

  • pod install in a react-native-macos test app driven by Expo's CLI (expo-modules-autolinking with --platform macos) completes without the nil:NilClass error on config["project"]["ios"].
  • pod install in a react-native-macos test app driven by @react-native-community/cli (which emits ios keys) still resolves the same set of pods as before.
  • Autolinked modules that only declare platforms.ios in their react-native.config.js still appear in Found N modules for target ....

@gabrieldonadel gabrieldonadel requested a review from a team as a code owner June 24, 2026 17:35

@shirakaba shirakaba left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like an improvement, just a forward-facing question from me.

packages = config["dependencies"]
ios_project_root = Pathname.new(config["project"]["ios"]["sourceDir"])
project_config = config["project"]["macos"] || config["project"]["ios"] # [macOS]
ios_project_root = Pathname.new(project_config["sourceDir"]) # [macOS]

@shirakaba shirakaba Jun 25, 2026

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it be beneficial to divide this into ios_project_root and macos_project_root (and add macos_project_root to the return value)?

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.

3 participants