mirror of
https://github.com/status-im/react-native.git
synced 2025-02-25 23:55:23 +00:00
[ReactNative] Use JSValueIsUndefined instead of comparing with JSValueMakeUndefined
Summary: @public Use JSValueIsUndefined instead of caching an JSValueMakeUndefined to compare with as suggested in https://github.com/facebook/react-native/pull/1432#commitcomment-11437434 Test Plan: Run the RCTContextExecutor tests
This commit is contained in:
parent
f8b3c98bc6
commit
1c692e2eb6
@ -66,7 +66,6 @@
|
||||
{
|
||||
RCTJavaScriptContext *_context;
|
||||
NSThread *_javaScriptThread;
|
||||
JSValueRef _undefined;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -238,9 +237,6 @@ static NSError *RCTNSErrorFromJSError(JSContextRef context, JSValueRef jsError)
|
||||
JSContextGroupRelease(group);
|
||||
}
|
||||
|
||||
// Constant value used for comparison
|
||||
_undefined = JSValueMakeUndefined(ctx);
|
||||
|
||||
strongSelf->_context = [[RCTJavaScriptContext alloc] initWithJSContext:ctx];
|
||||
[strongSelf _addNativeHook:RCTNativeLoggingHook withName:"nativeLoggingHook"];
|
||||
[strongSelf _addNativeHook:RCTNoop withName:"noop"];
|
||||
@ -312,7 +308,7 @@ static NSError *RCTNSErrorFromJSError(JSContextRef context, JSValueRef jsError)
|
||||
JSValueRef requireJSRef = JSObjectGetProperty(contextJSRef, globalObjectJSRef, requireNameJSStringRef, &errorJSRef);
|
||||
JSStringRelease(requireNameJSStringRef);
|
||||
|
||||
if (requireJSRef != NULL && requireJSRef != _undefined && errorJSRef == NULL) {
|
||||
if (requireJSRef != NULL && !JSValueIsUndefined(contextJSRef, requireJSRef) && errorJSRef == NULL) {
|
||||
|
||||
// get module
|
||||
JSStringRef moduleNameJSStringRef = JSStringCreateWithCFString((__bridge CFStringRef)name);
|
||||
|
Loading…
x
Reference in New Issue
Block a user