Open dennisvk001 opened 1 year ago
Hi @dennisvk001 ,
I'll investigate the issue and work to solve the problem as soon as possible.
Are there any updates here that have the same issue with RN 0.71.11 (new architecture included)?
Am facing the same issue with rn 72 (new architecture enabled)
I am facing the same issue with 72 and the new architecture enabled.
This seems to relate to Codegen process, but I could be wrong.
Still happens with RN 73 and new architecture enabled.
"react-native-ultimate-config": "6.0.1"
The Codegen part was missing. I did some quick exercise to add it.
I had to add the codegen section to package.json
, add a minimal spec and change the source file from m
to mm
.
Here is the patch made with yarn patch ..
which made it possible to compile the app. No warranty though, I'm touching these kind of new arch things for the first time:
diff --git a/ios/UltimateConfig.h b/ios/UltimateConfig.h
index 41ad9efb55a3fd96986a49ef9e369e5b6271e328..2c3004d99238d8a3c2dbcebdc63838cd068af46f 100644
--- a/ios/UltimateConfig.h
+++ b/ios/UltimateConfig.h
@@ -1,6 +1,6 @@
#ifdef RCT_NEW_ARCH_ENABLED
-#import "RNUltimateConfigSpec.h"
+#import "RNUltimateConfig/RNUltimateConfig.h"
@interface UltimateConfig : NSObject <NativeUltimateConfigSpec>
#else
diff --git a/ios/UltimateConfig.m b/ios/UltimateConfig.m
deleted file mode 100644
index 7debfdff0402385a71111c72517799ec25128e8d..0000000000000000000000000000000000000000
--- a/ios/UltimateConfig.m
+++ /dev/null
@@ -1,26 +0,0 @@
-#import "UltimateConfig.h"
-#import "ConfigValues.h"
-
-@implementation UltimateConfig
-RCT_EXPORT_MODULE()
-
-+ (BOOL)requiresMainQueueSetup
-{
- return YES;
-}
-
-- (NSDictionary *)constantsToExport
-{
- return getValues();
-}
-
-// Don't compile this code when we build for the old architecture.
-#ifdef RCT_NEW_ARCH_ENABLED
-- (std::shared_ptr<facebook::react::TurboModule>)getTurboModule:
- (const facebook::react::ObjCTurboModule::InitParams &)params
-{
- return std::make_shared<facebook::react::NativeUltimateConfigSpecJSI>(params);
-}
-#endif
-
-@end
diff --git a/ios/UltimateConfig.mm b/ios/UltimateConfig.mm
new file mode 100644
index 0000000000000000000000000000000000000000..7debfdff0402385a71111c72517799ec25128e8d
--- /dev/null
+++ b/ios/UltimateConfig.mm
@@ -0,0 +1,26 @@
+#import "UltimateConfig.h"
+#import "ConfigValues.h"
+
+@implementation UltimateConfig
+RCT_EXPORT_MODULE()
+
++ (BOOL)requiresMainQueueSetup
+{
+ return YES;
+}
+
+- (NSDictionary *)constantsToExport
+{
+ return getValues();
+}
+
+// Don't compile this code when we build for the old architecture.
+#ifdef RCT_NEW_ARCH_ENABLED
+- (std::shared_ptr<facebook::react::TurboModule>)getTurboModule:
+ (const facebook::react::ObjCTurboModule::InitParams &)params
+{
+ return std::make_shared<facebook::react::NativeUltimateConfigSpecJSI>(params);
+}
+#endif
+
+@end
diff --git a/ios/UltimateConfig.xcodeproj/project.pbxproj b/ios/UltimateConfig.xcodeproj/project.pbxproj
index 9ec0fd89049bbcf2c75ca18cd7b489a06048ea11..ad1fec12fbc7d2d9020e98f9658ed9dd3df5fc80 100644
--- a/ios/UltimateConfig.xcodeproj/project.pbxproj
+++ b/ios/UltimateConfig.xcodeproj/project.pbxproj
@@ -7,7 +7,7 @@
objects = {
/* Begin PBXBuildFile section */
- 5E555C0D2413F4C50049A1A2 /* UltimateConfig.m in Sources */ = {isa = PBXBuildFile; fileRef = B3E7B5891CC2AC0600A0062D /* UltimateConfig.m */; };
+ 5E555C0D2413F4C50049A1A2 /* UltimateConfig.mm in Sources */ = {isa = PBXBuildFile; fileRef = B3E7B5891CC2AC0600A0062D /* UltimateConfig.mm */; };
/* End PBXBuildFile section */
/* Begin PBXCopyFilesBuildPhase section */
@@ -25,7 +25,7 @@
/* Begin PBXFileReference section */
134814201AA4EA6300B7C361 /* libUltimateConfig.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libUltimateConfig.a; sourceTree = BUILT_PRODUCTS_DIR; };
B3E7B5881CC2AC0600A0062D /* UltimateConfig.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UltimateConfig.h; sourceTree = "<group>"; };
- B3E7B5891CC2AC0600A0062D /* UltimateConfig.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = UltimateConfig.m; sourceTree = "<group>"; };
+ B3E7B5891CC2AC0600A0062D /* UltimateConfig.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = UltimateConfig.mm; sourceTree = "<group>"; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
@@ -51,7 +51,7 @@
isa = PBXGroup;
children = (
B3E7B5881CC2AC0600A0062D /* UltimateConfig.h */,
- B3E7B5891CC2AC0600A0062D /* UltimateConfig.m */,
+ B3E7B5891CC2AC0600A0062D /* UltimateConfig.mm */,
134814211AA4EA7D00B7C361 /* Products */,
);
sourceTree = "<group>";
@@ -113,7 +113,7 @@
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
- B3E7B58A1CC2AC0600A0062D /* UltimateConfig.m in Sources */,
+ B3E7B58A1CC2AC0600A0062D /* UltimateConfig.mm in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
diff --git a/package.json b/package.json
index 6d116ba0f8e34c1671a75ef86df2627e46485892..2b03a617ba86f5caa128e0c96f1a4b5002ec2113 100644
--- a/package.json
+++ b/package.json
@@ -72,5 +72,13 @@
"resolutions": {
"logkitty": "^0.7.1",
"lodash": "^4.17.19"
+ },
+ "codegenConfig": {
+ "android": {
+ "javaPackageName": "com.reactnativeultimateconfig"
+ },
+ "name": "RNUltimateConfig",
+ "type": "all",
+ "jsSrcsDir": "./src/specs"
}
}
diff --git a/src/specs/NativeUltimateConfig.js b/src/specs/NativeUltimateConfig.js
new file mode 100644
index 0000000000000000000000000000000000000000..15a3f85e9f77ed67c209272e140b8e71d04e0fa3
--- /dev/null
+++ b/src/specs/NativeUltimateConfig.js
@@ -0,0 +1,10 @@
+// @flow
+import type {TurboModule} from 'react-native/Libraries/TurboModule/RCTExport';
+import {TurboModuleRegistry} from 'react-native';
+
+export interface Spec extends TurboModule {
+ getConstants: () => {||}
+}
+export default (TurboModuleRegistry.get<Spec>(
+ 'RNUltimateConfig'
+): ?Spec);
\ No newline at end of file
But using of new architecture for such a simple native code is very questionable, imo. 🤔 Even with the new bridgeless mode of RN there is some emulation of old module system and for such a simple module which just returns constants there is no benefit of using JSI or having a delayed initialization of the module itself. I'd just remove the new arch things, if the package still compiles when the app has the new architecture enabled and the bridgeless mode turned on.
Hi, I am having the next problem while building project with RN 0.71.2 (new architecture enabled ):
In file included from ..UltimateConfig.m:1: ..UltimateConfig.h:3:9: fatal error: 'RNUltimateConfigSpec.h' file not found
Ultimate Config Version: "6.0.0"
I didnt found this file in sources, so i suppose it was not generated.