mirror of
https://github.com/zhigang1992/react-native.git
synced 2026-04-29 04:35:36 +08:00
clean up
Reviewed By: andreicoman11 Differential Revision: D3855861 fbshipit-source-id: 810d1ea4e6a64231356a4b6953f97de2f54d2558
This commit is contained in:
committed by
Facebook Github Bot 7
parent
d6926c5468
commit
6f75591620
@@ -11,7 +11,6 @@ package com.facebook.react.bridge;
|
|||||||
|
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.lang.reflect.InvocationTargetException;
|
import java.lang.reflect.InvocationTargetException;
|
||||||
import java.lang.reflect.Method;
|
import java.lang.reflect.Method;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
@@ -447,21 +446,6 @@ public abstract class BaseJavaModule implements NativeModule {
|
|||||||
return assertNotNull(mHooks);
|
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
|
@Override
|
||||||
public void initialize() {
|
public void initialize() {
|
||||||
// do nothing
|
// do nothing
|
||||||
@@ -473,11 +457,6 @@ public abstract class BaseJavaModule implements NativeModule {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onReactBridgeInitialized(ReactBridge bridge) {
|
|
||||||
// do nothing
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onCatalystInstanceDestroy() {
|
public void onCatalystInstanceDestroy() {
|
||||||
// do nothing
|
// do nothing
|
||||||
|
|||||||
@@ -9,7 +9,6 @@
|
|||||||
|
|
||||||
package com.facebook.react.bridge;
|
package com.facebook.react.bridge;
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -43,12 +42,6 @@ public interface NativeModule {
|
|||||||
*/
|
*/
|
||||||
Map<String, NativeMethod> getMethods();
|
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()}
|
* This is called at the end of {@link CatalystApplicationFragment#createCatalystInstance()}
|
||||||
* after the CatalystInstance has been created, in order to initialize NativeModules that require
|
* after the CatalystInstance has been created, in order to initialize NativeModules that require
|
||||||
@@ -64,15 +57,6 @@ public interface NativeModule {
|
|||||||
*/
|
*/
|
||||||
boolean canOverrideExistingModule();
|
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}
|
* Called before {CatalystInstance#onHostDestroy}
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -2,21 +2,16 @@
|
|||||||
|
|
||||||
package com.facebook.react.cxxbridge;
|
package com.facebook.react.cxxbridge;
|
||||||
|
|
||||||
import com.facebook.react.bridge.BaseJavaModule;
|
import java.util.Map;
|
||||||
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 com.facebook.jni.HybridData;
|
import com.facebook.jni.HybridData;
|
||||||
import com.facebook.proguard.annotations.DoNotStrip;
|
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 com.facebook.soloader.SoLoader;
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A Java Object which represents a cross-platform C++ module
|
* A Java Object which represents a cross-platform C++ module
|
||||||
*
|
*
|
||||||
@@ -44,8 +39,10 @@ public class CxxModuleWrapper implements NativeModule
|
|||||||
public native HybridData initHybrid();
|
public native HybridData initHybrid();
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public native void invoke(CatalystInstance catalystInstance, ExecutorToken executorToken,
|
public native void invoke(
|
||||||
ReadableNativeArray args);
|
CatalystInstance catalystInstance,
|
||||||
|
ExecutorToken executorToken,
|
||||||
|
ReadableNativeArray args);
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public native String getType();
|
public native String getType();
|
||||||
@@ -63,16 +60,6 @@ public class CxxModuleWrapper implements NativeModule
|
|||||||
@Override
|
@Override
|
||||||
public native Map<String, NativeMethod> getMethods();
|
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();
|
public native String getConstantsJson();
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -90,11 +77,6 @@ public class CxxModuleWrapper implements NativeModule
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onReactBridgeInitialized(ReactBridge bridge) {
|
|
||||||
// do nothing
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onCatalystInstanceDestroy() {
|
public void onCatalystInstanceDestroy() {
|
||||||
mHybridData.resetNative();
|
mHybridData.resetNative();
|
||||||
|
|||||||
@@ -16,8 +16,8 @@ import java.util.Map;
|
|||||||
import android.view.View;
|
import android.view.View;
|
||||||
|
|
||||||
import com.facebook.react.bridge.ReadableArray;
|
import com.facebook.react.bridge.ReadableArray;
|
||||||
import com.facebook.react.touch.ReactInterceptingViewGroup;
|
|
||||||
import com.facebook.react.touch.JSResponderHandler;
|
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.ReactProp;
|
||||||
import com.facebook.react.uimanager.annotations.ReactPropGroup;
|
import com.facebook.react.uimanager.annotations.ReactPropGroup;
|
||||||
import com.facebook.react.uimanager.annotations.ReactPropertyHolder;
|
import com.facebook.react.uimanager.annotations.ReactPropertyHolder;
|
||||||
|
|||||||
Reference in New Issue
Block a user