Reviewed By: andreicoman11

Differential Revision: D3855861

fbshipit-source-id: 810d1ea4e6a64231356a4b6953f97de2f54d2558
This commit is contained in:
Aaron Chiu 2016-09-13 08:07:10 -07:00 committed by Facebook Github Bot 7
parent d6926c5468
commit 6f75591620
4 changed files with 10 additions and 65 deletions

View File

@ -11,7 +11,6 @@ package com.facebook.react.bridge;
import javax.annotation.Nullable;
import java.io.IOException;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.HashMap;
@ -447,21 +446,6 @@ public abstract class BaseJavaModule implements NativeModule {
return assertNotNull(mHooks);
}
@Override
public final void writeConstantsField(JsonWriter writer, String fieldName) throws IOException {
Map<String, Object> constants = getConstants();
if (constants == null || constants.isEmpty()) {
return;
}
writer.name(fieldName).beginObject();
for (Map.Entry<String, Object> constant : constants.entrySet()) {
writer.name(constant.getKey());
JsonWriterHelper.value(writer, constant.getValue());
}
writer.endObject();
}
@Override
public void initialize() {
// do nothing
@ -473,11 +457,6 @@ public abstract class BaseJavaModule implements NativeModule {
return false;
}
@Override
public void onReactBridgeInitialized(ReactBridge bridge) {
// do nothing
}
@Override
public void onCatalystInstanceDestroy() {
// do nothing

View File

@ -9,7 +9,6 @@
package com.facebook.react.bridge;
import java.io.IOException;
import java.util.Map;
/**
@ -43,12 +42,6 @@ public interface NativeModule {
*/
Map<String, NativeMethod> getMethods();
/**
* Append a field which represents the constants this module exports
* to JS. If no constants are exported this should do nothing.
*/
void writeConstantsField(JsonWriter writer, String fieldName) throws IOException;
/**
* This is called at the end of {@link CatalystApplicationFragment#createCatalystInstance()}
* after the CatalystInstance has been created, in order to initialize NativeModules that require
@ -64,15 +57,6 @@ public interface NativeModule {
*/
boolean canOverrideExistingModule();
/**
* Called on the JS thread after a ReactBridge has been created. This is useful for native modules
* that need to do any setup before the JS bundle has been loaded. An example of this would be
* installing custom functionality into the JavaScriptCore context.
*
* @param bridge the ReactBridge instance that has just been created
*/
void onReactBridgeInitialized(ReactBridge bridge);
/**
* Called before {CatalystInstance#onHostDestroy}
*/

View File

@ -2,21 +2,16 @@
package com.facebook.react.cxxbridge;
import com.facebook.react.bridge.BaseJavaModule;
import com.facebook.react.bridge.CatalystInstance;
import com.facebook.react.bridge.ExecutorToken;
import com.facebook.react.bridge.JsonWriter;
import com.facebook.react.bridge.NativeModule;
import com.facebook.react.bridge.ReactBridge;
import com.facebook.react.bridge.ReadableNativeArray;
import java.util.Map;
import com.facebook.jni.HybridData;
import com.facebook.proguard.annotations.DoNotStrip;
import com.facebook.react.bridge.CatalystInstance;
import com.facebook.react.bridge.ExecutorToken;
import com.facebook.react.bridge.NativeModule;
import com.facebook.react.bridge.ReadableNativeArray;
import com.facebook.soloader.SoLoader;
import java.io.IOException;
import java.util.Map;
/**
* A Java Object which represents a cross-platform C++ module
*
@ -44,7 +39,9 @@ public class CxxModuleWrapper implements NativeModule
public native HybridData initHybrid();
@Override
public native void invoke(CatalystInstance catalystInstance, ExecutorToken executorToken,
public native void invoke(
CatalystInstance catalystInstance,
ExecutorToken executorToken,
ReadableNativeArray args);
@Override
@ -63,16 +60,6 @@ public class CxxModuleWrapper implements NativeModule
@Override
public native Map<String, NativeMethod> getMethods();
@Override
public void writeConstantsField(JsonWriter writer, String fieldName) throws IOException {
String constants = getConstantsJson();
if (constants == null || constants.isEmpty()) {
return;
}
writer.name(fieldName).rawValue(constants);
}
public native String getConstantsJson();
@Override
@ -90,11 +77,6 @@ public class CxxModuleWrapper implements NativeModule
return false;
}
@Override
public void onReactBridgeInitialized(ReactBridge bridge) {
// do nothing
}
@Override
public void onCatalystInstanceDestroy() {
mHybridData.resetNative();

View File

@ -16,8 +16,8 @@ import java.util.Map;
import android.view.View;
import com.facebook.react.bridge.ReadableArray;
import com.facebook.react.touch.ReactInterceptingViewGroup;
import com.facebook.react.touch.JSResponderHandler;
import com.facebook.react.touch.ReactInterceptingViewGroup;
import com.facebook.react.uimanager.annotations.ReactProp;
import com.facebook.react.uimanager.annotations.ReactPropGroup;
import com.facebook.react.uimanager.annotations.ReactPropertyHolder;