1
0
mirror of https://github.com/bitwarden/mobile synced 2025-12-26 21:23:46 +00:00
Files
mobile/src/iOS/Controls/CustomSearchBarRenderer.cs

34 lines
1.0 KiB
C#

using Bit.App.Controls;
using Bit.iOS.Controls;
using System.ComponentModel;
using UIKit;
using Xamarin.Forms;
using Xamarin.Forms.Platform.iOS;
[assembly: ExportRenderer(typeof(SearchBar), typeof(CustomSearchBarRenderer))]
namespace Bit.iOS.Controls
{
public class CustomSearchBarRenderer : SearchBarRenderer
{
protected override void OnElementChanged(ElementChangedEventArgs<SearchBar> e)
{
base.OnElementChanged(e);
var view = e.NewElement;
if(view != null)
{
Control.SearchBarStyle = UISearchBarStyle.Minimal;
Control.BarStyle = UIBarStyle.BlackTranslucent;
Control.ShowsCancelButton = Control.IsFirstResponder;
}
}
protected override void OnElementPropertyChanged(object sender, PropertyChangedEventArgs e)
{
base.OnElementPropertyChanged(sender, e);
var view = Element;
Control.ShowsCancelButton = Control.IsFirstResponder;
}
}
}