Skip to content

Commit

Permalink
Fix SwitchHandler
Browse files Browse the repository at this point in the history
  • Loading branch information
rookiejava committed Dec 27, 2021
1 parent 84cd5a5 commit 9220850
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
7 changes: 6 additions & 1 deletion src/Core/src/Handlers/Switch/SwitchHandler.Tizen.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,20 @@ namespace Microsoft.Maui.Handlers
{
public partial class SwitchHandler : ViewHandler<ISwitch, Check>
{
protected override Check CreateNativeView() => new Check(NativeParent);
protected override Check CreateNativeView() => new Check(NativeParent)
{
Style = "toggle"
};

protected override void ConnectHandler(Check nativeView)
{
base.ConnectHandler(nativeView);
nativeView!.StateChanged += OnStateChanged;
}

protected override void DisconnectHandler(Check nativeView)
{
base.DisconnectHandler(nativeView);
nativeView!.StateChanged -= OnStateChanged;
}

Expand Down
6 changes: 4 additions & 2 deletions src/Core/src/Platform/Tizen/SwitchExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,10 @@ public static void UpdateIsOn(this Check nativeCheck, ISwitch view)

public static void UpdateTrackColor(this Check nativeCheck, ISwitch view)
{
//TODO: need to consider default color
nativeCheck.Color = view.TrackColor.ToNativeEFL();
if (view.ThumbColor != null)
{
nativeCheck.Color = view.TrackColor.ToNativeEFL();
}
}

public static void UpdateThumbColor(this Check nativeCheck, ISwitch view)
Expand Down

0 comments on commit 9220850

Please sign in to comment.