Fix buggy behavior of setBackgroundColor in react View.

Differential Revision: D2582549

fb-gh-sync-id: 8856eb27d46df37e201cd1169fcec3b5b68dac97
This commit is contained in:
Krzysztof Magiera 2015-10-26 14:21:12 -07:00 коммит произвёл facebook-github-bot-3
Родитель 05c9a1f91a
Коммит 3a92f2017f
1 изменённых файлов: 2 добавлений и 12 удалений

Просмотреть файл

@ -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);
}