Skip to content

Commit e314f61

Browse files
Nick Lefeverfacebook-github-bot
authored andcommitted
Fix scrollview overflow prop not set with Props 2.0 (#53871)
Summary: Pull Request resolved: #53871 The props defined in `YogaStylableProps` define the overflow to be set to `Overflow::Visible` by default. The scroll view initialized the overflow setting to `Overflow.SCROLL`. This meant that Props 2.0 would only set the overflow prop if it was different from Visible, leading to the scroll view not being configured correctly when asking for the overflow to be visible. This diff assigns the correct initial value to the scrollview overflow setting only when enabling Props 2.0 to avoid any unexpected behavior changes when not using Props 2.0. Changelog: [Internal] Reviewed By: rshest Differential Revision: D82919286 fbshipit-source-id: d5368500cc4504164d6fdf7cf60042a9d5792853
1 parent ce243df commit e314f61

1 file changed

Lines changed: 13 additions & 2 deletions

File tree

  • packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/scroll

packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/scroll/ReactScrollView.java

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,13 @@ private void initView() {
159159
mVirtualViewContainerState = null;
160160
mActivelyScrolling = false;
161161
mClippingRect = null;
162-
mOverflow = Overflow.SCROLL;
162+
163+
// The default value for `overflow` is set to `Visible` in the Yoga style props.
164+
mOverflow =
165+
ReactNativeFeatureFlags.enablePropsUpdateReconciliationAndroid()
166+
? Overflow.VISIBLE
167+
: Overflow.SCROLL;
168+
163169
mDragging = false;
164170
mPagingEnabled = false;
165171
mPostTouchRunnable = null;
@@ -362,7 +368,12 @@ public void setOverflow(@Nullable String overflow) {
362368
mOverflow = Overflow.SCROLL;
363369
} else {
364370
@Nullable Overflow parsedOverflow = Overflow.fromString(overflow);
365-
mOverflow = parsedOverflow == null ? Overflow.SCROLL : parsedOverflow;
371+
mOverflow =
372+
parsedOverflow == null
373+
? (ReactNativeFeatureFlags.enablePropsUpdateReconciliationAndroid()
374+
? Overflow.VISIBLE
375+
: Overflow.SCROLL)
376+
: parsedOverflow;
366377
}
367378

368379
invalidate();

0 commit comments

Comments
 (0)