1 |
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 |
|
8 | #import "RCTScrollContentShadowView.h"
|
9 |
|
10 | #import <yoga/Yoga.h>
|
11 |
|
12 | #import "RCTUtils.h"
|
13 |
|
14 | @implementation RCTScrollContentShadowView
|
15 |
|
16 | - (void)layoutWithMetrics:(RCTLayoutMetrics)layoutMetrics
|
17 | layoutContext:(RCTLayoutContext)layoutContext
|
18 | {
|
19 | if (layoutMetrics.layoutDirection == UIUserInterfaceLayoutDirectionRightToLeft) {
|
20 | // Motivation:
|
21 | // Yoga place `contentView` on the right side of `scrollView` when RTL layout is enforced.
|
22 | // That breaks everything; it is completely pointless to (re)position `contentView`
|
23 | // because it is `contentView`'s job. So, we work around it here.
|
24 |
|
25 | layoutContext.absolutePosition.x += layoutMetrics.frame.size.width;
|
26 | layoutMetrics.frame.origin.x = 0;
|
27 | }
|
28 |
|
29 | [super layoutWithMetrics:layoutMetrics layoutContext:layoutContext];
|
30 | }
|
31 |
|
32 | @end
|