React-native: App freezes when focus TextInput

Created on 3 Oct 2019  路  31Comments  路  Source: facebook/react-native

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

Bug TextInput

Most helpful comment

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

All 31 comments

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.

I experience the same issue on an iOS13 iPhone 11 Pro simulator using RN 0.59.9

I can confirm also having this with RN 0.61.2 in Release mode on iOS 13

Same thing here :(. iPhone 8 simulator.

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.

could you provide a stack frame of the app by doing:

open Activity Monitor on your Mac, sort by CPU usage. Your app should be at the top (it runs as a process on your Mac even though it's in an iPhone/iPad), hit the Info button and then click Sample in the bottom left. Then paste that stackframe here as a Gist. It should help us narrow down where the issue is coming from.

same problem occurs on iPhone X 13.0 simulator. The app is installed and launched via react-native run-ios

Same problem here

RN 0.61.2 
iOS 13 
iPhone 11 Simulator

please stop commenting if you have the same problem as it isn't really helpful. Instead provide a stack frame as per my instructions here: https://github.com/facebook/react-native/issues/26707#issuecomment-538753825

@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鈥檙e 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鈥檚 side but rather an Apple bug.

If you鈥檙e 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鈥檚 forums: https://forums.developer.apple.com/thread/122972

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

@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.

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.

@lcszulpo Yes, just want to confirm, this is not a react native issue.
I can reproduce this on any text field in iOS 13. This is possibly iOS 13.0 Simulator issue.
Even in Safari search bar I can reproduce it.
Interesting is it fixed in iOS 13.1 Simulator. It still unavailbale

Yep, fixed in 13.1. This can be closed.

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

XCode 11.2 Beta works too

@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

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

I try put

1 - import 'react-native-gesture-handler' at the top of index.js
2 - YellowBox.ignoreWarnings([
'RCTRootView cancelTouches'
]);

And don't works. Any news about the solution?

@wesleynfreitas disable pastebin and reset the sim (as in my previous comment) and reinstall the app, it should work.

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

馃ズ

closing this issue as it鈥檚 not caused by React Native and the later comments aren鈥檛 really helpful

image

It is work for me!

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.

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 for me. Thanks 鉁岋笍

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

Erase all contents and settings worked for me.

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

Was this page helpful?
0 / 5 - 0 ratings