diff --git a/ReactAndroid/src/main/jni/xreact/jni/MethodInvoker.cpp b/ReactAndroid/src/main/jni/xreact/jni/MethodInvoker.cpp index 75233fbf0..846017a68 100644 --- a/ReactAndroid/src/main/jni/xreact/jni/MethodInvoker.cpp +++ b/ReactAndroid/src/main/jni/xreact/jni/MethodInvoker.cpp @@ -11,6 +11,7 @@ #include "JCallback.h" #include "JExecutorToken.h" #include "ReadableNativeArray.h" +#include "ReadableNativeMap.h" namespace facebook { namespace react { @@ -144,8 +145,7 @@ jvalue extract(std::weak_ptr& instance, ExecutorToken token, char type value.l = ReadableNativeArray::newObjectCxxArgs(arg).release(); break; case 'M': - // HACK: Workaround for constructing ReadableNativeMap - value.l = ExposedReadableNativeArray(folly::dynamic::array(arg)).getMap(0).release(); + value.l = ReadableNativeMap::newObjectCxxArgs(arg).release(); break; case 'X': value.l = extractCallback(instance, token, arg).release(); diff --git a/ReactAndroid/src/main/jni/xreact/jni/ReadableNativeArray.cpp b/ReactAndroid/src/main/jni/xreact/jni/ReadableNativeArray.cpp index 58df6c88b..e42e02796 100644 --- a/ReactAndroid/src/main/jni/xreact/jni/ReadableNativeArray.cpp +++ b/ReactAndroid/src/main/jni/xreact/jni/ReadableNativeArray.cpp @@ -76,11 +76,9 @@ local_ref ReadableNativeArray::getType(jint index) { return ReadableType::getType(array.at(index).type()); } -// Export getMap() so we can workaround constructing ReadableNativeMap -__attribute__((visibility("default"))) local_ref ReadableNativeArray::getMap(jint index) { - // TODO(cjhopman): ... this moves the map?!? - return ReadableNativeMap::createWithContents(std::move(array.at(index))); + auto& elem = array.at(index); + return ReadableNativeMap::createWithContents(folly::dynamic(elem)); } namespace {