"react-native": "0.63.1"
I have some dynamic javascript run using eval in react native iOS. If the same code is not wrapped in eval, it works fine but if executed by eval it became stuck and I had to tap on the phone screen or rock/shake the phone to have the script execution resumed. The stuck place boils down to the following call in WebView.ios.js ("react-native-webview": "^10.8.3"):
_this.injectJavaScript = function (data) { UIManager.dispatchViewManagerCommand(_this.getWebViewHandle(), _this.getCommands().injectJavaScript, [data]); console.log('injectJavaScript5 dispatched', data); // instrumented }
That dispatch call actually finished as I can see the log 'injectJavaScript5 dispatched' printed:[dispatchViewManagerCommand logs are from instrumenting node_modules/react-native/React/Modules/RCTUIManager.m: RCTLogWarn(@"dispatchViewManagerCommand start");]
2020-09-07 11:24:34.463462-0400 myapp[810:118124] [javascript] 'injectJavaScript5 dispatched', ----- !!! 9 seconds nothing happened until tap/rock/shake the phone2020-09-07 11:24:43.378875-0400 myapp[810:120363] [native] dispatchViewManagerCommand start2020-09-07 11:24:43.379158-0400 myapp[810:120363] [native] dispatchViewManagerCommand before block start2020-09-07 11:24:43.379336-0400 myapp[810:120363] [native] dispatchViewManagerCommand managerCLass before2020-09-07 11:24:43.379532-0400 myapp[810:120363] [native] dispatchViewManagerCommand managerCLass after2020-09-07 11:24:43.379711-0400 myapp[810:120363] [native] dispatchViewManagerCommand managerCLass Number method before2020-09-07 11:24:43.379876-0400 myapp[810:120363] [native] dispatchViewManagerCommand managerCLass Number method after2020-09-07 11:24:43.380040-0400 myapp[810:120363] [native] dispatchViewManagerCommand managerCLass args before2020-09-07 11:24:43.380209-0400 myapp[810:120363] [native] dispatchViewManagerCommand managerCLass args after2020-09-07 11:24:43.380424-0400 myapp[810:120363] [native] dispatchViewManagerCommand end2020-09-07 11:24:43.383301-0400 myapp[810:118124] [javascript] dispatchViewManagerCommand start2020-09-07 11:24:43.386167-0400 myapp[810:117952] [native] injectJavasScript3 start:---- why dispatchViewManagerCommand logs are in both [native] and [javascript]?2020-09-07 11:24:34.335216-0400 myapp[810:118124] [javascript] dispatchViewManagerCommand before block start2020-09-07 11:24:34.351613-0400 myapp[810:118124] [javascript] dispatchViewManagerCommand managerCLass before2020-09-07 11:24:34.371906-0400 myapp[810:118124] [javascript] dispatchViewManagerCommand managerCLass after2020-09-07 11:24:34.381274-0400 myapp[810:118124] [javascript] dispatchViewManagerCommand managerCLass Number method before2020-09-07 11:24:34.390347-0400 myapp[810:118124] [javascript] dispatchViewManagerCommand managerCLass Number method after2020-09-07 11:24:34.397696-0400 myapp[810:118124] [javascript] dispatchViewManagerCommand managerCLass args before2020-09-07 11:24:34.405117-0400 myapp[810:118124] [javascript] dispatchViewManagerCommand managerCLass args after2020-09-07 11:24:34.410255-0400 myapp[810:118124] [javascript] dispatchViewManagerCommand end
- Both react-native-webview and react-native-wkwebview-reborn are tried, same stuck behavior.
- Both hooks and classes are tried, same stuck behavior.
- react native 0.57.2 works fine with classes (hooks NOT tried), i.e. script execution NOT stuck.
- not every call is stuck, some calls are ok, others are stuck,
- There was one time I switched from WiFi to LTE, the script ran smoothly several times and I thought the problem is with WiFi. But once I kill and restart the app, the same stuck behaviour returned.
- I suspect the event queue/loop somehow is affected by eval as tap/rock/shake the phone all generates some events. But where to check? Is this a bug in RN or a security feature?
BTW what does myapp[810:118124] mean? I know myapp is the app name but 810:118124?
Thanks.