mirror of
https://github.com/zhigang1992/react-native.git
synced 2026-04-29 04:35:36 +08:00
Specialize JSCValueEncoder for id instead of NSArray
Reviewed By: kathryngray Differential Revision: D5355723 fbshipit-source-id: a992514c92143fcac52f8e35824c665a1cb44ea4
This commit is contained in:
committed by
Facebook Github Bot
parent
782453d35e
commit
1cd276ab5c
@@ -26,16 +26,10 @@ std::vector<std::unique_ptr<NativeModule>> createNativeModules(NSArray<RCTModule
|
||||
|
||||
JSContext *contextForGlobalContextRef(JSGlobalContextRef contextRef);
|
||||
|
||||
/*
|
||||
* The ValueEncoder<NSArray *>::toValue is used by JSCExecutor callFunctionSync.
|
||||
* Note: Because the NSArray * is really a NSArray * __strong the toValue is
|
||||
* accepting NSArray *const __strong instead of NSArray *&&.
|
||||
*/
|
||||
template <>
|
||||
struct ValueEncoder<NSArray *> {
|
||||
static Value toValue(JSGlobalContextRef ctx, NSArray *const __strong array)
|
||||
{
|
||||
JSValue *value = [JSC_JSValue(ctx) valueWithObject:array inContext:contextForGlobalContextRef(ctx)];
|
||||
template<>
|
||||
struct JSCValueEncoder<id> {
|
||||
static Value toJSCValue(JSGlobalContextRef ctx, id obj) {
|
||||
JSValue *value = [JSC_JSValue(ctx) valueWithObject:obj inContext:contextForGlobalContextRef(ctx)];
|
||||
return {ctx, [value JSValueRef]};
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user