diff --git a/ReactNative/RealmRPC.mm b/ReactNative/RealmRPC.mm index 5c7d40d1..98c619c4 100644 --- a/ReactNative/RealmRPC.mm +++ b/ReactNative/RealmRPC.mm @@ -122,11 +122,11 @@ static JSGlobalContextRef s_context; return @{@"result": [self resultForJSValue:propertyValue]}; }; s_requests["/set_property"] = [=](NSDictionary *dict) { - JSValueRef exception = NULL; JSStringRef propString = RJSStringForString([dict[@"name"] UTF8String]); - RPCObjectID realmId = [dict[@"realmId"] longValue]; - JSValueRef value = [[JSValue valueWithObject:dict[@"value"] - inContext:[JSContext contextWithJSGlobalContextRef:s_context]] JSValueRef]; + RPCObjectID realmId = [dict[@"objectId"] longValue]; + JSValueRef value = [self valueFromDictionary:dict[@"value"]]; + JSValueRef exception = NULL; + ObjectSetProperty(s_context, s_objects[realmId], propString, value, &exception); JSStringRelease(propString); diff --git a/lib/rpc.js b/lib/rpc.js index 80395a51..f5850c60 100644 --- a/lib/rpc.js +++ b/lib/rpc.js @@ -71,6 +71,7 @@ function getObjectProperty(realmId, objectId, name) { } function setObjectProperty(realmId, objectId, name, value) { + value = serialize(realmId, value); sendRequest('set_property', {realmId, objectId, name, value}); }