react-native-auth0: Expo config plugin fails with latest React Native

Checklist

Description

When I run prebuild with the Auth0 plugin configured on Expo canary and React Native 0.79, I get this:

Error: [ios.appDelegate]: withIosAppDelegateBaseMod: Failed to match "/@end/" in contents:
import React
import Expo

@UIApplicationMain
public class AppDelegate: ExpoAppDelegate {
  public override func application(
    _ application: UIApplication,
    didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? = nil
  ) -> Bool {
    self.moduleName = "main"
    self.initialProps = [:]

    return super.application(application, didFinishLaunchingWithOptions: launchOptions)
  }

  public override func bundleURL() -> URL? {
#if DEBUG
    return RCTBundleURLProvider.sharedSettings().jsBundleURL(forBundleRoot: ".expo/.virtual-metro-entry")
#else
    return Bundle.main.url(forResource: "main", withExtension: "jsbundle")
#endif
  }

  // Linking API
  public override func application(
    _ app: UIApplication,
    open url: URL,
    options: [UIApplication.OpenURLOptionsKey: Any] = [:]
  ) -> Bool {
    return super.application(app, open: url, options: options) || RCTLinkingManager.application(app, open: url, options: options)
  }

  // Universal Links
  public override func application(
    _ application: UIApplication,
    continue userActivity: NSUserActivity,
    restorationHandler: @escaping ([UIUserActivityRestoring]?) -> Void
  ) -> Bool {
    let result = RCTLinkingManager.application(application, continue: userActivity, restorationHandler: restorationHandler)
    return super.application(application, continue: userActivity, restorationHandler: restorationHandler) || result
  }
}

Error: [ios.appDelegate]: withIosAppDelegateBaseMod: Failed to match "/@end/" in contents:
import React
import Expo

@UIApplicationMain
public class AppDelegate: ExpoAppDelegate {
  public override func application(
    _ application: UIApplication,
    didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? = nil
  ) -> Bool {
    self.moduleName = "main"
    self.initialProps = [:]

    return super.application(application, didFinishLaunchingWithOptions: launchOptions)
  }

  public override func bundleURL() -> URL? {
#if DEBUG
    return RCTBundleURLProvider.sharedSettings().jsBundleURL(forBundleRoot: ".expo/.virtual-metro-entry")
#else
    return Bundle.main.url(forResource: "main", withExtension: "jsbundle")
#endif
  }

  // Linking API
  public override func application(
    _ app: UIApplication,
    open url: URL,
    options: [UIApplication.OpenURLOptionsKey: Any] = [:]
  ) -> Bool {
    return super.application(app, open: url, options: options) || RCTLinkingManager.application(app, open: url, options: options)
  }

  // Universal Links
  public override func application(
    _ application: UIApplication,
    continue userActivity: NSUserActivity,
    restorationHandler: @escaping ([UIUserActivityRestoring]?) -> Void
  ) -> Bool {
    let result = RCTLinkingManager.application(application, continue: userActivity, restorationHandler: restorationHandler)
    return super.application(application, continue: userActivity, restorationHandler: restorationHandler) || result
  }
}

    at addLines (/Users/admin/Desktop/projects/statnews/mobile/node_modules/react-native-auth0/lib/commonjs/plugin/plugin/generateCode.ts:100:19)
    at mergeContents (/Users/admin/Desktop/projects/statnews/mobile/node_modules/react-native-auth0/lib/commonjs/plugin/plugin/generateCode.ts:62:17)
    at addAuth0AppDelegateCode (/Users/admin/Desktop/projects/statnews/mobile/node_modules/react-native-auth0/lib/commonjs/plugin/plugin/withAuth0.ts:113:28)
    at action (/Users/admin/Desktop/projects/statnews/mobile/node_modules/react-native-auth0/lib/commonjs/plugin/plugin/withAuth0.ts:145:34)
    at action (/Users/admin/Desktop/projects/statnews/mobile/node_modules/@expo/config-plugins/src/plugins/withMod.ts:228:29)
    at nextMod (/Users/admin/Desktop/projects/statnews/mobile/node_modules/@expo/config-plugins/src/plugins/withMod.ts:109:27)
    at action (/Users/admin/Desktop/projects/statnews/mobile/node_modules/@expo/config-plugins/src/plugins/withMod.ts:229:14)
    at async interceptingMod (/Users/admin/Desktop/projects/statnews/mobile/node_modules/@expo/config-plugins/src/plugins/withMod.ts:109:21)
    at async action (/Users/admin/Desktop/projects/statnews/mobile/node_modules/@expo/config-plugins/src/plugins/createBaseMod.ts:82:21)
    at async interceptingMod (/Users/admin/Desktop/projects/statnews/mobile/node_modules/@expo/config-plugins/src/plugins/withMod.ts:109:21)

Reproduction

  1. Configured react-native-auth0 plugin in app.config.ts
  2. Upgraded to 53.0.0-canary-20250331-817737a and React Native 0.79.0-rc.0
  3. npx expo prebuild --clean

Additional context

Believe this may have to do with the switch to Swift, may need to add Swift handling. I don’t think this is limited to 0.79 and it likely won’t go away with more stable Expo releases.

react-native-auth0 version

4.4.0

React Native version

0.79.0-rc.0

Expo version

53.0.0-canary-20250331-817737a

Platform

iOS

Platform version(s)

n/a

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Reactions: 4
  • Comments: 21 (5 by maintainers)

Most upvoted comments

The changes are now published as 5.0.0-beta.1.

👋 Hey everyone,

Thanks so much for all your suggestions and feedback — it’s been incredibly helpful in guiding this upgrade!

We’ve completed the changes related to React Native 0.79.2 and Expo SDK 53. The SDK and example app have both been updated accordingly.

We’re planning to publish the new release early next week. Stay tuned, and please let us know if you spot anything else in the meantime!

🙏 Thanks again for your continued support!

@subhankarmaiti When can the first stable 5.x release be expected?

@chriszs You’re correct—the changes aren’t present in this branch. The issue we’re currently addressing is unrelated to the expo update. I’ll push the AppDelegate updates to this branch later today, so you can test them if you’d like.

@benjaminkomen The changes are in dev and will be available in the next beta release by next week.

Hey everyone, just a quick update — the changes have taken longer than we anticipated, which is why we weren’t able to release last week as originally planned. We’re actively working on resolving the remaining issues, and as soon as everything is sorted, we plan to roll out the release later this week. Thanks for your patience and understanding! 🙌

Looking forward to it, Expo 53 has been released today.

I ran into the same issue, I upgraded to 5.0.0-beta.0 but that did not resolve it.

@fhenriquezn Pretty sure @chriszs is not using Expo prebuild and has materialized ios/android files in his app. The PR, as it is right now, is not functional as an Expo plugin because the CommonJS build of this plugin was removed. See this comment: https://github.com/auth0/react-native-auth0/pull/1147#issuecomment-2861095250

Expo has now publicly announced their beta period for SDK 53, which they plan to last about two weeks: https://expo.dev/changelog/sdk-53-beta

@subhankarmaiti Great! Thanks for acknowledging the issue and prioritizing a fix. As I mention in #1096 React Native 0.79 is now released and Expo appears to be planning to release within as little as a week (branch cut, unannounced preview version released).