diff --git a/ios/MyApp/AppDelegate.h b/ios/MyApp/AppDelegate.h index 9f2ede1..c3e09a4 100644 --- a/ios/MyApp/AppDelegate.h +++ b/ios/MyApp/AppDelegate.h @@ -1,7 +1,9 @@ #import #import -@interface AppDelegate : UIResponder +#import + +@interface AppDelegate : UMAppDelegateWrapper @property (nonatomic, strong) UIWindow *window; diff --git a/ios/MyApp/AppDelegate.m b/ios/MyApp/AppDelegate.m index 9f2ede1..c3e09a4 100644 --- a/ios/MyApp/AppDelegate.m +++ b/ios/MyApp/AppDelegate.m @@ -2,10 +2,14 @@ #import #import #import +#import +#import +#import + #ifdef FB_SONARKIT_ENABLED #import #import #import #import @@ -21,18 +25,26 @@ static void InitializeFlipper(UIApplication *application) { [client addPlugin:[[FlipperKitNetworkPlugin alloc] initWithNetworkAdapter:[SKIOSNetworkAdapter new]]]; [client start]; } #endif +@interface AppDelegate () + +@property (nonatomic, strong) UMModuleRegistryAdapter *moduleRegistryAdapter; + +@end + @implementation AppDelegate - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { #ifdef FB_SONARKIT_ENABLED InitializeFlipper(application); #endif + self.moduleRegistryAdapter = [[UMModuleRegistryAdapter alloc] initWithModuleRegistryProvider:[[UMModuleRegistryProvider alloc] init]]; + RCTBridge *bridge = [[RCTBridge alloc] initWithDelegate:self launchOptions:launchOptions]; RCTRootView *rootView = [[RCTRootView alloc] initWithBridge:bridge moduleName:@"MyApp" initialProperties:nil]; @@ -44,11 +56,19 @@ static void InitializeFlipper(UIApplication *application) { self.window.rootViewController = rootViewController; [self.window makeKeyAndVisible]; + [super application:application didFinishLaunchingWithOptions:launchOptions]; return YES; } +- (NSArray> *)extraModulesForBridge:(RCTBridge *)bridge +{ + NSArray> *extraModules = [_moduleRegistryAdapter extraModulesForBridge:bridge]; + // If you'd like to export some custom RCTBridgeModules that are not Expo modules, add them here! + return extraModules; +} + - (NSURL *)sourceURLForBridge:(RCTBridge *)bridge { #if DEBUG return [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index" fallbackResource:nil]; #else return [[NSBundle mainBundle] URLForResource:@"main" withExtension:@"jsbundle"]; diff --git a/ios/Podfile b/ios/Podfile index a452872..e21468a 100644 --- a/ios/Podfile +++ b/ios/Podfile @@ -1,11 +1,13 @@ -require_relative '../node_modules/react-native/scripts/react_native_pods' -require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules' +require File.join(File.dirname(`node --print "require.resolve('react-native/package.json')"`), "scripts/react_native_pods") +require File.join(File.dirname(`node --print "require.resolve('@react-native-community/cli-platform-ios/package.json')"`), "native_modules") +require File.join(File.dirname(`node --print "require.resolve('react-native-unimodules/package.json')"`), "cocoapods") - platform :ios, '10.0' + platform :ios, '11.0' target 'MyApp' do + use_unimodules! config = use_native_modules! use_react_native!(:path => config["reactNativePath"]) target 'MyAppTests' do