From 84d19230e47c2fb1494c42edb81c16412659ac3c Mon Sep 17 00:00:00 2001 From: "pengfei.zhou" Date: Wed, 8 Apr 2020 20:27:23 +0800 Subject: [PATCH] iOS:avoid reset margin while prop is nil --- doric-iOS/Pod/Classes/Shader/DoricViewNode.m | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/doric-iOS/Pod/Classes/Shader/DoricViewNode.m b/doric-iOS/Pod/Classes/Shader/DoricViewNode.m index 6c763546..a4e3915d 100644 --- a/doric-iOS/Pod/Classes/Shader/DoricViewNode.m +++ b/doric-iOS/Pod/Classes/Shader/DoricViewNode.m @@ -381,10 +381,18 @@ - (void)blendLayoutConfig:(NSDictionary *)params { self.view.doricLayout.heightSpec = (DoricLayoutSpec) [it integerValue]; }]; [params[@"margin"] also:^(NSDictionary *it) { - self.view.doricLayout.marginLeft = [it[@"left"] floatValue]; - self.view.doricLayout.marginTop = [it[@"top"] floatValue]; - self.view.doricLayout.marginRight = [it[@"right"] floatValue]; - self.view.doricLayout.marginBottom = [it[@"bottom"] floatValue]; + [it[@"left"] also:^(NSNumber* it) { + self.view.doricLayout.marginLeft = [it 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) { self.view.doricLayout.alignment = (DoricGravity) [it integerValue];