react-native: App freezes when focus TextInput

React Native version: 0.61.1

Steps To Reproduce

  1. npx react-native init test-textinput
  2. add TextInput component
const App = () => {
  const [value, setValue] = useState('init');
  return (
    <View style={{ flex: 1, marginTop: 100 }}>
       <TextInput value={value} onChangeText={text => setValue(text)} />
    </View>
  );
};
  1. Open app in Iphone8 emulator

Describe what you expected to happen: it is possible to type text into input field

What actually happens: Application freezes after focusing TextInput

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Reactions: 37
  • Comments: 33 (6 by maintainers)

Most upvoted comments

The last comment in the apple thread fixed for me: Simulator: Hardware > "Erase all contents and settings" + disable pastebin sync

I experience the same issue with RN 0.61.2 as well. It works on Android but every focus to TextInput on iOS freezes the app.

@farad4y thanks a lot for that!

it looks like the main thread is trying to read from the pasteboard and locking up. I expect this is a Simulator only issue that probably happens when the Simulator is trying to sync pasteboards between the Simulator and your Mac.

if you’re seeing this, you might be able to get around it by disabling auto-sync clipboard in the Simulator settings.

I do not expect this to be an issue on React Native’s side but rather an Apple bug.

If you’re experiencing this issue, please try following the steps as above and if you see a stack frame that involves UIConcretePasteboard it is likely this issue.

edit: more info on Apple’s forums: https://forums.developer.apple.com/thread/122972

closing this issue as it’s not caused by React Native and the later comments aren’t really helpful

On Simulator, disable Edit > Automatically Sync Pasteboard

The last comment in the apple thread fixed for me: Simulator: Hardware > "Erase all contents and settings" + disable pastebin sync

this worked, I only had to disable pastebin sync and the problem was resolved. thank you.

image

It is work for me!

It’s happening to me In Development, it seems to only impact ios13. I downloaded an ios12.2 simulator and there are no issues but when I try an ios13 simulator the whole app will freeze the moment I focus on any text input.

@mackenziemance @farad4y Unfortunately I can still see this issue on on Xcode 11.1 / iOS 13.1 simulator. It is not related to react-native I think. I can work ~ 1h normally, after that in any app, in browser, in app if I focus on text input - app is freezing. Same for all app installed on simulator.

I think this is the Simulator issue, because it is possible to fix that if just select Hardware -> Erase all content and reinstall apps

I did some tests on the simulator, crashes are occurring with Text Inputs in the bare system, in the Search Bar for example, outside react native apps. I agree with @mmmulani this is probably a UIKit bug.

@mmmulani I tried to disabling auto-sync clipboard but not solved, app still freezes.

yeah it’s not a guaranteed fix. I would try disabling auto-sync and then manually send and get the pasteboard to the Simulator.

Also try opening the Messages/Contacts app and see if any of the text boxes freeze there. Again, it looks like an UIKit bug which I hope Apple will fix in an upcoming Xcode release.

I’ve heard anecdotally that it doesn’t repro on older versions of the Simulator, so maybe try running against iOS 12, or try testing on device.

These steps resolved my problem.

Reset simulator: Device > “Erase All Contents and Settings…”

Screen Shot 2020-11-25 at 4 18 33 PM

Disable pastebin sync: Edit > “Automatically Sync Pasteboard”

Screen Shot 2020-11-25 at 4 19 31 PM

@rborn Yes, but this issue will be reproduced later again, I reset simulator once per hour usually

XCode 11.2 Beta works too

Yep, fixed in 13.1. This can be closed.

Cool, thanks a lot! I need to install Xcode 11.1 Beta then to have iOS 13.1 Simulators Looks like we have another critical issue with react-native and iOS 13.1.2 described in this issue: https://github.com/facebook/react-native/issues/26696