react-native-quickjs
react-native-quickjs copied to clipboard
Old Architecture Support
I saw your example code and it looked like you were using the new architecture:
+ auto cacheDir = [NSSearchPathForDirectoriesInDomains(NSCachesDirectory, NSUserDomainMask, YES).firstObject UTF8String];
+ return std::make_unique<qjs::QuickJSExecutorFactory>(installBindings, ""); // pass empty string to disable code cache
+#endif
Could you use this project with the old architecture?
Which RN version are you working on? @gtokman
Which RN version are you working on? @gtokman
I'm on the latest, 0.73.5 I believe.
I've tried RCT_NEW_ARCH_ENABLED=0 pod install and it worked. What are the steps to reproduce your problem here?
My code for setting up the JS bundle looks similar to the example app.
- (NSURL *)sourceURLForBridge:(RCTBridge *)bridge
{
#if DEBUG
return [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index"];
#else
return [[NSBundle mainBundle] URLForResource:@"main" withExtension:@"jsbundle"];
#endif
}
I saw you have a function that you overrode & it looks like this is where you specify QuickJS.
@implementation AppDelegate
- (std::unique_ptr<facebook::react::JSExecutorFactory>)jsExecutorFactoryForBridge:(RCTBridge *)bridge
{
auto installBindings = facebook::react::RCTJSIExecutorRuntimeInstaller(nullptr);
auto cacheDir = [NSSearchPathForDirectoriesInDomains(NSCachesDirectory, NSUserDomainMask, YES).firstObject UTF8String];
return std::make_unique<qjs::QuickJSExecutorFactory>(installBindings, "");
}
My problems are:
- I'm using a new version of React Native
- My AppDelegate is in Swift & I couldn't get this project to compile after adding it as a dependency in Xcode
For example, this example app. Have you had luck installing this on a more modern project?