Skip to content
This repository was archived by the owner on Jul 9, 2026. It is now read-only.
This repository was archived by the owner on Jul 9, 2026. It is now read-only.

Tapping into PlainText doesn't allow to select text on Android #267

Closed

Description

@mzorz

Creating issue here to keep track of scenarios tested and make a specific case for the solution built in PR #265.

Trying Gutenberg as is, realized that it was difficult (or impossible) to select text on PlainText-backed blocks (that is currently Code and More blocks).

The caret would appear upon touching, but not the context menu to select / copy / paste.

gutenberg_plain_text_selection_not_ok

Leaving information about the experiments done here:

  1. I noted that just opening the demo app, rotating the device to horizontal and then rotating it back to vertical will make the issue go away - try doing it and then selecting text on any TextInput becomes possible.

gutenberg_as_is_rotate

  1. so as a workaround, it seems the component needs to re-render itself, for that I tried a hack as described here [Android] Can't select text in TextInput react/react-native#9958 (comment) that simply sets the width of the InputText to 99% and then after having the component attached to the window we reset the state to force a redraw. This effectively makes the field's content selectable again.

  2. Back to the context of using TextInput in RecyclerViewList, I found out the workaround does not work for the elements that are not actually drawn on the screen when the list is shown (that is, the elements in the RecyclerViewList that are off the screen on startup). For example, try showing the keyboard and letting it up. Now reload the app, and try scrolling down the list and selecting one of the items that was “behind” the keyboard. You’ll see the text cannot be selected there.

One possible solution is to listen into the the adapter’s onViewAttachedToWindow(viewholder) callback and try to refresh the EditText there.

Activity

  1. added this to the Alpha milestone on Nov 21, 2018
  2. self-assigned this
    on Nov 21, 2018
  3. daniloercoli commented on Nov 22, 2018

    @daniloercoli
    Contributor

    Just adding a comment here, since it was not clear in the description, that this issue is present if we use our RecyclerViewList in Android. Default RN FlatList doesn't show this problem.

  4. mzorz commented on Nov 22, 2018

    @mzorz
    ContributorAuthor

    While this is effectively tackled by the work done in wordpress-mobile/react-native-recyclerview-list#11, closing this for now, as we're moving towards use of FlatList and removing RecyclerViewList as indicated in #256 (review)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions