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);
if (!rctJSContext && create) {
Class RCTJavaScriptContext = NSClassFromString(@"RCTJavaScriptContext");
NSMethodSignature *signature = [RCTJavaScriptContext instanceMethodSignatureForSelector:@selector(initWithJSContext:onThread:)];
if (signature) {
if ([RCTJavaScriptContext instancesRespondToSelector:@selector(initWithJSContext:onThread:)]) {
// for RN 0.28.0+
rctJSContext = [[RCTJavaScriptContext alloc] initWithJSContext:[JSContext new] onThread:[NSThread currentThread]];
}
else {
// for RN < 0.28.0
NSMethodSignature *oldSignature = [RCTJavaScriptContext instanceMethodSignatureForSelector:@selector(initWithJSContext:)];
assert(oldSignature);
assert([RCTJavaScriptContext instancesRespondToSelector:@selector(initWithJSContext:)]);
rctJSContext = [[RCTJavaScriptContext alloc] initWithJSContext:[JSContext new]];
}