From 135c0515f719f11db383e507b8ad1a8971ec1cee Mon Sep 17 00:00:00 2001 From: Ari Lazier Date: Wed, 7 Oct 2015 22:08:09 -0600 Subject: [PATCH] support returning array values --- ReactNative/RealmRPC.mm | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/ReactNative/RealmRPC.mm b/ReactNative/RealmRPC.mm index c2290a09..b04d61cd 100644 --- a/ReactNative/RealmRPC.mm +++ b/ReactNative/RealmRPC.mm @@ -276,7 +276,13 @@ static JSGlobalContextRef s_context; }; } else if (RJSIsValueArray(s_context, value)) { - assert(0); + JSObjectRef jsObject = JSValueToObject(s_context, value, NULL); + size_t length = RJSValidatedArrayLength(s_context, jsObject); + NSMutableArray *array = [NSMutableArray new]; + for (unsigned int i = 0; i < length; i++) { + [array addObject:[self resultForJSValue:JSObjectGetPropertyAtIndex(s_context, jsObject, i, NULL)]]; + } + return @{@"value": array}; } else { assert(0);