Skip to content

Commit af226ef

Browse files
sherginfacebook-github-bot
authored andcommitted
Designated methods to control dirty propagation
Summary: Those are supposed to replace all `dirtyText`, `dirtyPropagation`, `isPropagationDirty`, `setTextComputed`, `isTextDirty` and so on. We will use it widely soon (and remove all old ones). Reviewed By: mmmulani Differential Revision: D6665634 fbshipit-source-id: 3c1db7154e90b71446756f2495627b163c779996
1 parent f71f4e7 commit af226ef

File tree

2 files changed

+33
-0
lines changed

2 files changed

+33
-0
lines changed

React/Views/RCTShadowView+Layout.h

+19
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,28 @@
1313

1414
@interface RCTShadowView (Layout)
1515

16+
#pragma mark - Computed Layout-Inferred Metrics
17+
1618
@property (nonatomic, readonly) UIEdgeInsets paddingAsInsets;
1719
@property (nonatomic, readonly) UIEdgeInsets borderAsInsets;
1820
@property (nonatomic, readonly) UIEdgeInsets compoundInsets;
1921
@property (nonatomic, readonly) CGSize availableSize;
2022

23+
#pragma mark - Dirty Propagation Control
24+
25+
/**
26+
* Designated method to control dirty propagation mechanism.
27+
* Dirties the shadow view (and all affected shadow views, usually a superview)
28+
* in terms of layout.
29+
* The default implementaion does nothing.
30+
*/
31+
- (void)dirtyLayout;
32+
33+
/**
34+
* Designated method to control dirty propagation mechanism.
35+
* Clears (makes not dirty) the shadow view.
36+
* The default implementaion does nothing.
37+
*/
38+
- (void)clearLayout;
39+
2140
@end

React/Views/RCTShadowView+Layout.m

+14
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@
1313

1414
@implementation RCTShadowView (Layout)
1515

16+
#pragma mark - Computed Layout-Inferred Metrics
17+
1618
- (UIEdgeInsets)paddingAsInsets
1719
{
1820
YGNodeRef yogaNode = self.yogaNode;
@@ -53,4 +55,16 @@ - (CGSize)availableSize
5355
return UIEdgeInsetsInsetRect((CGRect){CGPointZero, self.frame.size}, self.compoundInsets).size;
5456
}
5557

58+
#pragma mark - Dirty Propagation Control
59+
60+
- (void)dirtyLayout
61+
{
62+
// The default implementaion does nothing.
63+
}
64+
65+
- (void)clearLayout
66+
{
67+
// The default implementaion does nothing.
68+
}
69+
5670
@end

0 commit comments

Comments
 (0)