Translating NativeArray into NativeMap on getConstants

Reviewed By: javache

Differential Revision: D5321741

fbshipit-source-id: 2465c69a5bd1d4f3cf20ba73e163372b12616312
This commit is contained in:
Joana Lopes
2017-06-29 04:15:02 -07:00
committed by Facebook Github Bot
parent 33057aacbf
commit 25d19e3830
4 changed files with 12 additions and 21 deletions
@@ -122,10 +122,8 @@ public class JavaModuleWrapper {
return mDescs;
}
// TODO mhorowitz: make this return NativeMap, which requires moving
// NativeMap out of OnLoad.
@DoNotStrip
public @Nullable NativeArray getConstants() {
public @Nullable NativeMap getConstants() {
if (!mModuleHolder.getHasConstants()) {
return null;
}
@@ -145,9 +143,7 @@ public class JavaModuleWrapper {
Systrace.beginSection(TRACE_TAG_REACT_JAVA_BRIDGE, "create WritableNativeMap");
ReactMarker.logMarker(CONVERT_CONSTANTS_START, moduleName);
try {
WritableNativeArray array = new WritableNativeArray();
array.pushMap(Arguments.makeNativeMap(map));
return array;
return Arguments.makeNativeMap(map);
} finally {
ReactMarker.logMarker(CONVERT_CONSTANTS_END);
Systrace.endSection(TRACE_TAG_REACT_JAVA_BRIDGE);