Skip to content

SearchBar: Inconsistent behavior (Keyboard and Properties) in iOS and Android #9092

Open
@jbizcloud

Description

@jbizcloud

Description

  • <SearchBar> does not show the proper Keyboard setting. It can display the proper Keyboard after attaching a Renderer.
  • <CustomSearchBar> control does not inherit all Properties from <SearchBar> in iOS.
Topic Description XAML C# iOS Android
Keyboard not showing <SearchBar> does not show the proper Keyboard setting. <SearchBar Placeholder="Search - Native" Keyboard="Numeric" /> n/a Keyboard not correct. Should be a Numeric type.
Screen Shot 2022-07-30 at 1 53 48 PM
Keyboard not correct. Should be a Numeric type.
Screen Shot 2022-07-30 at 1 53 06 PM
(Workaround-ish) Keyboard showing but cannot write in iOS <SearchBar> shows the proper Keyboard setting when attaching a Renderer. (same as above) [below] Cannot type and Placeholder is already NOT visible.
Screen Shot 2022-07-30 at 1 58 01 PM
Can type
Screen Shot 2022-07-30 at 1 56 30 PM
A custom control based on SearchBar w/ Renderer Keyboard will show but properties are lost in OS. Cannot type in iOS. Note that without renderer, Keyboard setting setting does not work in iOS nor Android <components:CustomSearchBar Placeholder="Search - Custom control" Keyboard="Numeric" /> [below] Screen Shot 2022-07-30 at 2 09 00 PM Same as above. Without a renderer, the Keyboard setting does not work.

Renderers

  • iOS
namespace MauiBlazor.Platforms.iOS.Renderers
{
    public class AcDaSearchBarRenderer : SearchBarRenderer
    {
        public AcDaSearchBarRenderer() : base()
        {
        }

        protected override void OnElementChanged(ElementChangedEventArgs<SearchBar> e)
        {
            base.OnElementChanged(e);
        }
    }
}
  • Android
namespace MauiBlazor.Platforms.Android.Renderers
{
    public class AcDaSearchBarRenderer : SearchBarRenderer
    {
        public AcDaSearchBarRenderer(Context context) : base(context)
        {
        }

        protected override void OnElementChanged(ElementChangedEventArgs<SearchBar> e)
        {
            base.OnElementChanged(e);
        }
    }
}

MauiProgram.cs

        var builder = MauiApp.CreateBuilder();
        builder
            .UseMauiApp<App>()
            .ConfigureFonts(fonts =>
            {
                fonts.AddFont("OpenSans-Regular.ttf", "OpenSansRegular");
            })
             .UseMauiCompatibility()
            .ConfigureMauiHandlers(handlers =>
            {
#if ANDROID
                //                handlers.AddCompatibilityRenderer<CustomSearchBar,MauiBlazor.Platforms.Android.Renderers.AcDaSearchBarRenderer>();
                handlers.AddCompatibilityRenderer<SearchBar,MauiBlazor.Platforms.Android.Renderers.AcDaSearchBarRenderer>();

#endif

#if IOS
//                handlers.AddCompatibilityRenderer<CustomSearchBar,MauiBlazor.Platforms.iOS.Renderers.AcDaSearchBarRenderer>();
               handlers.AddCompatibilityRenderer<SearchBar,MauiBlazor.Platforms.iOS.Renderers.AcDaSearchBarRenderer>();


#endif

            });

CustomSearchBar

public class CustomSearchBar : SearchBar
    {
        public CustomSearchBar() : base()
        {

        }
    }

Steps to Reproduce

  1. Create a MAUI project with /Blazor.
  2. Add a SearchBar to any XAML page. Set Keyboard to Numeric.
  3. Expect the behaviors shown in the table above.

Version with bug

6.0.400

Last version that worked well

Unknown/Other

Affected platforms

iOS

Affected platform versions

iOS

Did you find any workaround?

Yes but partial workarounds. Above in table.

Relevant log output

n/a

Activity

added
s/needs-verificationIndicates that this issue needs initial verification before further triage will happen
t/bugSomething isn't working
on Jul 30, 2022
added
legacy-area-controlsLabel, Button, CheckBox, Slider, Stepper, Switch, Picker, Entry, Editor
on Aug 1, 2022
added and removed
s/needs-verificationIndicates that this issue needs initial verification before further triage will happen
on Aug 24, 2022
added this to the Backlog milestone on Aug 29, 2022
ghost

ghost commented on Aug 29, 2022

@ghost

We've moved this issue to the Backlog milestone. This means that it is not going to be worked on for the coming release. We will reassess the backlog following the current release and consider this item at that time. To learn more about our issue management process and to have better expectation regarding different types of issues you can read our Triage Process.

added
s/verifiedVerified / Reproducible Issue ready for Engineering Triage
s/triagedIssue has been reviewed
s/try-latest-versionPlease try to reproduce the potential issue on the latest public version
and removed
s/verifiedVerified / Reproducible Issue ready for Engineering Triage
on Sep 4, 2023
ghost

ghost commented on Sep 4, 2023

@ghost

Hi @jbizcloud. We have added the "s/try-latest-version" label to this issue, which indicates that we'd like you to try and reproduce this issue on the latest available public version. This can happen because we think that this issue was fixed in a version that has just been released, or the information provided by you indicates that you might be working with an older version.

You can install the latest version by installing the latest Visual Studio (Preview) with the .NET MAUI workload installed. If the issue still persists, please let us know with any additional details and ideally a reproduction project provided through a GitHub repository.

This issue will be closed automatically in 7 days if we do not hear back from you by then - please feel free to re-open it if you come back to this issue after that time.

Zhanglirong-Winnie

Zhanglirong-Winnie commented on Sep 4, 2023

@Zhanglirong-Winnie

Verified this issue with Visual Studio Enterprise 17.8.0 Preview 1.0. Not repro on iOS and android platform.
Android:
Screenshot 2023-09-04 134210
iOS:
Screenshot 2023-09-04 135449

ghost closed this as completedon Sep 11, 2023
ghost locked as resolved and limited conversation to collaborators on Oct 11, 2023
removed
legacy-area-controlsLabel, Button, CheckBox, Slider, Stepper, Switch, Picker, Entry, Editor
on May 10, 2024
removed
s/try-latest-versionPlease try to reproduce the potential issue on the latest public version
on Jul 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @Eilon@jfversluis@samhouts@jbizcloud@Zhanglirong-Winnie

        Issue actions

          SearchBar: Inconsistent behavior (Keyboard and Properties) in iOS and Android · Issue #9092 · dotnet/maui