mirror of
https://github.com/zhigang1992/react-native.git
synced 2026-04-10 22:47:58 +08:00
Translating NativeArray into NativeMap on getConstants
Reviewed By: javache Differential Revision: D5321741 fbshipit-source-id: 2465c69a5bd1d4f3cf20ba73e163372b12616312
This commit is contained in:
committed by
Facebook Github Bot
parent
33057aacbf
commit
25d19e3830
@@ -15,13 +15,10 @@ import com.facebook.proguard.annotations.DoNotStrip;
|
||||
@DoNotStrip
|
||||
public class JSCJavaScriptExecutor extends JavaScriptExecutor {
|
||||
public static class Factory implements JavaScriptExecutor.Factory {
|
||||
private ReadableNativeArray mJSCConfig;
|
||||
private ReadableNativeMap mJSCConfig;
|
||||
|
||||
public Factory(WritableNativeMap jscConfig) {
|
||||
// TODO (t10707444): use NativeMap, which requires moving NativeMap out of OnLoad.
|
||||
WritableNativeArray array = new WritableNativeArray();
|
||||
array.pushMap(jscConfig);
|
||||
mJSCConfig = array;
|
||||
mJSCConfig = jscConfig;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -34,9 +31,9 @@ public class JSCJavaScriptExecutor extends JavaScriptExecutor {
|
||||
ReactBridge.staticInit();
|
||||
}
|
||||
|
||||
public JSCJavaScriptExecutor(ReadableNativeArray jscConfig) {
|
||||
public JSCJavaScriptExecutor(ReadableNativeMap jscConfig) {
|
||||
super(initHybrid(jscConfig));
|
||||
}
|
||||
|
||||
private native static HybridData initHybrid(ReadableNativeArray jscConfig);
|
||||
private native static HybridData initHybrid(ReadableNativeMap jscConfig);
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user