0

Not sure if it is a Xamarin IOS bug but on the same panel we have a custom control that pops a modal view of choices(like a picker) and a standard Xamarin Forms Picker. If the standard picker is displaying the scroller at the bottom and then then custom modal control is tapped and receives focus the modal view pops up but the standard picker never disappears creating a hung panel.

Hung Panel

The standard IOS picker does lose focus but never disappears. I have a renderer created but can't figure how to close the IOS picker.

namespace HCMobile.iOS.CustomRenderers 
{
  public class CustomPickerRenderer : PickerRenderer
  {
    public CustomPickerRenderer() { }
    protected override void OnElementPropertyChanged(object sender, PropertyChangedEventArgs e)
    {
        base.OnElementPropertyChanged(sender, e);

        var isFocused = ((Picker)sender).IsFocused;
        // This fires when the IOS picker looses focus but never closes the picker at the bottom of the panel. Scroller disappears if ANY other control receives focus.
        if (Control != null && !isFocused)
        {
            UIPickerView pickerView = (UIPickerView)Control.InputView;
        }
        else
        {
            UIPickerView pickerView = (UIPickerView)Control.InputView;
        }
    }
  }
}

Has anyone else ran into this problem?

  • By bottom Scoller you mean the black line at the bottom?It is the [Home Indicator](https://learn.microsoft.com/en-us/xamarin/xamarin-forms/platform/ios/page-home-indicator) in ios.You don't need a customrenderer for the picker. – Leo Zhu Nov 04 '20 at 09:14
  • No. I mean the scroller that says years, months, days. – JamesinGreerSC Nov 04 '20 at 15:47
  • I couldn't understand your exact issue, I run it with your code and it seems to be ok. – Leo Zhu Nov 05 '20 at 02:08

0 Answers0