Support ScrollAway in ReactScrollView

Summary:
Support ScrollAway in ReactScrollView for Fabric/non-Fabric.

Changelog: [Android][Added] Support for ScrollAway native nav bars added to ReactScrollView

Reviewed By: mdvacca

Differential Revision: D28308855

fbshipit-source-id: 9a922159ef50fb7c8e9c484a4b97ca57ab248496
This commit is contained in:
Joshua Gross
2021-05-10 12:16:10 -07:00
committed by Facebook GitHub Bot
parent d87542ee4c
commit 0ef5beee85
6 changed files with 84 additions and 18 deletions
@@ -34,7 +34,7 @@ void ScrollViewShadowNode::updateStateIfNeeded() {
void ScrollViewShadowNode::updateScrollContentOffsetIfNeeded() {
#ifndef ANDROID
if (getLayoutMetrics().layoutDirection == LayoutDirection::RightToLeft) {
// Yoga place `contentView` on the right side of `scrollView` when RTL
// Yoga places `contentView` on the right side of `scrollView` when RTL
// layout is enforced. To correct for this, in RTL setting, correct the
// frame's origin. React Native Classic does this as well in
// `RCTScrollContentShadowView.m`.
@@ -58,8 +58,9 @@ void ScrollViewShadowNode::layout(LayoutContext layoutContext) {
}
Point ScrollViewShadowNode::getContentOriginOffset() const {
auto contentOffset = getStateData().contentOffset;
return {-contentOffset.x, -contentOffset.y};
auto stateData = getStateData();
auto contentOffset = stateData.contentOffset;
return {-contentOffset.x, -contentOffset.y + stateData.scrollAwayPaddingTop};
}
} // namespace react