[NUI] remove internal child properly when child view of FlexLayout is removed (#2523)
authorYeongJong Lee <cleanlyj@naver.com>
Thu, 21 Jan 2021 06:34:18 +0000 (15:34 +0900)
committerGitHub <noreply@github.com>
Thu, 21 Jan 2021 06:34:18 +0000 (15:34 +0900)
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.

src/Tizen.NUI/src/internal/Layouting/Interop/Interop.FlexLayout.cs
src/Tizen.NUI/src/public/Layouting/FlexLayout.cs
src/Tizen.NUI/src/public/Layouting/LayoutGroup.cs

index 892f8ac..f11daf0 100755 (executable)
@@ -21,7 +21,7 @@ namespace Tizen.NUI
             public static extern global::System.IntPtr FlexLayout_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 FlexLayout_RemoveChild( global::System.Runtime.InteropServices.HandleRef jarg1, LayoutItem jarg2);
+            public static extern global::System.IntPtr FlexLayout_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 FlexLayout_CalculateLayout( global::System.Runtime.InteropServices.HandleRef jarg1, float jarg2, float jarg3, bool jarg4);
index b3ccc94..bf7f758 100755 (executable)
@@ -626,7 +626,7 @@ namespace Tizen.NUI
         {
             // 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.FlexLayout_RemoveChild(swigCPtr, child);
+            Interop.FlexLayout.FlexLayout_RemoveChild(swigCPtr, child.Owner.SwigCPtr);
         }
 
         /// <summary>
index f156cb4..6d28894 100755 (executable)
@@ -119,7 +119,7 @@ namespace Tizen.NUI
                 // If child removed then set all siblings not being added to a ChangeOnRemove transition.
                 SetConditionsForAnimationOnLayoutGroup(TransitionCondition.ChangeOnRemove);
             }
-
+            OnChildRemove(layoutItem);
             RequestLayout();
         }