Issues with TextInput width on android

I’m stuck with a strange issue on android. I have a TextInput that I want to be the full width of the screen. If I apply any type of width or flexbox layout to make it wider it breaks the select/copy/paste function. Users can still type in the box and delete characters but they can’t select anything.

If I leave it as the default width everything works fine. What can I do here?

I think it may be related to this react native issue https://github.com/facebook/react-native/issues/20887

Has anyone here made a textinput in android with a set width and had copy/paste work?

update: It’s odd, I took my local code and put it in a snack and copy/paste works, but when I do a build or preview from my local machine it does not work. I’m puzzled. Do the snacks use a different version of react native?

Hey @nicholmikey,

If you export the Snack project, and then either publish or build, does it work as it should?

-Charlie

@charliecruzan I think I found the issue. I can reproduce in a snack with a TextInput in a StackNavigator. Here is a snack that demos the issue https://snack.expo.io/rJvpq7RsE
I made the snack based on this https://github.com/rago4/context-menu-issue

It looks like this might be a known react native issue https://github.com/react-navigation/react-navigation/issues/5476

Try going to the second screen, typing, then try to copy/paste, you will see the context menu does not appear.

Any tips?

– oddly sometimes it works in the snack, but it will fail as expected on a real android loaded with the qr code

– Even more odd, if you make a spelling mistake on the second screen and force a spellcheck it fixes the context menu error, but if you just type good english like “hello world” and tap and hold you can’t open the context menu, on that second screen only.

1 Like

Thanks for sharing the snack, I can confirm I’m getting the same behavior (including the context menu working correctly in the Snack simulator, but not every time)

That RN issue is probably the best place to follow this, since it’s RN related, not Expo.

Just noticed you also shared this Snack on that issue- thank you!

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.