mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
EZ refactor of bridgless classes (#37168)
Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/37168 EZ refactor of bridgless classes removing lint warns and moving to java 8 changelog: [internal] internal Reviewed By: philIip Differential Revision: D45378241 fbshipit-source-id: 37cc2c575ced12d007bd00623c85696a735eb2c6
This commit is contained in:
committed by
Facebook GitHub Bot
parent
8a49754cda
commit
3f7c2b2215
+1
-1
@@ -18,7 +18,7 @@ public abstract class JSEngineInstance {
|
||||
SoLoader.loadLibrary("rninstance");
|
||||
}
|
||||
|
||||
@DoNotStrip private HybridData mHybridData;
|
||||
@DoNotStrip private final HybridData mHybridData;
|
||||
|
||||
protected JSEngineInstance(HybridData hybridData) {
|
||||
mHybridData = hybridData;
|
||||
|
||||
+10
-12
@@ -73,7 +73,7 @@ final class ReactInstance {
|
||||
|
||||
private static final String TAG = ReactInstance.class.getSimpleName();
|
||||
|
||||
@DoNotStrip private HybridData mHybridData;
|
||||
@DoNotStrip private final HybridData mHybridData;
|
||||
|
||||
private final ReactInstanceDelegate mDelegate;
|
||||
private final BridgelessReactContext mBridgelessReactContext;
|
||||
@@ -172,17 +172,15 @@ final class ReactInstance {
|
||||
new ComponentNameResolverManager(
|
||||
// Use unbuffered RuntimeExecutor to install binding
|
||||
unbufferedRuntimeExecutor,
|
||||
new ComponentNameResolver() {
|
||||
@Override
|
||||
public String[] getComponentNames() {
|
||||
Collection<String> viewManagerNames = getViewManagerNames();
|
||||
if (viewManagerNames.size() < 1) {
|
||||
FLog.e(TAG, "No ViewManager names found");
|
||||
return new String[0];
|
||||
}
|
||||
return viewManagerNames.toArray(new String[0]);
|
||||
}
|
||||
});
|
||||
(ComponentNameResolver)
|
||||
() -> {
|
||||
Collection<String> viewManagerNames = getViewManagerNames();
|
||||
if (viewManagerNames.size() < 1) {
|
||||
FLog.e(TAG, "No ViewManager names found");
|
||||
return new String[0];
|
||||
}
|
||||
return viewManagerNames.toArray(new String[0]);
|
||||
});
|
||||
|
||||
// Set up TurboModules
|
||||
Systrace.beginSection(
|
||||
|
||||
+5
-9
@@ -32,7 +32,6 @@ import javax.annotation.Nullable;
|
||||
@Nullsafe(Nullsafe.Mode.LOCAL)
|
||||
@ThreadSafe
|
||||
public class ReactSurface {
|
||||
private static final String TAG = "ReactSurface";
|
||||
|
||||
private final AtomicReference<ReactSurfaceView> mSurfaceView = new AtomicReference<>(null);
|
||||
|
||||
@@ -180,14 +179,11 @@ public class ReactSurface {
|
||||
|
||||
public void clear() {
|
||||
UiThreadUtil.runOnUiThread(
|
||||
new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
ReactSurfaceView view = getView();
|
||||
if (view != null) {
|
||||
view.removeAllViews();
|
||||
view.setId(View.NO_ID);
|
||||
}
|
||||
() -> {
|
||||
ReactSurfaceView view = getView();
|
||||
if (view != null) {
|
||||
view.removeAllViews();
|
||||
view.setId(View.NO_ID);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
+5
-3
@@ -25,6 +25,7 @@ import com.facebook.react.uimanager.JSTouchDispatcher;
|
||||
import com.facebook.react.uimanager.common.UIManagerType;
|
||||
import com.facebook.react.uimanager.events.EventDispatcher;
|
||||
import com.facebook.systrace.Systrace;
|
||||
import java.util.Objects;
|
||||
|
||||
/** A view created by {@link ReactSurface} that's responsible for rendering a React component. */
|
||||
@Nullsafe(Nullsafe.Mode.LOCAL)
|
||||
@@ -161,10 +162,11 @@ public class ReactSurfaceView extends ReactRootView {
|
||||
|
||||
@Override
|
||||
public void handleException(Throwable t) {
|
||||
if (mSurface.getReactHost() != null) {
|
||||
String errorMessage = t.getMessage() == null ? "" : t.getMessage();
|
||||
ReactHost reactHost = mSurface.getReactHost();
|
||||
if (reactHost != null) {
|
||||
String errorMessage = Objects.toString(t.getMessage(), "");
|
||||
Exception e = new IllegalViewOperationException(errorMessage, this, t);
|
||||
mSurface.getReactHost().handleException(e);
|
||||
reactHost.handleException(e);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user