Open quantumarun opened 6 years ago
Try setting the Keyboard to 'Text'
Already tried this but still autocorrection happens
Does it happen if you use a regular Entry control?
Yes. Same thing happens there also. Also i have writing a custom renderer on XfxEntry controls for ios and set the autocorrection to none but still the autocorrection happens.
You didn't specify if you're on a device or simulator. Do you happen to have a custom keyboard by chance?
Its having on both device and simulator. No i don't have custom keyboard. Attached is the snapshot for your reference. As in the screenshot, i want to disable the suggestion coming just over the keyboard.
Hello, I also reproduce this issue on both IPhoneSimulator and real IPhone. Can you fix this thing?
This issue is very important for login form.
I would do this in the simple entry (and it works):
`
I've never contributed to a project before on github, and I'm not that good at XF to be able to build my own control but I have a control called NoHelperEntry (which I used online tutorials for). Its fairly straightforward but I wonder if instead of inheriting from Entry you inherit from NoHelperEntry instead?
so in the shared project:
namespace Controls { public class NoHelperEntry : Entry { } }
then in the iOS and Android projects you have these renders:
Android
using Xamarin.Forms;
using Xamarin.Forms.Platform.Android;
using Android.Text;
using Project.Controls;
using Project.Droid.Renderers;
using View = Android.Views.View;
[assembly: ExportRenderer(typeof(NoHelperEntry), typeof(NoHelperEntryRenderer))]
namespace Project.Droid.Renderers
{
public class NoHelperEntryRenderer : EntryRenderer
{
protected override void OnElementChanged(ElementChangedEventArgs<Entry> e)
{
base.OnElementChanged(e);
Control.ShowSoftInputOnFocus = false;
}
private void Control_FocusChange(object sender, FocusChangeEventArgs e)
{
if (e.HasFocus)
{
Control.ShowSoftInputOnFocus = false;
}
else
{
Control.ShowSoftInputOnFocus = false;
}
}
}
}
iOS
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System;
using Xamarin.Forms.Platform.iOS;
using Xamarin.Forms;
using UIKit;
using CoreGraphics;
using Project.iOS;
using Project;
using Foundation;
using UIKit;
using Project.Controls;
[assembly: ExportRenderer(typeof(NoHelperEntry), typeof(NoHelperEntryRenderer))]
namespace Project.iOS
{
public class NoHelperEntryRenderer : EntryRenderer
{
protected override void OnElementChanged(ElementChangedEventArgs<Entry> e)
{
base.OnElementChanged(e);
if (Control != null)
{
Control.InputView = new UIView();
Control.SpellCheckingType = UITextSpellCheckingType.No; // No Spellchecking
Control.AutocorrectionType = UITextAutocorrectionType.No; // No Autocorrection
Control.AutocapitalizationType = UITextAutocapitalizationType.None; // No Autocapitalization
}
}
}
}
So with a big proviso that I may be doing it completely wrong, hopefully this helps!
Same problem, any idea how fix this? @ChaseFlorell
I can't change the Keyboard
for this custom entry control through XAML, code-behind or MVVM binding. From source code on the iOS Entry renderer, it looks like the Keyboard is being manually set to Native. It seems like this is the reason the Keyboard
property is never getting applied to the entry, it's being overwritten by SetKeyboard()
. I can do some experimenting with this when I get the time
I can't change the
Keyboard
for this custom entry control through XAML, code-behind or MVVM binding. From source code on the iOS Entry renderer, it looks like the Keyboard is being manually set to Native. It seems like this is the reason theKeyboard
property is never getting applied to the entry, it's being overwritten bySetKeyboard()
. I can do some experimenting with this when I get the time
I'm having a similar issue when trying to set the Keyboard flag to CapitalizeCharacter (or any other value). I tried doing it in XAML and in .cs, It just gets ignored in iOS. In Android, it works as expected.
Did you (or anyone) find a workaround?
Yes, it is indeed setting the KeyboardType using .ToNative() that is at the root of the issue. You can illustrate this by replacing the SetKeyboard() with the following, which no longer auto-capitalizes:
private void SetKeyboard()
{
Control.ApplyKeyboard(Keyboard.Create(KeyboardFlags.CapitalizeNone));
Control.ShouldReturn = InvokeCompleted;
}
Of course, this obviously doesn't solve the issue since it would then ignore your Keyboard property altogether :) The solution seems to be to update the SetKeyboard to use ApplyKeyboard() and only use ToNative() for the numberpad comparison:
private void SetKeyboard()
{
var kbd = Element.Keyboard;
Control.ApplyKeyboard(kbd);
Control.InputAccessoryView = kbd.ToNative() == UIKeyboardType.NumberPad ? NumberpadAccessoryView() : null;
Control.ShouldReturn = InvokeCompleted;
}
With this change I am then able to easily set the keyboard type and flags via XAML:
<xfx:XfxComboBox
Placeholder="Enter text"
SelectedItem="{Binding SelectedItem}"
ItemsSource="{Binding TextSuggestions}">
<xfx:XfxComboBox.Keyboard>
<Keyboard x:FactoryMethod="Create">
<x:Arguments>
<KeyboardFlags>CapitalizeNone</KeyboardFlags>
</x:Arguments>
</Keyboard>
</xfx:XfxComboBox.Keyboard>
</xfx:XfxComboBox>
While still maintaining the ability to specify a default keyboard type:
<xfx:XfxComboBox
Placeholder="Enter email"
SelectedItem="{Binding SelectedItem}"
Text="{Binding EmailAddress}"
ItemsSource="{Binding EmailSuggestions}"
Keyboard="Email" />
I'll try to put together a pull request (hoping that it'll get applied), but I thought I'd at least post this here for others since I had the same issue and there hasn't been any update.
I need to turn off autocorrection when typing some text. Right now if i something say serah then on iOS it will automatically by corrected to search. Is there a build in property already for this?
Bug
Affects
Expected Behavior
Actual Behavior
Steps to reproduce the Behavior
Link to Github Reproduction (optional but recommended)
[Repro]()
Feature Request:
Please fill in what you would like