mirror of
https://github.com/status-im/react-native.git
synced 2025-02-10 08:26:23 +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 "JCallback.h"
|
||||||
#include "JExecutorToken.h"
|
#include "JExecutorToken.h"
|
||||||
#include "ReadableNativeArray.h"
|
#include "ReadableNativeArray.h"
|
||||||
|
#include "ReadableNativeMap.h"
|
||||||
|
|
||||||
namespace facebook {
|
namespace facebook {
|
||||||
namespace react {
|
namespace react {
|
||||||
@ -144,8 +145,7 @@ jvalue extract(std::weak_ptr<Instance>& instance, ExecutorToken token, char type
|
|||||||
value.l = ReadableNativeArray::newObjectCxxArgs(arg).release();
|
value.l = ReadableNativeArray::newObjectCxxArgs(arg).release();
|
||||||
break;
|
break;
|
||||||
case 'M':
|
case 'M':
|
||||||
// HACK: Workaround for constructing ReadableNativeMap
|
value.l = ReadableNativeMap::newObjectCxxArgs(arg).release();
|
||||||
value.l = ExposedReadableNativeArray(folly::dynamic::array(arg)).getMap(0).release();
|
|
||||||
break;
|
break;
|
||||||
case 'X':
|
case 'X':
|
||||||
value.l = extractCallback(instance, token, arg).release();
|
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());
|
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) {
|
local_ref<NativeMap::jhybridobject> ReadableNativeArray::getMap(jint index) {
|
||||||
// TODO(cjhopman): ... this moves the map?!?
|
auto& elem = array.at(index);
|
||||||
return ReadableNativeMap::createWithContents(std::move(array.at(index)));
|
return ReadableNativeMap::createWithContents(folly::dynamic(elem));
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user