pr feedback

This commit is contained in:
Ari Lazier 2016-08-02 09:49:08 -07:00
parent 67cdae387e
commit e5344035bf
1 changed files with 2 additions and 6 deletions

View File

@ -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]];
} }