Skip to content

Commit a2176f1

Browse files
committed
[RN][iOS] Connect New Arch Modules to React Native
1 parent 45024a5 commit a2176f1

4 files changed

Lines changed: 91 additions & 1 deletion

File tree

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
//
2+
// RCTReactNativeCoreModulesProvider.h
3+
// React-RCTAppDelegate
4+
//
5+
// Created by Riccardo Cipolleschi on 10/11/2025.
6+
//
7+
8+
#import <Foundation/Foundation.h>
9+
10+
NS_ASSUME_NONNULL_BEGIN
11+
12+
@interface RCTReactNativeCoreModulesProvider : NSObject
13+
14+
+ (Class) reactNativeCoreModuleForName:(const char *)name;
15+
16+
@end
17+
18+
NS_ASSUME_NONNULL_END
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
//
2+
// RCTReactNativeCoreModulesProvider.m
3+
// React-RCTAppDelegate
4+
//
5+
// Created by Riccardo Cipolleschi on 10/11/2025.
6+
//
7+
8+
#import "RCTReactNativeCoreModulesProvider.h"
9+
10+
#if !RN_DISABLE_OSS_PLUGIN_HEADER
11+
#import <React/CoreModulesPlugins.h>
12+
#import <RCTBlob/RCTBlobPlugins.h>
13+
#import <React/RCTImagePlugins.h>
14+
#import <React/RCTNetworkPlugins.h>
15+
#import <React/RCTSettingsPlugins.h>
16+
#import <React/RCTLinkingPlugins.h>
17+
#import <React/RCTVibrationPlugins.h>
18+
#import <React/RCTAnimationPlugins.h>
19+
20+
#endif
21+
22+
@implementation RCTReactNativeCoreModulesProvider
23+
24+
+ (Class) reactNativeCoreModuleForName:(const char *)name
25+
{
26+
#if !RN_DISABLE_OSS_PLUGIN_HEADER
27+
Class clazz = RCTCoreModulesClassProvider(name);
28+
if (clazz != NULL) {
29+
return clazz;
30+
}
31+
clazz = RCTBlobClassProvider(name);
32+
if (clazz != NULL) {
33+
return clazz;
34+
}
35+
clazz = RCTImageClassProvider(name);
36+
if (clazz != NULL) {
37+
return clazz;
38+
}
39+
clazz = RCTNetworkClassProvider(name);
40+
if (clazz != NULL) {
41+
return clazz;
42+
}
43+
clazz = RCTSettingsClassProvider(name);
44+
if (clazz != NULL) {
45+
return clazz;
46+
}
47+
clazz = RCTLinkingClassProvider(name);
48+
if (clazz != NULL) {
49+
return clazz;
50+
}
51+
clazz = RCTVibrationClassProvider(name);
52+
if (clazz != NULL) {
53+
return clazz;
54+
}
55+
clazz = RCTAnimationClassProvider(name);
56+
if (clazz != NULL) {
57+
return clazz;
58+
}
59+
60+
#endif
61+
62+
return NULL;
63+
}
64+
65+
@end

packages/react-native/Libraries/AppDelegate/RCTReactNativeFactory.mm

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
*/
77

88
#import "RCTReactNativeFactory.h"
9+
#import "RCTReactNativeCoreModulesProvider.h"
910
#import <React/RCTBundleManager.h>
1011
#import <React/RCTColorSpaceUtils.h>
1112
#import <React/RCTDevMenu.h>
@@ -166,7 +167,7 @@ - (Class)getModuleClassFromName:(const char *)name
166167
return moduleClass;
167168
}
168169
}
169-
return RCTCoreModulesClassProvider(name);
170+
return [RCTReactNativeCoreModulesProvider reactNativeCoreModuleForName:name];
170171
#endif
171172
}
172173

packages/react-native/Libraries/AppDelegate/React-RCTAppDelegate.podspec

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,12 @@ Pod::Spec.new do |s|
6262
s.dependency "React-CoreModules"
6363
s.dependency "React-RCTFBReactNativeSpec"
6464
s.dependency "React-defaultsnativemodule"
65+
s.dependency "React-RCTAnimation"
66+
s.dependency "React-RCTBlob"
67+
s.dependency "React-RCTLinking"
68+
s.dependency "React-RCTSettings"
69+
s.dependency "React-RCTVibration"
70+
6571
if use_hermes()
6672
s.dependency 'React-hermes'
6773
end

0 commit comments

Comments
 (0)