Created
March 31, 2020 14:57
-
-
Save nastyakitsune/bfcb5ce0c134210dcf08368b53fd9c8e to your computer and use it in GitHub Desktop.
App Linking React Native & Objective-C
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #import "AppDelegate.h" | |
| #import <React/RCTBridge.h> | |
| #import <React/RCTBundleURLProvider.h> | |
| #import <ReactNativeNavigation/ReactNativeNavigation.h> | |
| #import <React/RCTLinkingManager.h> | |
| @implementation AppDelegate | |
| - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions | |
| { | |
| RCTBridge *bridge = [[RCTBridge alloc] initWithDelegate:self launchOptions:launchOptions]; | |
| [ReactNativeNavigation bootstrap:[self sourceURLForBridge: bridge] launchOptions:launchOptions]; | |
| return YES; | |
| } | |
| - (NSURL *)sourceURLForBridge:(RCTBridge *)bridge | |
| { | |
| #if DEBUG | |
| return [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index" fallbackResource:nil]; | |
| #else | |
| return [[NSBundle mainBundle] URLForResource:@"main" withExtension:@"jsbundle"]; | |
| #endif | |
| } | |
| - (BOOL)application:(UIApplication *)application | |
| openURL:(NSURL *)url | |
| options:(NSDictionary<UIApplicationOpenURLOptionsKey,id> *)options | |
| { | |
| return [RCTLinkingManager application:application openURL:url options:options]; | |
| } | |
| - (BOOL)application:(UIApplication *)application continueUserActivity:(nonnull NSUserActivity *)userActivity | |
| restorationHandler:(nonnull void (^)(NSArray<id<UIUserActivityRestoring>> * _Nullable))restorationHandler | |
| { | |
| return [RCTLinkingManager application:application | |
| continueUserActivity:userActivity | |
| restorationHandler:restorationHandler]; | |
| } | |
| @end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment