Skip to content

Release 5.0.0-beta.1

Pre-release
Pre-release
Compare
Choose a tag to compare
@jdee jdee released this 10 Apr 22:28
· 313 commits to master since this release

For use with react-native >= 0.60

  • This release includes Branch native SDKs Android 5.0.0 and iOS 0.32.0.
  • The branch.subscribe callback now passes a third named parameter, uri,
    which is the URI/URL that originally launched the app. In some cases this
    may be null (e.g. deferred deep links). Consult the ~referring_link,
    +url or +non_branch_link parameter in those cases.
  • You can now be notified when Branch is about to open a link using two
    separate callbacks, onOpenStart and onOpenComplete. The
    onOpenComplete callback is identical with the single callback passed to
    branch.subscribe.
    import branch from 'react-native-branch'

    branch.subscribe({
      onOpenStart: ({uri}) => {
        console.log('Branch will open ' + uri)
      },
      onOpenComplete: ({error, params, uri}) => {
        if (error) {
          console.log('Error from Branch opening ' + uri + ': ' + error)
          return
        }

        console.log('Branch opened ' + uri)
        // handle params
      },
    })

Updating from an earlier version:

iOS

In the AppDelegate, use the following methods:

Obj-C
    - (BOOL)application:(UIApplication *)application openURL:(NSURL *)url options:(nonnull NSDictionary<UIApplicationOpenURLOptionsKey,id> *)options {
      return [RNBranch application:application openURL:url options:options];
    }

    - (BOOL)application:(UIApplication *)application continueUserActivity:(NSUserActivity *)userActivity restorationHandler:(void (^)(NSArray<id<UIUserActivityRestoring>> *restorableObjects))restorationHandler {
      return [RNBranch continueUserActivity:userActivity];
    }
Swift
    func application(_ app: UIApplication, open url: URL, options: [UIApplication.OpenURLOptionsKey : Any] = [:]) -> Bool {
      return RNBranch.application(app, open: url, options: options)
    }

    func application(_ application: UIApplication, continue userActivity: NSUserActivity, restorationHandler: @escaping ([UIUserActivityRestoring]?) -> Void) -> Bool {
      return RNBranch.continue(userActivity)
    }