Skip to content

Commit 3ea964f

Browse files
Merge pull request #56 from PriyadharshniM/main
Resolved Entry ReturnType = "NEXT" Not Working with SfTextInputLayout Issue
2 parents 4d21a66 + cef0240 commit 3ea964f

File tree

3 files changed

+33
-5
lines changed

3 files changed

+33
-5
lines changed

maui/src/TextInputLayout/SfTextInputLayout.Methods.cs

Lines changed: 26 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,11 @@ 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+
//Explicitly reset ReturnType to handle native restrictions.
524+
ApplyNativeProperties(entry);
525+
}
500526
#endif
501527
}
502528

maui/src/TextInputLayout/SfTextInputLayout.Properties.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2142,15 +2142,16 @@ static void OnIsHintFloatedPropertyChanged(BindableObject bindable, object oldVa
21422142
{
21432143
if (bindable is SfTextInputLayout inputLayout && newValue is bool value)
21442144
{
2145+
//Adjusted Opacity from 0 to 0.00001 to ensure the content remains functionally active while enabling the ReturnType property.
21452146
if (inputLayout.Content is InputView || inputLayout.Content is Picker)
21462147
{
2147-
inputLayout.Content.Opacity = value ? 1 : 0;
2148+
inputLayout.Content.Opacity = value ? 1 : (DeviceInfo.Platform == DevicePlatform.iOS ? 0.00001 : 0);
21482149
}
21492150
else if (inputLayout != null && inputLayout.Content is SfView numericEntry && numericEntry.Children.Count > 0)
21502151
{
21512152
if (numericEntry.Children[0] is Entry numericInputView)
21522153
{
2153-
numericInputView.Opacity = value ? 1 : 0;
2154+
numericInputView.Opacity = value ? 1 : (DeviceInfo.Platform == DevicePlatform.iOS ? 0.00001 : 0);
21542155
}
21552156
}
21562157
}

maui/src/TextInputLayout/SfTextInputLayout.cs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -665,22 +665,23 @@ protected override void OnContentChanged(object oldValue, object newValue)
665665
}
666666

667667
//For placeholder overlap issue here handled the opacity value for controls.
668+
//Adjusted Opacity from 0 to 0.00001 to ensure the content remains functionally active while enabling the ReturnType property.
668669
if (newValue is InputView entryEditorContent)
669670
{
670-
entryEditorContent.Opacity = IsHintFloated ? 1 : 0;
671+
entryEditorContent.Opacity = IsHintFloated ? 1 : (DeviceInfo.Platform == DevicePlatform.iOS ? 0.00001 : 0);
671672
}
672673
else if (newValue is SfView numericEntryContent && numericEntryContent.Children.Count > 0)
673674
{
674675
if (numericEntryContent.Children[0] is Entry numericInputView)
675676
{
676-
numericInputView.Opacity = IsHintFloated ? 1 : 0;
677+
numericInputView.Opacity = IsHintFloated ? 1 : (DeviceInfo.Platform == DevicePlatform.iOS ? 0.00001 : 0);
677678
}
678679
}
679680
else if (newValue is Picker picker)
680681
{
681682
if (DeviceInfo.Platform != DevicePlatform.WinUI)
682683
{
683-
picker.Opacity = IsHintFloated ? 1 : 0;
684+
picker.Opacity = IsHintFloated ? 1 : (DeviceInfo.Platform == DevicePlatform.iOS ? 0.00001 : 0);
684685
}
685686
}
686687

0 commit comments

Comments
 (0)