Coder Social home page Coder Social logo

Comments (12)

ChrisAllisonMalta avatar ChrisAllisonMalta commented on July 20, 2024 1

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!

from xfx.controls.

ChaseFlorell avatar ChaseFlorell commented on July 20, 2024

Try setting the Keyboard to 'Text'

from xfx.controls.

quantumarun avatar quantumarun commented on July 20, 2024

Already tried this but still autocorrection happens

from xfx.controls.

ChaseFlorell avatar ChaseFlorell commented on July 20, 2024

Does it happen if you use a regular Entry control?

from xfx.controls.

quantumarun avatar quantumarun commented on July 20, 2024

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.

from xfx.controls.

ChaseFlorell avatar ChaseFlorell commented on July 20, 2024

You didn't specify if you're on a device or simulator. Do you happen to have a custom keyboard by chance?

from xfx.controls.

quantumarun avatar quantumarun commented on July 20, 2024

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.

simulator screen shot - iphone x - 2018-04-04 at 21 19 21

from xfx.controls.

boskokg avatar boskokg commented on July 20, 2024

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):

<Entry Placeholder="test" Keyboard="Text"> <Entry.Keyboard> <Keyboard x:FactoryMethod="Create"> <x:Arguments> <KeyboardFlags>None</KeyboardFlags> </x:Arguments> </Keyboard> </Entry.Keyboard> </Entry>

from xfx.controls.

juanagu avatar juanagu commented on July 20, 2024

Same problem, any idea how fix this? @ChaseFlorell

from xfx.controls.

Daxton47 avatar Daxton47 commented on July 20, 2024

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

from xfx.controls.

jokogarcia avatar jokogarcia commented on July 20, 2024

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'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?

from xfx.controls.

kiddailey avatar kiddailey commented on July 20, 2024

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.

from xfx.controls.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.