Xamarin.Forms icon indicating copy to clipboard operation
Xamarin.Forms copied to clipboard

[Enhancement] Open up the ShellSection Implementation on iOS

Open ChasakisD opened this issue 6 years ago • 6 comments

Summary

There are a lot of cases where you want to use a custom NavigationViewController just like MaterialComponents one (MDCAppBarNavigationController) or AMScrollingNavbar's ScrollingViewController. Write now, to solve the problem, you have to copy the ShellSectionRenderer class with some other internal extension methods and just change 1 line of code, the base class. This should be done just like the other Renderers where on CreateNativeControl() you specify the the class of the control.

API Changes

Maybe a wrapper class or a factory in order to be able to create another implementations of UINavigationController.

Intended Use Case

There are a lot of goodies in MDCAppBarNavigationController, like the scrolling behavior that are missing from UINavigationController. By opening up the creation of UINavigationController, developers will be able to easily integrate a custom UINavigationController to their apps.

ChasakisD avatar Nov 08 '19 09:11 ChasakisD

@ChasakisD does this PR address what you need?

https://github.com/xamarin/Xamarin.Forms/pull/8441

PureWeen avatar Nov 13 '19 00:11 PureWeen

@PureWeen I am not saying about the creation of the ShellSectionRootRenderer, but for changing the inheritance of ShellSectionRenderer from UINavigationController to lets say Material's AppBarNavigationController. Right now, if you want to change to another navigation controller, you have to copy and paste the ShellSectionRenderer and just replace the UINavigationController with AppBarNavigationController.

ChasakisD avatar Nov 13 '19 09:11 ChasakisD

@ChasakisD aw ok I see what you're getting at

Yea, this will definitely become relevant as we ramp up Material Shell

This should be done just like the other Renderers where on CreateNativeControl() you specify the the class of the control.

The tricky part here is that on iOS all the normal renderers are wrapped by a parented UIView whereas ShellSectionRenderer inherits directly from UINavigationController so we'd need to move all the behavior out of the class into something that's reusable.

We do this on Android for all the renderers that inherit directly from components opposed to being wrapped by ViewGroups

I wish this was legal :-)

ShellSectionRendererBase<T> : T where T is UINavigationController

PureWeen avatar Nov 13 '19 17:11 PureWeen

@PureWeen Didn't know about any plans for MaterialShell. Sorry for that. I am starting playing with MaterialComponents on iOS and they are pretty awesome. That's why I opened this issue.

Yeah that pattern that was applied on Android Renderers is going to make it very easy to integrate with other NavigationControllers, and as far the ShellNavBarAppearanceTracker is also open, it will be very easy to customize the MaterialComponents' AppBar!

ChasakisD avatar Nov 13 '19 17:11 ChasakisD

@ChasakisD

Didn't about any plans for MaterialShell. Sorry for that. I am starting playing with MaterialComponents on iOS and they are pretty awesome. That's why I opened this issue.

We haven't started work on it but it's on the road map. I'm going to elevate this issue here on my queue of things though see if I can get this exposed how you want

If you're working on integrating Material things into Shell I'd really like to make that as easy as I can for you!!

PureWeen avatar Nov 13 '19 18:11 PureWeen

@ChasakisD have you done an implementation with Shell and MDCAppBarNavigationController ?

PureWeen avatar Jan 05 '20 20:01 PureWeen