Skip to content

Commit

Permalink
Designated methods to control dirty propagation
Browse files Browse the repository at this point in the history
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
  • Loading branch information
shergin authored and facebook-github-bot committed Jan 8, 2018
1 parent f71f4e7 commit af226ef
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 0 deletions.
19 changes: 19 additions & 0 deletions React/Views/RCTShadowView+Layout.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,28 @@

@interface RCTShadowView (Layout)

#pragma mark - Computed Layout-Inferred Metrics

@property (nonatomic, readonly) UIEdgeInsets paddingAsInsets;
@property (nonatomic, readonly) UIEdgeInsets borderAsInsets;
@property (nonatomic, readonly) UIEdgeInsets compoundInsets;
@property (nonatomic, readonly) CGSize availableSize;

#pragma mark - Dirty Propagation Control

/**
* Designated method to control dirty propagation mechanism.
* Dirties the shadow view (and all affected shadow views, usually a superview)
* in terms of layout.
* The default implementaion does nothing.
*/
- (void)dirtyLayout;

/**
* Designated method to control dirty propagation mechanism.
* Clears (makes not dirty) the shadow view.
* The default implementaion does nothing.
*/
- (void)clearLayout;

@end
14 changes: 14 additions & 0 deletions React/Views/RCTShadowView+Layout.m
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@

@implementation RCTShadowView (Layout)

#pragma mark - Computed Layout-Inferred Metrics

- (UIEdgeInsets)paddingAsInsets
{
YGNodeRef yogaNode = self.yogaNode;
Expand Down Expand Up @@ -53,4 +55,16 @@ - (CGSize)availableSize
return UIEdgeInsetsInsetRect((CGRect){CGPointZero, self.frame.size}, self.compoundInsets).size;
}

#pragma mark - Dirty Propagation Control

- (void)dirtyLayout
{
// The default implementaion does nothing.
}

- (void)clearLayout
{
// The default implementaion does nothing.
}

@end

0 comments on commit af226ef

Please sign in to comment.