maui
maui copied to clipboard
Pasting into MAUI text entry does not work on iOS
Description
Pasting into the MAUI text entry does not work. I have verified that I am able to paste the data into other iOS apps (like messages). See video here:
https://user-images.githubusercontent.com/104405893/192114697-94cf185c-1a30-4410-9dfc-ab7b35fff074.mp4
Steps to Reproduce
Open the Maui samples task app https://github.com/dotnet/maui-samples/tree/main/6.0/Beginners-Series
Or create from scratch
- Create new maui app
- Add a simple text entry
<Entry x:Name="entry"
Placeholder="Enter text"
TextChanged="OnEntryTextChanged"
Completed="OnEntryCompleted" />
- Run the app on iOS
- Type something into the text entry
- Select and copy the text in the entry
- Try to paste it into the text entry
Link to public reproduction project repository
https://github.com/dotnet/maui-samples/tree/main/6.0/Beginners-Series
Version with bug
6.0.486 (current)
Last version that worked well
Unknown/Other
Affected platforms
iOS
Affected platform versions
iOS 15
Did you find any workaround?
N/A
Relevant log output
N/A
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.
I am also experiencing this issue. Further, in iOS 16, selecting text crashes the application.
Is there no workaround?
Really is not important that an application crashes when you paste a text in any field?? I have the same problem in iOS 16…
So we are now able to paste into the textbox with iOS16. I'm sitting at the in-laws now, so can't verify, but I believe the handler solved it, along with the tapping crash.
#if ANDROID
using AndroidX.AppCompat.Widget;
#elif IOS || MACCATALYST
using UIKit;
#elif WINDOWS
using Microsoft.UI.Xaml.Controls;
using Microsoft.UI.Xaml;
#endif
namespace PayProff.NativeApp.Controls
{
/// <summary>
/// Entry created to ensure similar behavior across platforms
/// </summary>
public static class UnifiedEntry
{
public static void ApplyHandler()
{
#if IOS
//Should ensure that tapping the entry multiple times does not crash the app
Microsoft.Maui.Handlers.EntryHandler.PlatformViewFactory = handler => new WorkaroundMauiTextField();
#endif
}
}
#if IOS
public class WorkaroundMauiTextField : Microsoft.Maui.Platform.MauiTextField
{
public WorkaroundMauiTextField() : base()
{
//Ensures that the textbox has no border
BorderStyle = UIKit.UITextBorderStyle.None; //UIKit.UITextBorderStyle.RoundedRect; <-- Part of the original fix
ClipsToBounds = true;
}
[Foundation.Export("selectedTextRange")]
public new UIKit.UITextRange SelectedTextRange
{
get => base.SelectedTextRange;
set => base.SelectedTextRange = value;
}
}
#endif
}
The same one, but on Windows 11 (Maui Blazor)
How to make custom entry to disable paste option/menu for iOS because in ios16.1.1 pasting on entry causing crashing of app.???
How we can override a method in custom handler like handler.PlatformView.CanPerform()?
Can anyone confirm this is still an issue? Tried this just now and it seems to work fine for me.
Hi @ss-proc. 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.
What is the command to update dotnet workload ? Cmd= dotnet workload update maui??
On Thu, Dec 15, 2022, 7:13 PM msftbot[bot] @.***> wrote:
Hi @ss-proc https://github.com/ss-proc. 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 https://github.com/dotnet/maui/blob/main/.github/repro.md 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.
— Reply to this email directly, view it on GitHub https://github.com/dotnet/maui/issues/10302#issuecomment-1353092847, or unsubscribe https://github.com/notifications/unsubscribe-auth/AXFOZJMJTR7H2PA4NZPW2TTWNMOAXANCNFSM6AAAAAAQUYKKXQ . You are receiving this because you commented.Message ID: @.***>
dotnet workload update maui
dotnet workload update is enough I guess
confirm that on Windows 11 (Maui Blazor) everything is ok now
Solution : Entry pasting issue is fixed after updating to latest .net.
Open the project. Open Developer command prompt. Run the cmd : dotnet workload update Also run cmd : dotnet workload restore Configure net7.0 or latest .Net version in cs.proj file.