mirror of
https://github.com/status-im/react-native.git
synced 2025-02-04 21:53:30 +00:00
Remove terrible ReadableNativeArray::getMap() hack
Reviewed By: mhorowitz Differential Revision: D3753952 fbshipit-source-id: c8ea693d3a24adad9f907ad28b811cf69ab9e68d
This commit is contained in:
parent
d8b2bab794
commit
9a5d3bacb9
@ -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>& 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();
|
||||
|
@ -76,11 +76,9 @@ local_ref<ReadableType> ReadableNativeArray::getType(jint index) {
|
||||
return ReadableType::getType(array.at(index).type());
|
||||
}
|
||||
|
||||
// Export getMap() so we can workaround constructing ReadableNativeMap
|
||||
__attribute__((visibility("default")))
|
||||
local_ref<NativeMap::jhybridobject> 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 {
|
||||
|
Loading…
x
Reference in New Issue
Block a user