Skip to content

Commit

Permalink
Remove transparency from DatePickerField
Browse files Browse the repository at this point in the history
  • Loading branch information
enisn committed Mar 20, 2024
1 parent 1eab9ea commit 43cccdf
Showing 1 changed file with 10 additions and 12 deletions.
22 changes: 10 additions & 12 deletions src/UraniumUI.Material/Controls/DatePickerField.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,7 @@ public class DatePickerField : InputField
{
VerticalOptions = LayoutOptions.Center,
Margin = new Thickness(10, 0),
#if IOS || MACCATALYST
Opacity = 0.10,
#else
Opacity = 0,
#endif
};

protected StatefulContentView iconClear = new StatefulContentView
Expand All @@ -46,16 +42,20 @@ public DatePickerField()
DatePickerView.SetBinding(DatePickerView.DateProperty, new Binding(nameof(Date), source: this));
DatePickerView.SetBinding(DatePickerView.IsEnabledProperty, new Binding(nameof(IsEnabled), source: this));

#if MACCATALYST
labelTitle.InputTransparent = false;
labelTitle.GestureRecognizers.Add(new TapGestureRecognizer
#if MACCATALYST || IOS
labelTitle.InputTransparent = true;
base.border.GestureRecognizers.Add(new TapGestureRecognizer
{
Command = new Command(() =>
{
#if MACCATALYST
if (!HasValue)
{
Date = (DateTime)DatePicker.DateProperty.DefaultValue;
}
#else
DatePickerView.Focus();
#endif
})
});
#endif
Expand All @@ -71,6 +71,9 @@ protected virtual void OnClearTapped(object parameter)
if (IsEnabled)
{
Date = null;
#if MACCATALYST
DatePickerView.Unfocus();
#endif
}
}

Expand All @@ -79,12 +82,7 @@ protected virtual void OnDateChanged()
OnPropertyChanged(nameof(Date));
CheckAndShowValidations();

#if IOS || MACCATALYST
DatePickerView.Opacity = Date == null ? 0.1 : 1;
#else
DatePickerView.Opacity = Date == null ? 0 : 1;
#endif

if (AllowClear)
{
iconClear.IsVisible = Date != null;
Expand Down

0 comments on commit 43cccdf

Please sign in to comment.