-
Notifications
You must be signed in to change notification settings - Fork 24.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix interactions between removeClippedSubviews and RTL by applying Ho…
…rizontalScrollContentView translation during layout metric assignment (#46685) Summary: Pull Request resolved: #46685 This attempts a similar fix to D59566611, but keeps the removedClippedSubviews logic as is, instead moving the current translation done in ReactHorizontalScrollContainerView onLayout to ShadowNode layout metric assignment (so the world is consistent from very early on, and `removeClippedSubviews` never sees coordinates before translation), I suspect doing this at the ShadowNode layer might also result in some fixes to DevTools in RTL. This should let us roll out setAndroidLayoutDirection again. Changelog: [Android][Fixed] - Fix interactions between removeClippedSubviews and RTL Reviewed By: mdvacca Differential Revision: D63318754 fbshipit-source-id: 828e103e2ad21c7e886e39c163474b10ebd5099e
- Loading branch information
1 parent
a396f6c
commit 513e966
Showing
8 changed files
with
76 additions
and
88 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
68 changes: 0 additions & 68 deletions
68
...oid/src/main/java/com/facebook/react/views/scroll/ReactHorizontalScrollContainerView.java
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 18 additions & 0 deletions
18
...ct/renderer/components/scrollview/AndroidHorizontalScrollContentViewComponentDescriptor.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
/* | ||
* Copyright (c) Meta Platforms, Inc. and affiliates. | ||
* | ||
* This source code is licensed under the MIT license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
*/ | ||
|
||
#pragma once | ||
|
||
#include <react/renderer/components/scrollview/AndroidHorizontalScrollContentViewShadowNode.h> | ||
#include <react/renderer/core/ConcreteComponentDescriptor.h> | ||
|
||
namespace facebook::react { | ||
|
||
using AndroidHorizontalScrollContentViewComponentDescriptor = | ||
ConcreteComponentDescriptor<AndroidHorizontalScrollContentViewShadowNode>; | ||
|
||
} // namespace facebook::react |
26 changes: 26 additions & 0 deletions
26
...mon/react/renderer/components/scrollview/AndroidHorizontalScrollContentViewShadowNode.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
/* | ||
* Copyright (c) Meta Platforms, Inc. and affiliates. | ||
* | ||
* This source code is licensed under the MIT license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
*/ | ||
|
||
#include <react/renderer/components/scrollview/AndroidHorizontalScrollContentViewShadowNode.h> | ||
|
||
namespace facebook::react { | ||
|
||
const char AndroidHorizontalScrollContentViewShadowNodeComponentName[] = | ||
"AndroidHorizontalScrollContentView"; | ||
|
||
void AndroidHorizontalScrollContentViewShadowNode::layout( | ||
LayoutContext layoutContext) { | ||
ConcreteViewShadowNode::layout(layoutContext); | ||
|
||
// When the layout direction is RTL, we expect Yoga to give us a layout | ||
// that extends off the screen to the left so we re-center it with left=0 | ||
if (layoutMetrics_.layoutDirection == LayoutDirection::RightToLeft) { | ||
layoutMetrics_.frame.origin.x = 0; | ||
} | ||
} | ||
|
||
} // namespace facebook::react |
26 changes: 26 additions & 0 deletions
26
...ommon/react/renderer/components/scrollview/AndroidHorizontalScrollContentViewShadowNode.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
/* | ||
* Copyright (c) Meta Platforms, Inc. and affiliates. | ||
* | ||
* This source code is licensed under the MIT license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
*/ | ||
|
||
#pragma once | ||
|
||
#include <react/renderer/components/view/ConcreteViewShadowNode.h> | ||
#include <react/renderer/core/LayoutContext.h> | ||
|
||
namespace facebook::react { | ||
|
||
extern const char AndroidHorizontalScrollContentViewShadowNodeComponentName[]; | ||
|
||
class AndroidHorizontalScrollContentViewShadowNode final | ||
: public ConcreteViewShadowNode< | ||
AndroidHorizontalScrollContentViewShadowNodeComponentName, | ||
ViewProps> { | ||
public: | ||
using ConcreteViewShadowNode::ConcreteViewShadowNode; | ||
void layout(LayoutContext layoutContext) override; | ||
}; | ||
|
||
} // namespace facebook::react |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters