Fix buggy behavior of setBackgroundColor in react View.
Differential Revision: D2582549 fb-gh-sync-id: 8856eb27d46df37e201cd1169fcec3b5b68dac97
This commit is contained in:
parent
05c9a1f91a
commit
3a92f2017f
|
@ -118,18 +118,8 @@ public class ReactViewGroup extends ViewGroup implements
|
|||
|
||||
@Override
|
||||
public void setBackgroundColor(int color) {
|
||||
if (color == Color.TRANSPARENT) {
|
||||
Drawable backgroundDrawble = getBackground();
|
||||
if (mReactBackgroundDrawable != null && (backgroundDrawble instanceof LayerDrawable)) {
|
||||
// extract translucent background portion from layerdrawable
|
||||
super.setBackground(null);
|
||||
LayerDrawable layerDrawable = (LayerDrawable) backgroundDrawble;
|
||||
super.setBackground(layerDrawable.getDrawable(1));
|
||||
} else if (backgroundDrawble instanceof ReactViewBackgroundDrawable) {
|
||||
// mReactBackground is set for background
|
||||
mReactBackgroundDrawable = null;
|
||||
super.setBackground(null);
|
||||
}
|
||||
if (color == Color.TRANSPARENT && mReactBackgroundDrawable == null) {
|
||||
// don't do anything, no need to allocate ReactBackgroundDrawable for transparent background
|
||||
} else {
|
||||
getOrCreateReactViewBackground().setColor(color);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue