From 08f917a91aab65ab3cf5b51321c87b1b7f6d77fc Mon Sep 17 00:00:00 2001 From: YeongJong Lee Date: Thu, 21 Jan 2021 15:30:07 +0900 Subject: [PATCH] [NUI] remove internal child properly when child view of FlexLayout is removed (#2522) In `FlexLayout`, when we add new view, the existing view shrink. but when removed they are in shrinked state. they should change back. To fix this issue, this patch remove internal child(child of yoga layout) when child view of `FlexLayout` is removed. For now, `OnChildRemove` API will work correctly. Thank you Aman Jeph for the report. Co-authored-by: Jiyun Yang --- src/Tizen.NUI/src/internal/Layouting/Interop/Interop.FlexLayout.cs | 2 +- src/Tizen.NUI/src/public/Layouting/FlexLayout.cs | 7 ++++++- src/Tizen.NUI/src/public/Layouting/LayoutGroup.cs | 2 +- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/Tizen.NUI/src/internal/Layouting/Interop/Interop.FlexLayout.cs b/src/Tizen.NUI/src/internal/Layouting/Interop/Interop.FlexLayout.cs index 3ce6e22..7d4252f 100755 --- a/src/Tizen.NUI/src/internal/Layouting/Interop/Interop.FlexLayout.cs +++ b/src/Tizen.NUI/src/internal/Layouting/Interop/Interop.FlexLayout.cs @@ -21,7 +21,7 @@ namespace Tizen.NUI public static extern global::System.IntPtr AddChildWithMargin(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2, global::System.Runtime.InteropServices.HandleRef jarg3, Tizen.NUI.FlexLayout.ChildMeasureCallback jarg4, int jarg5); [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_FlexLayout_RemoveChild")] - public static extern global::System.IntPtr RemoveChild(global::System.Runtime.InteropServices.HandleRef jarg1, LayoutItem jarg2); + public static extern global::System.IntPtr RemoveChild(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_FlexLayout_CalculateLayout")] public static extern global::System.IntPtr CalculateLayout(global::System.Runtime.InteropServices.HandleRef jarg1, float jarg2, float jarg3, bool jarg4); diff --git a/src/Tizen.NUI/src/public/Layouting/FlexLayout.cs b/src/Tizen.NUI/src/public/Layouting/FlexLayout.cs index 941b3da..800f001 100755 --- a/src/Tizen.NUI/src/public/Layouting/FlexLayout.cs +++ b/src/Tizen.NUI/src/public/Layouting/FlexLayout.cs @@ -703,12 +703,17 @@ namespace Tizen.NUI /// Callback when child is removed from container.
/// /// The Layout child. + /// Thrown when child is null. /// 6 protected override void OnChildRemove(LayoutItem child) { + if (null == child) + { + throw new ArgumentNullException(nameof(child)); + } // When child View is removed from it's parent View (that is a Layout) then remove it from the layout too. // FlexLayout refers to the child as a View not LayoutItem. - Interop.FlexLayout.RemoveChild(swigCPtr, child); + Interop.FlexLayout.RemoveChild(swigCPtr, child.Owner.SwigCPtr); } /// diff --git a/src/Tizen.NUI/src/public/Layouting/LayoutGroup.cs b/src/Tizen.NUI/src/public/Layouting/LayoutGroup.cs index fc19957..1ec6c48 100755 --- a/src/Tizen.NUI/src/public/Layouting/LayoutGroup.cs +++ b/src/Tizen.NUI/src/public/Layouting/LayoutGroup.cs @@ -141,7 +141,7 @@ namespace Tizen.NUI // If child removed then set all siblings not being added to a ChangeOnRemove transition. SetConditionsForAnimationOnLayoutGroup(TransitionCondition.ChangeOnRemove); } - + OnChildRemove(layoutItem); RequestLayout(); } -- 2.7.4