Skip to content

Commit

Permalink
Fix ReactHorizontalScrollView overflow issue
Browse files Browse the repository at this point in the history
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
  • Loading branch information
Jiaqi Wu authored and facebook-github-bot committed Jul 20, 2018
1 parent 86f24cc commit d5465a9
Showing 1 changed file with 8 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -102,6 +103,13 @@ public void flashScrollIndicators() {
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);
Expand Down

0 comments on commit d5465a9

Please sign in to comment.