Add support for ViewProps.NEEDS_OFFSCREEN_ALPHA_COMPOSITING to RCTView

Summary: Copied from ReactViewManager. Should provide performance improvements.

Reviewed By: ahmedre

Differential Revision: D2772832
This commit is contained in:
Denis Koroskin 2015-12-20 19:36:23 -08:00 committed by Ahmed El-Helw
parent 99d1c15c4d
commit 79be10428b
2 changed files with 24 additions and 0 deletions

View File

@ -57,6 +57,7 @@ import com.facebook.react.uimanager.ReactCompoundView;
private int mDrawChildIndex = 0;
private boolean mIsAttached = false;
private boolean mIsLayoutRequested = false;
private boolean mNeedsOffscreenAlphaCompositing = false;
private Drawable mHotspot;
/* package */ FlatViewGroup(Context context) {
@ -179,6 +180,22 @@ import com.facebook.react.uimanager.ReactCompoundView;
}
}
/**
* We override this to allow developers to determine whether they need offscreen alpha compositing
* or not. See the documentation of needsOffscreenAlphaCompositing in View.js.
*/
@Override
public boolean hasOverlappingRendering() {
return mNeedsOffscreenAlphaCompositing;
}
/**
* See the documentation of needsOffscreenAlphaCompositing in View.js.
*/
/* package */ void setNeedsOffscreenAlphaCompositing(boolean needsOffscreenAlphaCompositing) {
mNeedsOffscreenAlphaCompositing = needsOffscreenAlphaCompositing;
}
/* package */ void setHotspot(Drawable hotspot) {
if (mHotspot != null) {
mHotspot.setCallback(null);

View File

@ -90,4 +90,11 @@ import com.facebook.react.views.view.ReactDrawableHelper;
}
}
}
@ReactProp(name = ViewProps.NEEDS_OFFSCREEN_ALPHA_COMPOSITING)
public void setNeedsOffscreenAlphaCompositing(
FlatViewGroup view,
boolean needsOffscreenAlphaCompositing) {
view.setNeedsOffscreenAlphaCompositing(needsOffscreenAlphaCompositing);
}
}