Skip to content

Comments

fix(ios): resolve app target name for Expo pre-55 patch#239

Merged
artus9033 merged 7 commits intomainfrom
fix/ios/use-app-name
Feb 23, 2026
Merged

fix(ios): resolve app target name for Expo pre-55 patch#239
artus9033 merged 7 commits intomainfrom
fix/ios/use-app-name

Conversation

@hurali97
Copy link
Member

Summary

This resolves the app target name for Expo pre-55 patch by:

  • First, using plugin options, if the user has defined using appTargetName
  • Second, dynamically by referencing the target with type com.apple.product-type.application

By default, if user does not provide the appTargetName we resolve it dynamically, if the name is not found, we throw an error to pass it explicitly.

Test plan

CI passes - 🟢

Copilot AI review requested due to automatic review settings February 23, 2026 06:01
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Updates the Expo config plugin’s iOS “Expo pre-55” patching logic to correctly resolve the app target name instead of assuming a fixed target name, so the patch can locate the correct CocoaPods support file.

Changes:

  • Add ios.appTargetName plugin option (with fallback auto-detection from the Xcode project).
  • Update the pre-55 patch template to use the resolved app target name in the CocoaPods support-file path.
  • Add Xcode project helper logic to locate an application target by productType.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
packages/react-native-brownfield/src/expo-config-plugin/withBrownfield.ts Adds appTargetName into resolved iOS plugin config defaults.
packages/react-native-brownfield/src/expo-config-plugin/types/ios/BrownfieldPluginIosConfig.ts Documents the new appTargetName option in the iOS config type.
packages/react-native-brownfield/src/expo-config-plugin/template/ios/patchExpoPre55.sh Uses {{APP_TARGET_NAME}} when building the CocoaPods support-file path.
packages/react-native-brownfield/src/expo-config-plugin/ios/xcodeHelpers.ts Resolves app target name dynamically and injects it into the patch template render.
packages/react-native-brownfield/src/expo-config-plugin/ios/withBrownfieldIos.ts Wires appTargetName through to the pre-55 patch build phase creation.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

"@callstack/react-native-brownfield",
{
"ios": {
"appTargetName": "MyApp",
Copy link
Member

Choose a reason for hiding this comment

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

in Expo apps, there should be appName available in the app.json config, isn't it?

Copy link
Member Author

Choose a reason for hiding this comment

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

I can't find any such prop exposed 🤔 There is name as config.name and there is no app sort of name under config.ios

Screenshot 2026-02-23 at 12 26 17 PM

https://github.com/expo/expo/blob/5a2ca2ea2380eedbafe0bbde7703d4f110ad7eaf/packages/%40expo/config-types/src/ExpoConfig.ts#L10

Copy link
Member

Choose a reason for hiding this comment

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

can it be different in Expo projects than the Xcode project name?

Copy link
Member Author

Choose a reason for hiding this comment

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

I think it should be the same for generated project. I will verify with using the name option. @artus9033 - is also taking a look on how Expo uses the name to auto generate iOS project.

Copy link
Member

Choose a reason for hiding this comment

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

yeah. because maybe we don't need that change after all, or make it simpler

Copy link
Collaborator

Choose a reason for hiding this comment

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

I modified the auto-detection algorithm as we established with @hurali97 . Now instead of relying on the config field, we're doing the following (the below is in the docs as of now):

  1. Common for all cases: scan the iOS targets for ones of type com.apple.product-type.application
  2. Use the first matching strategy:
    • CNG-derived name from mod compiler (modRequest.projectName) - only if it exists in the filtered application-type list of Xcode project targets
    • Unambiguous first application-type target - if there is exactly one
    • PBX "first native target" fallback - last resort fallback that selects the first native target of any type

The third fallback is desperate and if the first 2 don't work, it's very unlikely anything will work, but we may keep it. If I were to guess, I'd foresee that it's unlikely we ever fall out of the 1st strategy, and even if so (for whatever reason, e.g. due to another config plugin modding the native project) the 2nd should work at all times.

@artus9033 artus9033 merged commit 828bda3 into main Feb 23, 2026
1 check passed
@artus9033 artus9033 deleted the fix/ios/use-app-name branch February 23, 2026 12:22
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