Skip to content

Commit

Permalink
fix content appeared logging
Browse files Browse the repository at this point in the history
Reviewed By: AaaChiuuu

Differential Revision: D5630723

fbshipit-source-id: 3791537afdb7ca4992c2562577466c2ef5baafce
  • Loading branch information
bnham authored and facebook-github-bot committed Aug 15, 2017
1 parent e16dd51 commit 091878a
Showing 1 changed file with 9 additions and 12 deletions.
21 changes: 9 additions & 12 deletions ReactAndroid/src/main/java/com/facebook/react/ReactRootView.java
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ public interface ReactRootViewEventListener {
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) {
Expand Down Expand Up @@ -195,18 +195,13 @@ protected void onDetachedFromWindow() {
public void onViewAdded(View child) {
super.onViewAdded(child);

if (!mContentAppeared) {
mContentAppeared = true;
ReactMarker.logMarker(
ReactMarkerConstants.CONTENT_APPEARED, getJSModuleName(), getRootViewTag());
}
}

@Override
public void removeAllViewsInLayout() {
super.removeAllViewsInLayout();
if (mShouldLogContentAppeared) {
mShouldLogContentAppeared = false;

mContentAppeared = false;
if (mJSModuleName != null) {
ReactMarker.logMarker(ReactMarkerConstants.CONTENT_APPEARED, mJSModuleName, mRootViewTag);
}
}
}

/**
Expand Down Expand Up @@ -240,6 +235,7 @@ public void startReactApplication(
mReactInstanceManager = reactInstanceManager;
mJSModuleName = moduleName;
mAppProperties = initialProperties;
mShouldLogContentAppeared = true;

if (!mReactInstanceManager.hasStartedCreatingInitialContext()) {
mReactInstanceManager.createReactContextInBackground();
Expand All @@ -263,6 +259,7 @@ public void unmountReactApplication() {
mIsAttachedToInstance = false;
mRootViewTag = ReactRootViewTagGenerator.getNextRootViewTag();
}
mShouldLogContentAppeared = true;
}

public void onAttachedToReactInstance() {
Expand Down

0 comments on commit 091878a

Please sign in to comment.