[NUI] Fix NUI button not working when style disabled
authorJiyun Yang <ji.yang@samsung.com>
Mon, 30 Jan 2023 09:58:35 +0000 (18:58 +0900)
committerJaehyun Cho <jaehyun0cho@gmail.com>
Wed, 1 Feb 2023 07:07:33 +0000 (16:07 +0900)
There was a flag that prevent state updating while applying style.
But the flag seemed to have a bug : when style is disabled, the state updating is never going to be done.

This patch fixes the bug and changes the flag's name to be more contextual: styleApplied -> styleApplying.

Signed-off-by: Jiyun Yang <ji.yang@samsung.com>
src/Tizen.NUI.Components/Controls/Button.Internal.cs
src/Tizen.NUI.Components/Controls/Button.cs

index 9db2270..b4815a2 100644 (file)
@@ -34,7 +34,7 @@ namespace Tizen.NUI.Components
         private EventHandler<StateChangedEventArgs> stateChangeHandler;
 
         private bool isPressed = false;
-        private bool styleApplied = false;
+        private bool styleApplying = false;
 
         /// <summary>
         /// Gets accessibility name.
@@ -193,7 +193,7 @@ namespace Tizen.NUI.Components
         [EditorBrowsable(EditorBrowsableState.Never)]
         protected void UpdateState()
         {
-            if (!styleApplied) return;
+            if (styleApplying) return;
 
             ControlState sourceState = ControlState;
             ControlState targetState;
index 86bcef2..cc4bd78 100755 (executable)
@@ -1005,7 +1005,7 @@ namespace Tizen.NUI.Components
         {
             Debug.Assert(buttonIcon != null && buttonText != null);
 
-            styleApplied = false;
+            styleApplying = true;
 
             base.ApplyStyle(viewStyle);
 
@@ -1041,7 +1041,7 @@ namespace Tizen.NUI.Components
                 }
             }
 
-            styleApplied = true;
+            styleApplying = false;
             UpdateState();
         }