From 7b77cc637e1faf4a2b134853f8415f277d0decdc Mon Sep 17 00:00:00 2001 From: Xin Chen Date: Thu, 21 Oct 2021 13:24:21 -0700 Subject: [PATCH] Change Vertical ScrollView to take Context instead of ReactContext Summary: The `ReactScrollView.java` constructor is using `ReactContext` instead of `Context`, which is inconsistent to the horizontal scroll view. This is the result from D3863966 (https://github.com/facebook/react-native/commit/2cf2fdbc04bc5309f6942ed464ad61cd06a26ce8) when an OSS issue needs to be addressed. That issue and all call sites to use the `ReactContext` are deprecated now. Revert this back to use `Context` to be less restrictive. Changelog: [Android][Fixed] - Revert `ReactScrollView` to use `Context` instead of `ReactContext` in the constructor to be less restrictive. Reviewed By: javache Differential Revision: D31819799 fbshipit-source-id: 3f00d64850aebd2e20615033b2e1f1c721fed37e --- .../com/facebook/react/views/scroll/ReactScrollView.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ReactAndroid/src/main/java/com/facebook/react/views/scroll/ReactScrollView.java b/ReactAndroid/src/main/java/com/facebook/react/views/scroll/ReactScrollView.java index 54643e6e2da..3b2265aa186 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/views/scroll/ReactScrollView.java +++ b/ReactAndroid/src/main/java/com/facebook/react/views/scroll/ReactScrollView.java @@ -17,6 +17,7 @@ import android.animation.Animator; import android.animation.ObjectAnimator; import android.animation.PropertyValuesHolder; import android.animation.ValueAnimator; +import android.content.Context; import android.graphics.Canvas; import android.graphics.Color; import android.graphics.Rect; @@ -34,7 +35,6 @@ import androidx.core.view.ViewCompat; import com.facebook.common.logging.FLog; import com.facebook.infer.annotation.Assertions; import com.facebook.react.R; -import com.facebook.react.bridge.ReactContext; import com.facebook.react.bridge.WritableMap; import com.facebook.react.bridge.WritableNativeMap; import com.facebook.react.common.ReactConstants; @@ -114,11 +114,11 @@ public class ReactScrollView extends ScrollView private int mLastStateUpdateScrollX = -1; private int mLastStateUpdateScrollY = -1; - public ReactScrollView(ReactContext context) { + public ReactScrollView(Context context) { this(context, null); } - public ReactScrollView(ReactContext context, @Nullable FpsListener fpsListener) { + public ReactScrollView(Context context, @Nullable FpsListener fpsListener) { super(context); mFpsListener = fpsListener; mReactBackgroundManager = new ReactViewBackgroundManager(this);