fix content appeared logging

Reviewed By: AaaChiuuu

Differential Revision: D5630723

fbshipit-source-id: 3791537afdb7ca4992c2562577466c2ef5baafce
This commit is contained in:
Ben Nham 2017-08-15 10:45:23 -07:00 committed by Facebook Github Bot
parent e16dd51a0e
commit 091878a61a
1 changed files with 9 additions and 12 deletions

View File

@ -81,7 +81,7 @@ public class ReactRootView extends SizeMonitoringFrameLayout implements RootView
private @Nullable ReactRootViewEventListener mRootViewEventListener;
private int mRootViewTag = ReactRootViewTagGenerator.getNextRootViewTag();
private boolean mIsAttachedToInstance;
private boolean mContentAppeared;
private boolean mShouldLogContentAppeared;
private final JSTouchDispatcher mJSTouchDispatcher = new JSTouchDispatcher(this);
public ReactRootView(Context context) {
@ -195,20 +195,15 @@ public class ReactRootView extends SizeMonitoringFrameLayout implements RootView
public void onViewAdded(View child) {
super.onViewAdded(child);
if (!mContentAppeared) {
mContentAppeared = true;
ReactMarker.logMarker(
ReactMarkerConstants.CONTENT_APPEARED, getJSModuleName(), getRootViewTag());
if (mShouldLogContentAppeared) {
mShouldLogContentAppeared = false;
if (mJSModuleName != null) {
ReactMarker.logMarker(ReactMarkerConstants.CONTENT_APPEARED, mJSModuleName, mRootViewTag);
}
}
}
@Override
public void removeAllViewsInLayout() {
super.removeAllViewsInLayout();
mContentAppeared = false;
}
/**
* {@see #startReactApplication(ReactInstanceManager, String, android.os.Bundle)}
*/
@ -240,6 +235,7 @@ public class ReactRootView extends SizeMonitoringFrameLayout implements RootView
mReactInstanceManager = reactInstanceManager;
mJSModuleName = moduleName;
mAppProperties = initialProperties;
mShouldLogContentAppeared = true;
if (!mReactInstanceManager.hasStartedCreatingInitialContext()) {
mReactInstanceManager.createReactContextInBackground();
@ -263,6 +259,7 @@ public class ReactRootView extends SizeMonitoringFrameLayout implements RootView
mIsAttachedToInstance = false;
mRootViewTag = ReactRootViewTagGenerator.getNextRootViewTag();
}
mShouldLogContentAppeared = true;
}
public void onAttachedToReactInstance() {