Skip to content

Commit c493cfe

Browse files
dulmandakhfacebook-github-bot
authored andcommitted
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
1 parent 05ebf77 commit c493cfe

File tree

3 files changed

+7
-35
lines changed

3 files changed

+7
-35
lines changed

ReactAndroid/src/main/java/com/facebook/react/views/common/ViewHelper.java

Lines changed: 0 additions & 31 deletions
This file was deleted.

ReactAndroid/src/main/java/com/facebook/react/views/view/BUCK

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@ rn_android_library(
66
visibility = [
77
"PUBLIC",
88
],
9+
provided_deps = [
10+
react_native_dep("third-party/android/support/v4:lib-support-v4"),
11+
],
912
deps = [
1013
YOGA_TARGET,
1114
react_native_dep("libraries/fbcore/src/main/java/com/facebook/common/logging:logging"),

ReactAndroid/src/main/java/com/facebook/react/views/view/ReactViewBackgroundManager.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@
88
import android.graphics.Color;
99
import android.graphics.drawable.Drawable;
1010
import android.graphics.drawable.LayerDrawable;
11+
import android.support.v4.view.ViewCompat;
1112
import android.view.View;
12-
import com.facebook.react.views.common.ViewHelper;
1313
import javax.annotation.Nullable;
1414

1515
/** Class that manages the background for views and borders. */
@@ -26,15 +26,15 @@ private ReactViewBackgroundDrawable getOrCreateReactViewBackground() {
2626
if (mReactBackgroundDrawable == null) {
2727
mReactBackgroundDrawable = new ReactViewBackgroundDrawable(mView.getContext());
2828
Drawable backgroundDrawable = mView.getBackground();
29-
ViewHelper.setBackground(
29+
ViewCompat.setBackground(
3030
mView, null); // required so that drawable callback is cleared before we add the
3131
// drawable back as a part of LayerDrawable
3232
if (backgroundDrawable == null) {
33-
ViewHelper.setBackground(mView, mReactBackgroundDrawable);
33+
ViewCompat.setBackground(mView, mReactBackgroundDrawable);
3434
} else {
3535
LayerDrawable layerDrawable =
3636
new LayerDrawable(new Drawable[] {mReactBackgroundDrawable, backgroundDrawable});
37-
ViewHelper.setBackground(mView, layerDrawable);
37+
ViewCompat.setBackground(mView, layerDrawable);
3838
}
3939
}
4040
return mReactBackgroundDrawable;

0 commit comments

Comments
 (0)