Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CornerRadius not working in Xamarin.iOS current versions (somewhat workaround inside) #91

Closed
idchlife opened this issue Jul 4, 2020 · 2 comments

Comments

@idchlife
Copy link

idchlife commented Jul 4, 2020

Describe the bug
I updated Xamarin Forms and CornerRadius no longer works.

To Reproduce
Steps to reproduce the behavior:

  1. Update any project or create new with versions:

Xamarin.iOS - 13.20.1.18
Xamarin.Forms- 4.7.0.1080

  1. Run iOS project. See that buttons is not rounded if you specify CornerRadius.

Expected behavior
CornerRadius to work. Buttons square as if there was no corner radius.

Screenshots

Please complete the following information:

  • Which version of the FlexButton do you use? - 0.11.0
  • Which version of Xamarin.Forms do you use? 4.7.0.1080
  • Which OS are you talking about? iOS

Additional information if needed:

I fixed it in my app by providing custom ViewRenderer for iOS with this code:

[assembly: ExportRenderer(typeof(FlexButton), typeof(FlexButtonFixRenderer))]
namespace ReceiptsApp.iOS.Views.UI {
  public class FlexButtonFixRenderer : ViewRenderer {
    public FlexButtonFixRenderer() {
    }

    protected override void OnElementChanged(ElementChangedEventArgs<View> e) {
      base.OnElementChanged(e);

      Debug.WriteLine("IM HERE");

      if (e.NewElement == null) return;

      var element = e.NewElement;

      if (element == null) return;

      Debug.WriteLine("ELEMENT IS NOT NULL!");

      try {
        if (Element is FlexButton flex) {
          Debug.WriteLine("FIXING FLEX BUTTON BUG WITH NO CORNER RADIUS");
          if (flex.CornerRadius <= 0) return;

          NativeView.Layer.CornerRadius = flex.CornerRadius;
          //NativeView.ClipsToBounds = true;

          Debug.WriteLine("DONE FIXING");
          //control.Layer.Boun
	  
        }
      } catch (Exception exc) {
        Debug.WriteLine("ERROR FIXING FLEX BUTTON ROUND EFFECT");
        Debug.WriteLine(exc);
      }

    }
  }
}

BUT it kills border because of ClipsToBounds 😩

@mike-rowley
Copy link

mike-rowley commented Jul 20, 2020

@idchlife I think this project has been abandoned. I posted a message over 6 weeks ago asking Robin-Manuel, the repository owner, about its status and haven't received a response.

I have pulled the code repository and am making necessary changes within my own project code base, unfortunately I don't have the time or requisite control building experience to continue development on this publicly.

I have run into the issue you have described and thought I would share what I have found, it appears to be related to this Xam Forms bug:
xamarin/Xamarin.Forms#2405

@robinmanuelthiel
Copy link
Owner

Fixed in v0.13.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants