iOS:avoid reset margin while prop is nil

This commit is contained in:
pengfei.zhou 2020-04-08 20:27:23 +08:00 committed by osborn
parent 8e6b4dd024
commit 84d19230e4

View File

@ -381,10 +381,18 @@ - (void)blendLayoutConfig:(NSDictionary *)params {
self.view.doricLayout.heightSpec = (DoricLayoutSpec) [it integerValue]; self.view.doricLayout.heightSpec = (DoricLayoutSpec) [it integerValue];
}]; }];
[params[@"margin"] also:^(NSDictionary *it) { [params[@"margin"] also:^(NSDictionary *it) {
self.view.doricLayout.marginLeft = [it[@"left"] floatValue]; [it[@"left"] also:^(NSNumber* it) {
self.view.doricLayout.marginTop = [it[@"top"] floatValue]; self.view.doricLayout.marginLeft = [it floatValue];
self.view.doricLayout.marginRight = [it[@"right"] floatValue]; }];
self.view.doricLayout.marginBottom = [it[@"bottom"] floatValue]; [it[@"top"] also:^(NSNumber* it) {
self.view.doricLayout.marginTop = [it floatValue];
}];
[it[@"right"] also:^(NSNumber* it) {
self.view.doricLayout.marginRight = [it floatValue];
}];
[it[@"bottom"] also:^(NSNumber* it) {
self.view.doricLayout.marginBottom = [it floatValue];
}];
}]; }];
[params[@"alignment"] also:^(NSNumber *it) { [params[@"alignment"] also:^(NSNumber *it) {
self.view.doricLayout.alignment = (DoricGravity) [it integerValue]; self.view.doricLayout.alignment = (DoricGravity) [it integerValue];