Skip to content
Permalink
Browse files

remove ViewHelper, use ViewCompat instead (#23280)

Summary:
ViewHelper has only setBackground method which works identical to ViewCompat.setBackground from Android Support Library. This PR removes ViewHelper, and uses ViewCompat instead.

[Android] [Changed] - remove ViewHelper, use ViewCompat instead
Pull Request resolved: #23280

Differential Revision: D13950510

Pulled By: mdvacca

fbshipit-source-id: 10b5122affac17d4b66fb995339c6715c0871ed0
  • Loading branch information...
dulmandakh authored and facebook-github-bot committed Feb 5, 2019
1 parent 05ebf77 commit c493cfe7083a6b97b6ec9eb9cb59cf1fdec45458

This file was deleted.

Oops, something went wrong.
@@ -6,6 +6,9 @@ rn_android_library(
visibility = [
"PUBLIC",
],
provided_deps = [
react_native_dep("third-party/android/support/v4:lib-support-v4"),
],
deps = [
YOGA_TARGET,
react_native_dep("libraries/fbcore/src/main/java/com/facebook/common/logging:logging"),
@@ -8,8 +8,8 @@
import android.graphics.Color;
import android.graphics.drawable.Drawable;
import android.graphics.drawable.LayerDrawable;
import android.support.v4.view.ViewCompat;
import android.view.View;
import com.facebook.react.views.common.ViewHelper;
import javax.annotation.Nullable;

/** Class that manages the background for views and borders. */
@@ -26,15 +26,15 @@ private ReactViewBackgroundDrawable getOrCreateReactViewBackground() {
if (mReactBackgroundDrawable == null) {
mReactBackgroundDrawable = new ReactViewBackgroundDrawable(mView.getContext());
Drawable backgroundDrawable = mView.getBackground();
ViewHelper.setBackground(
ViewCompat.setBackground(
mView, null); // required so that drawable callback is cleared before we add the
// drawable back as a part of LayerDrawable
if (backgroundDrawable == null) {
ViewHelper.setBackground(mView, mReactBackgroundDrawable);
ViewCompat.setBackground(mView, mReactBackgroundDrawable);
} else {
LayerDrawable layerDrawable =
new LayerDrawable(new Drawable[] {mReactBackgroundDrawable, backgroundDrawable});
ViewHelper.setBackground(mView, layerDrawable);
ViewCompat.setBackground(mView, layerDrawable);
}
}
return mReactBackgroundDrawable;

0 comments on commit c493cfe

Please sign in to comment.
You can’t perform that action at this time.