react-native-controlled-mentions icon indicating copy to clipboard operation
react-native-controlled-mentions copied to clipboard

Pasting some long text into the input can cause the entire long text to be highlighted

Open fullStackOasis opened this issue 2 years ago • 4 comments

The bug is happening in a complex project that I'm working on, but I am able to reproduce this using the example project in the source code here.

I cloned your project, and made a few small changes, but the changes were for clarity. You can demo the issue with your own example code and no changes.

Steps to reproduce:

  1. Copy into your clipboard the following text (select/copy): is a simple python script that uses yt-dlp to scrape all of a youtube channels
  2. Run your example project.
  3. Press into the input and delete the default text.
  4. Press on the input, and type the "@" character, which brings up the user suggestions. Choose David Tabaka.
  5. Type a single space character. You do not need to type the space character if you've set isInsertSpaceAfterMention: true for the "@" trigger because it is automatically inserted.
  6. Long press in the input to get the Android menu with various options. Choose the "paste as plain text" option.
  7. The text that you copied is pasted into the input, and almost immediately you see the entire content displayed as part of the controlled mention.

You can checkout my project, install it, and run it to demo the issue. https://github.com/fullStackOasis/react-native-controlled-mentions-example

Once the bug happens, I've found that the app eventually crashes if I continue typing enough. As I type, all the text shows up as a "mention".

The bug only happens for some samples of text that I copied, not for all of them. With the text that I wrote above, it is 100% reproducible for me.

Any support you can offer is much appreciated!

fullStackOasis avatar May 20 '23 17:05 fullStackOasis

Screenshot showing the issue:

image

fullStackOasis avatar May 20 '23 17:05 fullStackOasis

It appears that this is a React Native bug with TextInput and some specific Android devices. I opened an issue here: https://github.com/facebook/react-native/issues/37502

fullStackOasis avatar May 20 '23 20:05 fullStackOasis

Hey @fullStackOasis, thank you for such a clear and detailed feedback!

Sorry for the long wait, I'm currently focused on other projects, and the support for this library is not as active as it used to be.

Please let me know, is this question still relevant? If so, have you tried using the prerelease v3 version of this library? I tried to reproduce your issue on my end with the 3rd version, and the problem didn't occur.

https://github.com/dabakovich/react-native-controlled-mentions/releases/tag/v3.0.0-alpha.2

dabakovich avatar Sep 16 '23 12:09 dabakovich

@dabakovich Thank you for getting back to this.

I tried installing v3.0.0-alpha.4 - that was the latest - and made a few changes to my sample project, but the problem is still there.

I'm not sure that this problem is in your project, in fact. There's already a bug in React Native in TextInput on some specific devices, so it could be that this is the true problem.

fullStackOasis avatar Oct 01 '23 00:10 fullStackOasis