revert D5609280

Reviewed By: achen1

Differential Revision: D5711182

fbshipit-source-id: 5b4d813d144d92671090443990a3e2ea2abf3abe
This commit is contained in:
Aaron Chiu
2017-08-25 18:25:56 -07:00
committed by Facebook Github Bot
parent 26ef0b0f33
commit 5d58831eac
4 changed files with 8 additions and 16 deletions

View File

@@ -932,6 +932,7 @@ public class ReactInstanceManager {
Systrace.beginSection(TRACE_TAG_REACT_JAVA_BRIDGE, "attachRootViewToInstance");
UIManagerModule uiManagerModule = catalystInstance.getNativeModule(UIManagerModule.class);
final int rootTag = uiManagerModule.addRootView(rootView);
rootView.setRootViewTag(rootTag);
rootView.runApplication();
Systrace.beginAsyncSection(
TRACE_TAG_REACT_JAVA_BRIDGE,

View File

@@ -41,10 +41,8 @@ import com.facebook.react.modules.deviceinfo.DeviceInfoModule;
import com.facebook.react.uimanager.DisplayMetricsHolder;
import com.facebook.react.uimanager.JSTouchDispatcher;
import com.facebook.react.uimanager.PixelUtil;
import com.facebook.react.uimanager.ReactRootViewTagGenerator;
import com.facebook.react.uimanager.RootView;
import com.facebook.react.uimanager.SizeMonitoringFrameLayout;
import com.facebook.react.uimanager.TaggedRootView;
import com.facebook.react.uimanager.UIManagerModule;
import com.facebook.react.uimanager.events.EventDispatcher;
import com.facebook.systrace.Systrace;
@@ -62,7 +60,7 @@ import javax.annotation.Nullable;
* subsequent touch events related to that gesture (in case when JS code want to handle that
* gesture).
*/
public class ReactRootView extends SizeMonitoringFrameLayout implements RootView, TaggedRootView {
public class ReactRootView extends SizeMonitoringFrameLayout implements RootView {
/**
* Listener interface for react root view events
@@ -79,7 +77,7 @@ public class ReactRootView extends SizeMonitoringFrameLayout implements RootView
private @Nullable Bundle mAppProperties;
private @Nullable CustomGlobalLayoutListener mCustomGlobalLayoutListener;
private @Nullable ReactRootViewEventListener mRootViewEventListener;
private int mRootViewTag = ReactRootViewTagGenerator.getNextRootViewTag();
private int mRootViewTag;
private boolean mIsAttachedToInstance;
private boolean mShouldLogContentAppeared;
private final JSTouchDispatcher mJSTouchDispatcher = new JSTouchDispatcher(this);
@@ -257,7 +255,6 @@ public class ReactRootView extends SizeMonitoringFrameLayout implements RootView
if (mReactInstanceManager != null && mIsAttachedToInstance) {
mReactInstanceManager.detachRootView(this);
mIsAttachedToInstance = false;
mRootViewTag = ReactRootViewTagGenerator.getNextRootViewTag();
}
mShouldLogContentAppeared = false;
}
@@ -361,11 +358,14 @@ public class ReactRootView extends SizeMonitoringFrameLayout implements RootView
"the onDestroyView() of your hosting Fragment.");
}
@Override
public int getRootViewTag() {
return mRootViewTag;
}
public void setRootViewTag(int rootViewTag) {
mRootViewTag = rootViewTag;
}
private class CustomGlobalLayoutListener implements ViewTreeObserver.OnGlobalLayoutListener {
private final Rect mVisibleViewArea;
private final int mMinKeyboardHeightDetected;

View File

@@ -1,9 +0,0 @@
// Copyright 2004-present Facebook. All Rights Reserved.
package com.facebook.react.uimanager;
/** Interface for the a ReactRootView with a tag. */
public interface TaggedRootView {
int getRootViewTag();
}

View File

@@ -183,7 +183,7 @@ public class UIManagerModule extends ReactContextBaseJavaModule implements
Systrace.beginSection(
Systrace.TRACE_TAG_REACT_JAVA_BRIDGE,
"UIManagerModule.addRootView");
final int tag = ((TaggedRootView) rootView).getRootViewTag();
final int tag = ReactRootViewTagGenerator.getNextRootViewTag();
final int width;
final int height;