use didSetProps instead of updateLayout

Summary: There is no point in using `updateLayout` when we have `didSetProps`.
The only a bit risky part is calling `dirtyLayout` in `setFrame:forView:` instead of `updateLayout`,
but since setting frame shouldn't really change border/margin/padding it should be ok.

Depends on D2699512.

public

Reviewed By: nicklockwood

Differential Revision: D2700012

fb-gh-sync-id: a7c33b3b4e3ddc195bebebb8b03934131af016fb
This commit is contained in:
Martin Kralik 2015-11-27 02:52:14 -08:00 committed by facebook-github-bot-0
parent f86691a449
commit be285c43d1
4 changed files with 3 additions and 7 deletions

View File

@ -382,7 +382,7 @@ extern NSString *RCTBridgeModuleNameForClass(Class cls);
rootShadowView.frame = frame;
}
[rootShadowView updateLayout];
[rootShadowView dirtyLayout];
[self batchDidComplete];
});

View File

@ -325,7 +325,6 @@ RCT_NOT_IMPLEMENTED(- (instancetype)init)
if ([shadowView respondsToSelector:@selector(didSetProps:)]) {
[shadowView didSetProps:[props allKeys]];
}
[shadowView updateLayout];
}
- (NSDictionary<NSString *, id> *)viewConfig

View File

@ -164,10 +164,7 @@ typedef void (^RCTApplierBlock)(NSDictionary<NSNumber *, UIView *> *viewRegistry
- (void)setTextComputed NS_REQUIRES_SUPER;
- (BOOL)isTextDirty;
/**
* Triggers a recalculation of the shadow view's layout.
*/
- (void)updateLayout NS_REQUIRES_SUPER;
- (void)didSetProps:(NSArray<NSString *> *)changedProps NS_REQUIRES_SUPER;
/**
* Computes the recursive offset, meaning the sum of all descendant offsets -

View File

@ -580,7 +580,7 @@ RCT_STYLE_PROPERTY(FlexWrap, flexWrap, flex_wrap, css_wrap_type_t)
[self dirtyPropagation];
}
- (void)updateLayout
- (void)didSetProps:(NSArray<NSString *> *)changedProps
{
if (_recomputePadding) {
RCTProcessMetaProps(_paddingMetaProps, _cssNode->style.padding);