Skip to content

Commit f88924f

Browse files
committed
fix
1 parent b815fa4 commit f88924f

1 file changed

Lines changed: 15 additions & 4 deletions

File tree

ios/RNNAppDelegate.mm

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
#import <react/featureflags/ReactNativeFeatureFlagsDefaults.h>
55

66
#import "RCTAppSetupUtils.h"
7-
#import <React/CoreModulesPlugins.h>
87
#if __has_include(<React/RCTCxxBridgeDelegate.h>)
98
#import <React/RCTCxxBridgeDelegate.h>
109
#endif
@@ -56,12 +55,17 @@ @implementation RNNAppDelegate
5655
- (BOOL)application:(UIApplication *)application
5756
didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
5857

58+
// RN 0.77 & RN0.78
5959
#if !RNN_RN_VERSION_79_OR_NEWER
60-
[self _setUpFeatureFlags];
60+
#if __has_include(<ReactAppDependencyProvider/RCTAppDependencyProvider.h>)
61+
self.dependencyProvider = [RCTAppDependencyProvider new];
62+
#endif
63+
// RN 0.77
6164
#if !RNN_RN_VERSION_78
65+
[self _setUpFeatureFlags];
6266
self.rootViewFactory = [self createRCTRootViewFactory];
63-
#else
64-
self.reactNativeFactory = [[RCTReactNativeFactory alloc] init];
67+
#else // RN0.78
68+
self.reactNativeFactory = [[RCTReactNativeFactory alloc] initWithDelegate:self];
6569
self.reactNativeFactory.rootViewFactory = [self createRCTRootViewFactory];
6670
#endif
6771

@@ -119,6 +123,13 @@ - (RCTRootViewFactory *)createRCTRootViewFactory
119123
return [[RCTRootViewFactory alloc] initWithConfiguration:configuration andTurboModuleManagerDelegate:self];
120124
}
121125

126+
#pragma mark - RCTTurboModuleManagerDelegate
127+
128+
- (id<RCTTurboModule>)getModuleInstanceFromClass:(Class)moduleClass
129+
{
130+
return RCTAppSetupDefaultModuleFromClass(moduleClass, self.dependencyProvider);
131+
}
132+
122133
#pragma mark - Feature Flags
123134
class RCTAppDelegateBridgelessFeatureFlags : public facebook::react::ReactNativeFeatureFlagsDefaults {
124135
public:

0 commit comments

Comments
 (0)