bitwarden-android/src/iOS/Renderers/CustomSearchBarRenderer.cs
2019-08-28 20:27:15 -04:00

28 lines
765 B
C#

using Bit.iOS.Renderers;
using UIKit;
using Xamarin.Forms;
using Xamarin.Forms.Platform.iOS;
[assembly: ExportRenderer(typeof(SearchBar), typeof(CustomSearchBarRenderer))]
namespace Bit.iOS.Renderers
{
public class CustomSearchBarRenderer : SearchBarRenderer
{
protected override void OnElementChanged(ElementChangedEventArgs<SearchBar> e)
{
base.OnElementChanged(e);
if(e.NewElement is SearchBar)
{
UpdateKeyboardAppearance();
}
}
private void UpdateKeyboardAppearance()
{
if(!Core.Utilities.ThemeHelpers.LightTheme)
{
Control.KeyboardAppearance = UIKeyboardAppearance.Dark;
}
}
}
}