We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Samsung Android/iPad devices not displaying decimal keyboard

Xamarin.Forms  3.4
Syncfusion 16.3.0.29

My XAML mark-up:

                                            MaximumNumberDecimalDigits="{Binding DecimalPrecision}" <--- resolves to a the number 2
                                            SelectAllOnFocus="True"
                                            Watermark="{i18N:Localize ActivityPageViewModel_FormResultTextViewModel_Answer_Placeholder_Label}" />

Testing within the emulator (Oreo 8.1 API27 Google APIs) the correct keyboard is displayed so that I can enter values using the decimal precision.

However, for two physical devices I use for testing, I do not have the keyboard to provide for negative or decimal precision, only numbers. 

Those devices being:

Samsung Galaxy Tab S2 9.7
Samsung Galaxy Tab A 8.0

Using other Android apps that do not leverage the Syncfusion control on these devices displays the correct keyboard. To further complicate, the keyboard selection on two iPads also exhibit the keyboard selection issue with this control.

Anybody have any insight or suggestions?

6 Replies

RM Robert Mims December 7, 2018 04:57 PM UTC

I'll add a little bit more to the mix:

I installed the sample app from the Google Play store and the NumericTextBox does not display the decimal/negative sign keyboard - but the NumericUpDown demonstration does.




RM Robert Mims December 7, 2018 06:03 PM UTC

Switching to the NumericUpDown control, same bindings and precision and the correct keyboard shows.

Suggests something with the Numeric Textbox control.


PA Paul Anderson S Syncfusion Team December 11, 2018 01:02 PM UTC

Hi Robert, 
 
Greetings from Syncfusion.

We have analyzed the reported issue in source level. We have used key listener in SfNumericTextBox. So only the key board issue occurs in Tablets. To overcome this issue we have changed the keyboard type in the rendered of the control using the below snippet.
 
 
Code Snippet: 
if (Device.Idiom == TargetIdiom.Tablet) 
{ 
    this.Control.InputType = InputTypes.ClassNumber | InputTypes.NumberFlagSigned 
                             | InputTypes.NumberFlagDecimal; 
} 
 
Also, we have prepared the sample for the same. Please find it from the below link.   
 
 
Regards, 
Paul Anderson 



RM Robert Mims December 11, 2018 01:10 PM UTC

Thank you, Paul.

That is almost exactly how I am working around the issue for this and the iOS issues you are looking at in incident 222710.

Kind regards.

Robert


RM Robert Mims December 11, 2018 04:31 PM UTC

For reference, conceptually, look at the configuration and add behaviors with the correct keyboard, no matter the Idiom.

One observation, however, is that these only seem to work for Android. For iOS, the NumbersAndPunctuation keyboard always appears, despite validation of assignment in the renderer and UWP does not appear to honor the InputScope designation (comes in null) for the control - even with the known limitations with keyboard customization.

Android

        /// <inheritdoc />
        protected override void OnElementChanged(ElementChangedEventArgs<SfNumericTextBox> e)
        {
            base.OnElementChanged(e);

            if(this.Control == null)
            {
                return;
            }

            this.Control.InputType |= Android.Text.InputTypes.ClassNumber;

            if (this.Control.MaximumNumberDecimalDigits > 0)
            {
                this.Control.InputType |= Android.Text.InputTypes.NumberFlagDecimal;
            }

            if (double.TryParse(this.Control.Minimum?.ToString(), out var minimum) && minimum < 0)
            {
                this.Control.InputType |= Android.Text.InputTypes.NumberFlagSigned;
            }
        }

iOS

        /// <inheritdoc />
        protected override void OnElementChanged(ElementChangedEventArgs<SfNumericTextBox> e)
        {
            base.OnElementChanged(e);

            if (this.Control == null)
            {
                return;
            }

            // Left verbose for readability - changing to DecimalPad or NumberPad seems to have no effect as the keyboard always seems to be NumbersAndPunctuation
            this.Control.KeyboardType = UIKit.UIKeyboardType.NumberPad;

            if (this.Control.MaximumNumberDecimalDigits > 0)
            {
                this.Control.KeyboardType = UIKit.UIKeyboardType.DecimalPad;
            }

            if (double.TryParse(this.Control.Minimum?.ToString(), out var minimum) && minimum < 0)
            {
                this.Control.KeyboardType = UIKit.UIKeyboardType.NumbersAndPunctuation;
            }
        }

UWP

        /// <inheritdoc />
        protected override void OnElementChanged(ElementChangedEventArgs<SfNumericTextBox> e)
        {
            base.OnElementChanged(e);

            if (this.Control == null)
            {
                return;
            }

            var scope = new InputScope();
            scope.Names.Add(new InputScopeName() { NameValue = InputScopeNameValue.Number });

            // Comes in as null, doesn't appear to affect the keyboard presented with Windows tablet.
            this.Control.InputScope = scope;
        }


PA Paul Anderson S Syncfusion Team December 12, 2018 01:17 PM UTC

Hi Robert, 
  
Thanks for the update. We will share you the details in your incident to avoid duplicate followup. Please have further followup with the support incident and we will assist you in that. 
  
Regards, 
Paul Anderson 


Loader.
Live Chat Icon For mobile
Up arrow icon