mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
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:
committed by
Facebook GitHub Bot
parent
68e6a94538
commit
d0dd0e2852
@@ -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
|
||||
|
||||
+13
-13
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user