fix cursor color to renderers

This commit is contained in:
Kyle Spearrin 2019-06-26 10:20:42 -04:00
parent dd4561d985
commit 2d91a893f7
3 changed files with 26 additions and 6 deletions

View file

@ -9,20 +9,16 @@ namespace Bit.iOS.Core.Utilities
{
var lightTheme = false;
var mutedColor = Xamarin.Forms.Color.FromHex("#777777").ToUIColor();
var textColor = Xamarin.Forms.Color.FromHex("#000000").ToUIColor();
if(theme == "dark")
{
textColor = Xamarin.Forms.Color.FromHex("#ffffff").ToUIColor();
mutedColor = Xamarin.Forms.Color.FromHex("#a3a3a3").ToUIColor();
}
else if(theme == "black")
{
textColor = Xamarin.Forms.Color.FromHex("#ffffff").ToUIColor();
mutedColor = Xamarin.Forms.Color.FromHex("#a3a3a3").ToUIColor();
}
else if(theme == "nord")
{
textColor = Xamarin.Forms.Color.FromHex("#e5e9f0").ToUIColor();
mutedColor = Xamarin.Forms.Color.FromHex("#d8dee9").ToUIColor();
}
else
@ -30,8 +26,6 @@ namespace Bit.iOS.Core.Utilities
lightTheme = true;
}
UITextField.Appearance.TintColor = textColor;
UITextView.Appearance.TintColor = textColor;
UIStepper.Appearance.TintColor = mutedColor;
if(!lightTheme)
{

View file

@ -1,4 +1,5 @@
using Bit.iOS.Renderers;
using System.ComponentModel;
using UIKit;
using Xamarin.Forms;
using Xamarin.Forms.Platform.iOS;
@ -18,7 +19,22 @@ namespace Bit.iOS.Renderers
// Remove padding
Control.TextContainerInset = new UIEdgeInsets(0, 0, 0, 0);
Control.TextContainer.LineFragmentPadding = 0;
UpdateTintColor();
}
}
protected override void OnElementPropertyChanged(object sender, PropertyChangedEventArgs e)
{
base.OnElementPropertyChanged(sender, e);
if(e.PropertyName == Editor.TextColorProperty.PropertyName)
{
UpdateTintColor();
}
}
private void UpdateTintColor()
{
Control.TintColor = Element.TextColor.ToUIColor();
}
}
}

View file

@ -16,6 +16,7 @@ namespace Bit.iOS.Renderers
if(Control != null && e.NewElement is Entry)
{
Control.ClearButtonMode = UITextFieldViewMode.WhileEditing;
UpdateTintColor();
UpdateFontSize();
iOSHelpers.SetBottomBorder(Control);
}
@ -30,6 +31,10 @@ namespace Bit.iOS.Renderers
{
UpdateFontSize();
}
else if(e.PropertyName == Entry.TextColorProperty.PropertyName)
{
UpdateTintColor();
}
}
private void UpdateFontSize()
@ -47,5 +52,10 @@ namespace Bit.iOS.Renderers
}
}
}
private void UpdateTintColor()
{
Control.TintColor = Element.TextColor.ToUIColor();
}
}
}