IF and ELSE IF seems evaluating the same condition in class SwitchRenderer.
In file:
Xamarin.Forms/Xamarin.Forms.Platform.Android/Renderers/SwitchRenderer.cs
At line 26 inside method:
public override SizeRequest GetDesiredSize(int widthConstraint, int heightConstraint)
It seems that Lines 33 and 36 are evaluating the same condition:
widthConstraint <= 0
if (widthConstraint <= 0)
width = (int)Context.GetThemeAttributeDp(global::Android.Resource.Attribute.SwitchMinWidth);
else if (widthConstraint <= 0)
width = 100;
Since widthConstraint is not a function (that could return different values when called)
but a local variable, it will have the same value in both cases. Am I missing something?
What is the original intention behind this?
Should the second condition be changed?
The same in
Xamarin.Forms/Xamarin.Forms.Platform.Android/AppCompat/SwitchRenderer.cs
in method at line 28
public override SizeRequest GetDesiredSize(int widthConstraint, int heightConstraint)
at lines 35 and 37
if (widthConstraint <= 0)
width = (int)Context.GetThemeAttributeDp(global::Android.Resource.Attribute.SwitchMinWidth);
else if (widthConstraint <= 0)
width = 100;
This will be a fun dig into git blame to see where that went wrong and why...
Committed before epoch.
Thank you everyone
Most helpful comment
This will be a fun dig into git blame to see where that went wrong and why...