pr feedback
This commit is contained in:
parent
67cdae387e
commit
e5344035bf
|
@ -56,17 +56,13 @@ extern "C" JSGlobalContextRef RealmReactGetJSGlobalContextForExecutor(id executo
|
||||||
id rctJSContext = object_getIvar(executor, contextIvar);
|
id rctJSContext = object_getIvar(executor, contextIvar);
|
||||||
if (!rctJSContext && create) {
|
if (!rctJSContext && create) {
|
||||||
Class RCTJavaScriptContext = NSClassFromString(@"RCTJavaScriptContext");
|
Class RCTJavaScriptContext = NSClassFromString(@"RCTJavaScriptContext");
|
||||||
|
if ([RCTJavaScriptContext instancesRespondToSelector:@selector(initWithJSContext:onThread:)]) {
|
||||||
NSMethodSignature *signature = [RCTJavaScriptContext instanceMethodSignatureForSelector:@selector(initWithJSContext:onThread:)];
|
|
||||||
if (signature) {
|
|
||||||
// for RN 0.28.0+
|
// for RN 0.28.0+
|
||||||
rctJSContext = [[RCTJavaScriptContext alloc] initWithJSContext:[JSContext new] onThread:[NSThread currentThread]];
|
rctJSContext = [[RCTJavaScriptContext alloc] initWithJSContext:[JSContext new] onThread:[NSThread currentThread]];
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
// for RN < 0.28.0
|
// for RN < 0.28.0
|
||||||
NSMethodSignature *oldSignature = [RCTJavaScriptContext instanceMethodSignatureForSelector:@selector(initWithJSContext:)];
|
assert([RCTJavaScriptContext instancesRespondToSelector:@selector(initWithJSContext:)]);
|
||||||
assert(oldSignature);
|
|
||||||
|
|
||||||
rctJSContext = [[RCTJavaScriptContext alloc] initWithJSContext:[JSContext new]];
|
rctJSContext = [[RCTJavaScriptContext alloc] initWithJSContext:[JSContext new]];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue