Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Android] Fix Keyboard.Numeric issue (#16163)
* Fix Keyboard.Numeric issue on DisplayPromptAsync on Android * Remove AlertsPage sample --------- Co-authored-by: Rachel Kang <rachel.j.kang@gmail.com>
- Loading branch information
5ac1e80
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hello,
I've tried creating a custom LocalizeDigitsKeyListener in .NET 7 Maui application since we cannot migrate to .NET 8 yet. I added the code for this file which is supposed to fix the ability to input ',' or different decimal characters when the app is in a different language.
Then I set the KeyListener of the input to use this instead of the one built in with Maui .NET 7
ie)
PlatformView.KeyListener = LocalizedDigitsKeyListenerFixed.Create(handler.PlatformView.InputType);
This didn't have any effect on the input. I was also able to troubleshoot the code in LocalizedDigitsKeyListener and the InputTypes are different between .NET 7 and .NET 8 for a the same Entry using
Keyboard="Numeric"
which changes the execution of the code inside this class. ie).NET 7
Android.Text.InputTypes.ClassText | Android.Text.InputTypes.TextFlagMultiLine
vs
.NET 8
Android.Text.InputTypes.ClassNumber | Android.Text.InputTypes.NumberFlagDecimal | Android.Text.InputTypes.NumberFlagSigned | Android.Text.InputTypes.TextFlagAutoCorrect
Regardless, I ended up setting the same InputTypes in the .NET 7 app manually to match those that .NET 8 shows by default and it still didn't let me input a ',' when being on a different language (German).
Are you sure this is what fixed the issue in .NET 8? Seems like something else must have fixed it. If you can point me to the correct fix to see if I can implement it in my .NET 7 app I would appreciate it.