Skip to content

Instructions for react native 0.77 and 0.78 #1084

@jpccarvalho

Description

@jpccarvalho

Documentation Feedback

I'm struggling to configure the lib for iOS, since the version of my project is 0.78, which AppDelegate.swift syntax is a little different from the expected in de documentation.

In example, a fresh project has this file: (got this info from React Native Upgrade Helper)

import UIKit
import React
import React_RCTAppDelegate
import ReactAppDependencyProvider
 
@main
class AppDelegate: RCTAppDelegate {
override func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey : Any]? = nil) -> Bool {
self.moduleName = "RnDiffApp"
self.dependencyProvider = RCTAppDependencyProvider()
 
// You can add your custom initial props in the dictionary below.
// They will be passed down to the ViewController used by React Native.
self.initialProps = [:]
 
return super.application(application, didFinishLaunchingWithOptions: launchOptions)
}
 
override func sourceURL(for bridge: RCTBridge) -> URL? {
self.bundleURL()
}
 
override func bundleURL() -> URL? {
#if DEBUG
RCTBundleURLProvider.sharedSettings().jsBundleURL(forBundleRoot: "index")
#else
Bundle.main.url(forResource: "main", withExtension: "jsbundle")
#endif
}
}

And the docs says that for react-native >= 0.77, this is expected:

@main
**class AppDelegate: UIResponder, UIApplicationDelegate,
  RNAppAuthAuthorizationFlowManager** {
  //... existing code...
  // Required by RNAppAuthAuthorizationFlowManager protocol
  public weak var authorizationFlowManagerDelegate:
    RNAppAuthAuthorizationFlowManagerDelegate?
  //... existing code...

  // Handle OAuth redirect URL
  func application(
    _ app: UIApplication,
    open url: URL,
    options: [UIApplication.OpenURLOptionsKey: Any] = [:]
  ) -> Bool {
    if let authorizationFlowManagerDelegate = self
      .authorizationFlowManagerDelegate
    {
      if authorizationFlowManagerDelegate.resumeExternalUserAgentFlow(with: url)
      {
        return true
      }
    }
    return false
  }
}

Which is an update in AppDelegate.swift that took place in react native 0.79.0.
How should this be properly configured?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions