Permalink
Browse files

API check for removeOnGlobalLayoutListener in ReactRootView

Reviewed By: AaaChiuuu

Differential Revision: D5308604

fbshipit-source-id: adf4abbdd59e54c18fcae946f2f7e3af89e7190c
  • Loading branch information...
ayc1 authored and facebook-github-bot committed Jun 23, 2017
1 parent a660796 commit ecccd066620a00e6172ec09eb3b5b771dc979c5f
Showing with 6 additions and 1 deletion.
  1. +6 −1 ReactAndroid/src/main/java/com/facebook/react/ReactRootView.java
@@ -13,6 +13,7 @@
import android.content.Context;
import android.graphics.Rect;
import android.os.Build;
import android.os.Bundle;
import android.util.AttributeSet;
import android.view.MotionEvent;
@@ -180,7 +181,11 @@ protected void onAttachedToWindow() {
protected void onDetachedFromWindow() {
super.onDetachedFromWindow();
if (mIsAttachedToInstance) {
getViewTreeObserver().removeOnGlobalLayoutListener(getCustomGlobalLayoutListener());
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
getViewTreeObserver().removeOnGlobalLayoutListener(getCustomGlobalLayoutListener());
} else {
getViewTreeObserver().removeGlobalOnLayoutListener(getCustomGlobalLayoutListener());
}
}
}

0 comments on commit ecccd06

Please sign in to comment.