Back out "Back out "[RN][Fabric] Introducing LayoutableShadownode::getContentOriginOffset and use it in ScrollView""

Summary:
This diff reverts a revert of D22456266 (https://github.com/facebook/react-native/commit/0060b5de559cd9c785a2a2a6c66f58088fea4dd2) and fixes the reason why it was reverted. Reverted in D22532594 (https://github.com/facebook/react-native/commit/c0e7e1bd9cf050b4a77a20212603d3468826979c).

For reason why it was introduced in the first place, please refer to D22456266 (https://github.com/facebook/react-native/commit/0060b5de559cd9c785a2a2a6c66f58088fea4dd2).

Problem:
`includeTransform` was not taken into account when calculating offset.

I added a unit test covering this specific scenario.

Reviewed By: shergin

Differential Revision: D22763011

fbshipit-source-id: e7d88fc19608ad1a4c7b5e594a9cc48122a2799b
This commit is contained in:
Samuel Susla authored and Facebook GitHub Bot committed 2020-07-27 13:23:53 -07:00
1 parent b08fff6f86
commit cd6e2b468d
7 files changed
+94 -23

No files matched your search

@@ -37,11 +37,9 @@ void ScrollViewShadowNode::layout(LayoutContext layoutContext) {
updateStateIfNeeded();
}
Transform ScrollViewShadowNode::getTransform() const {
auto transform = ConcreteViewShadowNode::getTransform();
Point ScrollViewShadowNode::getContentOriginOffset() const {
auto contentOffset = getStateData().contentOffset;
return transform *
Transform::Translate(-contentOffset.x, -contentOffset.y, 0);
return {-contentOffset.x, -contentOffset.y};
}
} // namespace react