Fix ReactHorizontalScrollView overflow issue

Summary: Fix ReactHorizontalScrollView so that its children won't overflow. (Task: https://our.intern.facebook.com/intern/tasks/?t=31128239)

Reviewed By: achen1

Differential Revision: D8923947

fbshipit-source-id: 56c36b25c29a87a306d92544273603d0d086edc0
This commit is contained in:
Jiaqi Wu 2018-07-19 17:15:32 -07:00 committed by Facebook Github Bot
parent 86f24ccf71
commit d5465a9a0a
1 changed files with 8 additions and 0 deletions

View File

@ -38,6 +38,7 @@ public class ReactHorizontalScrollView extends HorizontalScrollView implements
private final OnScrollDispatchHelper mOnScrollDispatchHelper = new OnScrollDispatchHelper();
private final VelocityHelper mVelocityHelper = new VelocityHelper();
private final Rect mRect = new Rect();
private boolean mActivelyScrolling;
private @Nullable Rect mClippingRect;
@ -102,6 +103,13 @@ public class ReactHorizontalScrollView extends HorizontalScrollView implements
awakenScrollBars();
}
@Override
protected void onDraw(Canvas canvas) {
getDrawingRect(mRect);
canvas.clipRect(mRect);
super.onDraw(canvas);
}
@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
MeasureSpecAssertions.assertExplicitMeasureSpec(widthMeasureSpec, heightMeasureSpec);