Cleanup ReactScrollView

Summary:
Cleanup some code and lints in ReactScrollView

bypass-github-export-checks

changelog: [internal] internal

Reviewed By: cortinico

Differential Revision: D53485242

fbshipit-source-id: ec8d0c4b42d88786c14897e4ff4b44c2cc084d87
This commit is contained in:
David Vacca
2024-02-10 10:33:16 -08:00
committed by Facebook GitHub Bot
parent 68e6a94538
commit d0dd0e2852
2 changed files with 13 additions and 14 deletions
@@ -6425,7 +6425,6 @@ public class com/facebook/react/views/scroll/ReactScrollView : android/widget/Sc
public fun getScrollEventThrottle ()I
public fun getStateWrapper ()Lcom/facebook/react/uimanager/StateWrapper;
protected fun handleInterceptedTouchEvent (Landroid/view/MotionEvent;)V
public fun isPartiallyScrolledInView (Landroid/view/View;)Z
protected fun onAttachedToWindow ()V
public fun onChildViewAdded (Landroid/view/View;Landroid/view/View;)V
public fun onChildViewRemoved (Landroid/view/View;Landroid/view/View;)V
@@ -28,6 +28,7 @@ import android.view.ViewGroup;
import android.view.accessibility.AccessibilityNodeInfo;
import android.widget.OverScroller;
import android.widget.ScrollView;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.core.view.ViewCompat;
import com.facebook.common.logging.FLog;
@@ -356,7 +357,7 @@ public class ReactScrollView extends ScrollView
}
/** Returns whether the given descendent is partially scrolled in view */
public boolean isPartiallyScrolledInView(View descendent) {
boolean isPartiallyScrolledInView(View descendent) {
int scrollDelta = getScrollDelta(descendent);
descendent.getDrawingRect(mTempRect);
return scrollDelta != 0 && Math.abs(scrollDelta) < mTempRect.width();
@@ -505,7 +506,7 @@ public class ReactScrollView extends ScrollView
Assertions.assertNotNull(mClippingRect);
ReactClippingViewGroupHelper.calculateClippingRect(this, mClippingRect);
View contentView = getChildAt(0);
View contentView = getContentView();
if (contentView instanceof ReactClippingViewGroup) {
((ReactClippingViewGroup) contentView).updateClippingRect();
}
@@ -619,20 +620,16 @@ public class ReactScrollView extends ScrollView
@Override
public void draw(Canvas canvas) {
if (mEndFillColor != Color.TRANSPARENT) {
final View content = getChildAt(0);
if (mEndBackground != null && content != null && content.getBottom() < getHeight()) {
mEndBackground.setBounds(0, content.getBottom(), getWidth(), getHeight());
final View contentView = getContentView();
if (mEndBackground != null && contentView != null && contentView.getBottom() < getHeight()) {
mEndBackground.setBounds(0, contentView.getBottom(), getWidth(), getHeight());
mEndBackground.draw(canvas);
}
}
getDrawingRect(mRect);
switch (mOverflow) {
case ViewProps.VISIBLE:
break;
default:
canvas.clipRect(mRect);
break;
if (!ViewProps.VISIBLE.equals(mOverflow)) {
canvas.clipRect(mRect);
}
super.draw(canvas);
@@ -1043,8 +1040,10 @@ public class ReactScrollView extends ScrollView
@Override
public void onChildViewRemoved(View parent, View child) {
mContentView.removeOnLayoutChangeListener(this);
mContentView = null;
if (mContentView != null) {
mContentView.removeOnLayoutChangeListener(this);
mContentView = null;
}
}
public void setContentOffset(ReadableMap value) {
@@ -1236,6 +1235,7 @@ public class ReactScrollView extends ScrollView
DEFAULT_FLING_ANIMATOR.start();
}
@NonNull
@Override
public ValueAnimator getFlingAnimator() {
return DEFAULT_FLING_ANIMATOR;