fix: Use facebook::jsi instead of jsi (#1109)

This PR fixes the Build error in React Native 0.69 for iOS
This commit is contained in:
Rupesh Chaudhari 2022-07-05 14:21:24 +05:30 committed by GitHub
parent 54703f386c
commit 724af31807
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -37,18 +37,18 @@
return nil; return nil;
} }
jsi::Runtime* jsiRuntime = (jsi::Runtime*)cxxBridge.runtime; facebook::jsi::Runtime* jsiRuntime = (facebook::jsi::Runtime*)cxxBridge.runtime;
return ^(RCTLogLevel level, NSString* message) { return ^(RCTLogLevel level, NSString* message) {
[bridge runOnJS:^{ [bridge runOnJS:^{
if (jsiRuntime != nullptr) { if (jsiRuntime != nullptr) {
jsi::Runtime& runtime = *jsiRuntime; facebook::jsi::Runtime& runtime = *jsiRuntime;
auto logFunctionName = [JSConsoleHelper getLogFunctionNameForLogLevel:level]; auto logFunctionName = [JSConsoleHelper getLogFunctionNameForLogLevel:level];
try { try {
auto console = runtime.global().getPropertyAsObject(runtime, "console"); auto console = runtime.global().getPropertyAsObject(runtime, "console");
auto log = console.getPropertyAsFunction(runtime, logFunctionName); auto log = console.getPropertyAsFunction(runtime, logFunctionName);
log.call(runtime, jsi::String::createFromAscii(runtime, [message UTF8String])); log.call(runtime, facebook::jsi::String::createFromAscii(runtime, [message UTF8String]));
} catch (jsi::JSError& jsError) { } catch (facebook::jsi::JSError& jsError) {
NSLog(@"%@", message); NSLog(@"%@", message);
NSLog(@"Failed to call `console.%s`: %s", logFunctionName, jsError.getMessage().c_str()); NSLog(@"Failed to call `console.%s`: %s", logFunctionName, jsError.getMessage().c_str());
} }