Skip to content

Commit

Permalink
remove ViewHelper, use ViewCompat instead (#23280)
Browse files Browse the repository at this point in the history
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 c493cfe
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 35 deletions.

This file was deleted.

3 changes: 3 additions & 0 deletions ReactAndroid/src/main/java/com/facebook/react/views/view/BUCK
Original file line number Diff line number Diff line change
Expand Up @@ -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"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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. */
Expand All @@ -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;
Expand Down

0 comments on commit c493cfe

Please sign in to comment.