1
0
mirror of https://github.com/bitwarden/mobile synced 2025-12-10 05:13:31 +00:00

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

View File

@@ -1,4 +1,5 @@
using Bit.iOS.Renderers; using Bit.iOS.Renderers;
using System.ComponentModel;
using UIKit; using UIKit;
using Xamarin.Forms; using Xamarin.Forms;
using Xamarin.Forms.Platform.iOS; using Xamarin.Forms.Platform.iOS;
@@ -18,7 +19,22 @@ namespace Bit.iOS.Renderers
// Remove padding // Remove padding
Control.TextContainerInset = new UIEdgeInsets(0, 0, 0, 0); Control.TextContainerInset = new UIEdgeInsets(0, 0, 0, 0);
Control.TextContainer.LineFragmentPadding = 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) if(Control != null && e.NewElement is Entry)
{ {
Control.ClearButtonMode = UITextFieldViewMode.WhileEditing; Control.ClearButtonMode = UITextFieldViewMode.WhileEditing;
UpdateTintColor();
UpdateFontSize(); UpdateFontSize();
iOSHelpers.SetBottomBorder(Control); iOSHelpers.SetBottomBorder(Control);
} }
@@ -30,6 +31,10 @@ namespace Bit.iOS.Renderers
{ {
UpdateFontSize(); UpdateFontSize();
} }
else if(e.PropertyName == Entry.TextColorProperty.PropertyName)
{
UpdateTintColor();
}
} }
private void UpdateFontSize() private void UpdateFontSize()
@@ -47,5 +52,10 @@ namespace Bit.iOS.Renderers
} }
} }
} }
private void UpdateTintColor()
{
Control.TintColor = Element.TextColor.ToUIColor();
}
} }
} }