From 957f9d73339434ac254b53ca0d0188b17eed28c7 Mon Sep 17 00:00:00 2001 From: "Frank A. Krueger" Date: Thu, 1 Feb 2018 23:14:07 -0800 Subject: [PATCH] Added issue #48 repro --- Ooui/Client.js | 2 +- Samples/SwitchErrorSample.cs | 40 ++++++++++++++++++++++++++++++++++++ 2 files changed, 41 insertions(+), 1 deletion(-) create mode 100644 Samples/SwitchErrorSample.cs diff --git a/Ooui/Client.js b/Ooui/Client.js index 7e1116a..9d9e458 100644 --- a/Ooui/Client.js +++ b/Ooui/Client.js @@ -1,6 +1,6 @@ // Ooui v1.0.0 -var debug = false; +var debug = true; const nodes = {}; const hasText = {}; diff --git a/Samples/SwitchErrorSample.cs b/Samples/SwitchErrorSample.cs new file mode 100644 index 0000000..184f90d --- /dev/null +++ b/Samples/SwitchErrorSample.cs @@ -0,0 +1,40 @@ +using Ooui; +using Xamarin.Forms; + +namespace Samples +{ + // From https://github.com/praeclarum/Ooui/issues/48 + public class SwitchErrorSample : ISample + { + public string Title => "Xamarin.Forms Switch Error"; + + public Ooui.Element CreateElement () + { + var layout = new StackLayout(); + var label = new Xamarin.Forms.Label + { + Text = "Switch state goes here", + HorizontalTextAlignment = TextAlignment.Center + }; + var sw = new Switch + { + HorizontalOptions = LayoutOptions.CenterAndExpand + }; + sw.Toggled += (sender, args) => + { + label.Text = $"Switch state is :{((Switch)sender).IsToggled}"; + }; + layout.Children.Add(label); + layout.Children.Add(sw); + return new ContentPage + { + Content = layout + }.GetOouiElement(); + } + + public void Publish() + { + UI.Publish ("/switch", CreateElement); + } + } +}