Skip to content

Commit d5465a9

Browse files
Jiaqi Wufacebook-github-bot
Jiaqi Wu
authored andcommitted
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
1 parent 86f24cc commit d5465a9

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

ReactAndroid/src/main/java/com/facebook/react/views/scroll/ReactHorizontalScrollView.java

+8
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ public class ReactHorizontalScrollView extends HorizontalScrollView implements
3838

3939
private final OnScrollDispatchHelper mOnScrollDispatchHelper = new OnScrollDispatchHelper();
4040
private final VelocityHelper mVelocityHelper = new VelocityHelper();
41+
private final Rect mRect = new Rect();
4142

4243
private boolean mActivelyScrolling;
4344
private @Nullable Rect mClippingRect;
@@ -102,6 +103,13 @@ public void flashScrollIndicators() {
102103
awakenScrollBars();
103104
}
104105

106+
@Override
107+
protected void onDraw(Canvas canvas) {
108+
getDrawingRect(mRect);
109+
canvas.clipRect(mRect);
110+
super.onDraw(canvas);
111+
}
112+
105113
@Override
106114
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
107115
MeasureSpecAssertions.assertExplicitMeasureSpec(widthMeasureSpec, heightMeasureSpec);

0 commit comments

Comments
 (0)