Skip to content

Commit 5ccbfca

Browse files
Fixed ReturnType="Next" doesn't work with SfTextInputLayout Issue
1 parent 4d21a66 commit 5ccbfca

File tree

3 files changed

+30
-5
lines changed

3 files changed

+30
-5
lines changed

maui/src/TextInputLayout/SfTextInputLayout.Methods.cs

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -489,6 +489,27 @@ SizeF GetLabelSize(SizeF size)
489489
}
490490
}
491491

492+
#if ANDROID
493+
494+
private void ApplyNativeProperties(Entry entry)
495+
{
496+
if (entry.Handler?.PlatformView is AndroidX.AppCompat.Widget.AppCompatEditText androidEntry)
497+
{
498+
androidEntry.ImeOptions = entry.ReturnType switch
499+
{
500+
ReturnType.Default => Android.Views.InputMethods.ImeAction.Unspecified,
501+
ReturnType.Next => Android.Views.InputMethods.ImeAction.Next,
502+
ReturnType.Done => Android.Views.InputMethods.ImeAction.Done,
503+
ReturnType.Go => Android.Views.InputMethods.ImeAction.Go,
504+
ReturnType.Search => Android.Views.InputMethods.ImeAction.Search,
505+
ReturnType.Send => Android.Views.InputMethods.ImeAction.Send,
506+
_ => Android.Views.InputMethods.ImeAction.Unspecified
507+
};
508+
}
509+
}
510+
511+
#endif
512+
492513
void SetupAndroidView(object? sender)
493514
{
494515
#if ANDROID
@@ -497,6 +518,10 @@ void SetupAndroidView(object? sender)
497518
androidView.SetBackgroundColor(Android.Graphics.Color.Transparent);
498519
androidView.SetPadding(0, 0, 0, 0);
499520
}
521+
if (sender is Entry entry)
522+
{
523+
ApplyNativeProperties(entry);
524+
}
500525
#endif
501526
}
502527

maui/src/TextInputLayout/SfTextInputLayout.Properties.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2144,13 +2144,13 @@ static void OnIsHintFloatedPropertyChanged(BindableObject bindable, object oldVa
21442144
{
21452145
if (inputLayout.Content is InputView || inputLayout.Content is Picker)
21462146
{
2147-
inputLayout.Content.Opacity = value ? 1 : 0;
2147+
inputLayout.Content.Opacity = value ? 1 : (DeviceInfo.Platform == DevicePlatform.iOS ? 0.00001 : 0);
21482148
}
21492149
else if (inputLayout != null && inputLayout.Content is SfView numericEntry && numericEntry.Children.Count > 0)
21502150
{
21512151
if (numericEntry.Children[0] is Entry numericInputView)
21522152
{
2153-
numericInputView.Opacity = value ? 1 : 0;
2153+
numericInputView.Opacity = value ? 1 : (DeviceInfo.Platform == DevicePlatform.iOS ? 0.00001 : 0);
21542154
}
21552155
}
21562156
}

maui/src/TextInputLayout/SfTextInputLayout.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -667,20 +667,20 @@ protected override void OnContentChanged(object oldValue, object newValue)
667667
//For placeholder overlap issue here handled the opacity value for controls.
668668
if (newValue is InputView entryEditorContent)
669669
{
670-
entryEditorContent.Opacity = IsHintFloated ? 1 : 0;
670+
entryEditorContent.Opacity = IsHintFloated ? 1 : (DeviceInfo.Platform == DevicePlatform.iOS ? 0.00001 : 0);
671671
}
672672
else if (newValue is SfView numericEntryContent && numericEntryContent.Children.Count > 0)
673673
{
674674
if (numericEntryContent.Children[0] is Entry numericInputView)
675675
{
676-
numericInputView.Opacity = IsHintFloated ? 1 : 0;
676+
numericInputView.Opacity = IsHintFloated ? 1 : (DeviceInfo.Platform == DevicePlatform.iOS ? 0.00001 : 0);
677677
}
678678
}
679679
else if (newValue is Picker picker)
680680
{
681681
if (DeviceInfo.Platform != DevicePlatform.WinUI)
682682
{
683-
picker.Opacity = IsHintFloated ? 1 : 0;
683+
picker.Opacity = IsHintFloated ? 1 : (DeviceInfo.Platform == DevicePlatform.iOS ? 0.00001 : 0);
684684
}
685685
}
686686

0 commit comments

Comments
 (0)