diff --git a/src/iOS.Autofill/LoginSearchViewController.cs b/src/iOS.Autofill/LoginSearchViewController.cs index 1a297bd65..9b4031791 100644 --- a/src/iOS.Autofill/LoginSearchViewController.cs +++ b/src/iOS.Autofill/LoginSearchViewController.cs @@ -1,4 +1,4 @@ -using System; +using System; using Bit.iOS.Autofill.Models; using Foundation; using UIKit; @@ -27,6 +27,10 @@ namespace Bit.iOS.Autofill CancelBarButton.Title = AppResources.Cancel; SearchBar.Placeholder = AppResources.Search; SearchBar.BackgroundColor = SearchBar.BarTintColor = ThemeHelpers.ListHeaderBackgroundColor; + if(!ThemeHelpers.LightTheme) + { + SearchBar.KeyboardAppearance = UIKeyboardAppearance.Dark; + } TableView.RowHeight = UITableView.AutomaticDimension; TableView.EstimatedRowHeight = 44; diff --git a/src/iOS.Core/Services/DeviceActionService.cs b/src/iOS.Core/Services/DeviceActionService.cs index 10bbdbec5..c972c650a 100644 --- a/src/iOS.Core/Services/DeviceActionService.cs +++ b/src/iOS.Core/Services/DeviceActionService.cs @@ -8,6 +8,7 @@ using Bit.App.Resources; using Bit.Core.Abstractions; using Bit.Core.Enums; using Bit.Core.Models.View; +using Bit.iOS.Core.Utilities; using Bit.iOS.Core.Views; using CoreGraphics; using Foundation; @@ -203,6 +204,10 @@ namespace Bit.iOS.Core.Services { input.KeyboardType = UIKeyboardType.NumberPad; } + if(!ThemeHelpers.LightTheme) + { + input.KeyboardAppearance = UIKeyboardAppearance.Dark; + } }); var vc = GetPresentedViewController(); vc?.PresentViewController(alert, true, null); @@ -469,4 +474,4 @@ namespace Bit.iOS.Core.Services } } } -} \ No newline at end of file +} diff --git a/src/iOS.Core/Views/FormEntryTableViewCell.cs b/src/iOS.Core/Views/FormEntryTableViewCell.cs index 1f0fe8ac7..1a9376564 100644 --- a/src/iOS.Core/Views/FormEntryTableViewCell.cs +++ b/src/iOS.Core/Views/FormEntryTableViewCell.cs @@ -41,6 +41,11 @@ namespace Bit.iOS.Core.Views BackgroundColor = ThemeHelpers.BackgroundColor }; + if(!ThemeHelpers.LightTheme) + { + TextView.KeyboardAppearance = UIKeyboardAppearance.Dark; + } + ContentView.Add(TextView); ContentView.AddConstraints(new NSLayoutConstraint[] { NSLayoutConstraint.Create(TextView, NSLayoutAttribute.Leading, NSLayoutRelation.Equal, ContentView, NSLayoutAttribute.Leading, 1f, 15f), @@ -78,6 +83,11 @@ namespace Bit.iOS.Core.Views BackgroundColor = ThemeHelpers.BackgroundColor }; + if(!ThemeHelpers.LightTheme) + { + TextField.KeyboardAppearance = UIKeyboardAppearance.Dark; + } + if(useLabelAsPlaceholder) { TextField.Placeholder = labelName; diff --git a/src/iOS.Core/Views/PickerTableViewCell.cs b/src/iOS.Core/Views/PickerTableViewCell.cs index 03cc39806..265662548 100644 --- a/src/iOS.Core/Views/PickerTableViewCell.cs +++ b/src/iOS.Core/Views/PickerTableViewCell.cs @@ -41,6 +41,11 @@ namespace Bit.iOS.Core.Views BackgroundColor = ThemeHelpers.BackgroundColor }; + if(!ThemeHelpers.LightTheme) + { + TextField.KeyboardAppearance = UIKeyboardAppearance.Dark; + } + var width = (float)UIScreen.MainScreen.Bounds.Width; var toolbar = new UIToolbar(new RectangleF(0, 0, width, 44)) { diff --git a/src/iOS/Renderers/CustomEditorRenderer.cs b/src/iOS/Renderers/CustomEditorRenderer.cs index 89aaac734..13409831a 100644 --- a/src/iOS/Renderers/CustomEditorRenderer.cs +++ b/src/iOS/Renderers/CustomEditorRenderer.cs @@ -20,6 +20,7 @@ namespace Bit.iOS.Renderers Control.TextContainerInset = new UIEdgeInsets(0, 0, 0, 0); Control.TextContainer.LineFragmentPadding = 0; UpdateTintColor(); + UpdateKeyboardAppearance(); } } @@ -36,5 +37,13 @@ namespace Bit.iOS.Renderers { Control.TintColor = Element.TextColor.ToUIColor(); } + + private void UpdateKeyboardAppearance() + { + if(!Core.Utilities.ThemeHelpers.LightTheme) + { + Control.KeyboardAppearance = UIKeyboardAppearance.Dark; + } + } } } diff --git a/src/iOS/Renderers/CustomEntryRenderer.cs b/src/iOS/Renderers/CustomEntryRenderer.cs index 06b49610f..59329e9bb 100644 --- a/src/iOS/Renderers/CustomEntryRenderer.cs +++ b/src/iOS/Renderers/CustomEntryRenderer.cs @@ -18,6 +18,7 @@ namespace Bit.iOS.Renderers Control.ClearButtonMode = UITextFieldViewMode.WhileEditing; UpdateTintColor(); UpdateFontSize(); + UpdateKeyboardAppearance(); iOSHelpers.SetBottomBorder(Control); } } @@ -57,5 +58,13 @@ namespace Bit.iOS.Renderers { Control.TintColor = Element.TextColor.ToUIColor(); } + + private void UpdateKeyboardAppearance() + { + if(!Core.Utilities.ThemeHelpers.LightTheme) + { + Control.KeyboardAppearance = UIKeyboardAppearance.Dark; + } + } } } diff --git a/src/iOS/Renderers/CustomPickerRenderer.cs b/src/iOS/Renderers/CustomPickerRenderer.cs index 6581bf87c..49d740087 100644 --- a/src/iOS/Renderers/CustomPickerRenderer.cs +++ b/src/iOS/Renderers/CustomPickerRenderer.cs @@ -17,6 +17,15 @@ namespace Bit.iOS.Renderers var descriptor = UIFontDescriptor.PreferredBody; Control.Font = UIFont.FromDescriptor(descriptor, descriptor.PointSize); iOSHelpers.SetBottomBorder(Control); + UpdateKeyboardAppearance(); + } + } + + private void UpdateKeyboardAppearance() + { + if(!Core.Utilities.ThemeHelpers.LightTheme) + { + Control.KeyboardAppearance = UIKeyboardAppearance.Dark; } } } diff --git a/src/iOS/Renderers/CustomSearchBarRenderer.cs b/src/iOS/Renderers/CustomSearchBarRenderer.cs new file mode 100644 index 000000000..d4aeaa3f8 --- /dev/null +++ b/src/iOS/Renderers/CustomSearchBarRenderer.cs @@ -0,0 +1,28 @@ +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 e) + { + base.OnElementChanged(e); + if(e.NewElement is SearchBar) + { + UpdateKeyboardAppearance(); + } + } + + private void UpdateKeyboardAppearance() + { + if(!Core.Utilities.ThemeHelpers.LightTheme) + { + Control.KeyboardAppearance = UIKeyboardAppearance.Dark; + } + } + } +} diff --git a/src/iOS/iOS.csproj b/src/iOS/iOS.csproj index a02a40b84..099345c58 100644 --- a/src/iOS/iOS.csproj +++ b/src/iOS/iOS.csproj @@ -137,6 +137,7 @@ +