这很难调试,因为当这种冻结发生时,chrome性能调试器中没有活动。 ScrollView仍然滚动,因此Android不会落后。另一方面,Perf Monitor仍然显示JS的60fps并且它不会冻结。
虽然同步代码应该继续运行,但也许异步代码没有返回。当我提交更改时,其他操作(如导航返回)也会被阻止,尽管整个流程也是异步的。
如果我在尝试触摸事物(例如更改选项)时,应用程序可能会因以下错误而崩溃:
Cannot record touch end without a touch start.
04-16 17:18:17.749 7065 7102 I ReactNativeJS: websocket connection open
04-16 17:18:18.538 7065 7102 E ReactNativeJS: 'Cannot record touch end without a touch start.\nTouch End: %s\n', 'Touch Bank: %s', '{"identifier":2,"pageX":144.79888916015625,"pageY":327.2443542480469,"timestamp":22079251}', '[{"touchActive":false,"startPageX":321.55340576171875,"startPageY":325.2271728515625,"startTimeStamp":22079180,"currentPageX":322.0527038574219,"currentPageY":346.2295227050781,"currentTimeStamp":22079251,"previousPageX":322.0527038574219,"previousPageY":322.2295227050781,"previousTimeStamp":22079248},{"touchActive":false,"startPageX":235.17337036132812,"startPageY":257.2802429199219,"startTimeStamp":22079203,"currentPageX":234.674072265625,"currentPageY":281.2802429199219,"currentTimeStamp":22079251,"previousPageX":234.674072265625,"previousPageY":257.2802429199219,"previousTimeStamp":22079248}]'
04-16 17:18:18.565 7065 7102 E ReactNativeJS: 'Cannot record touch end without a touch start.\nTouch End: %s\n', 'Touch Bank: %s', '{"identifier":2,"pageX":144.79888916015625,"pageY":327.2443542480469,"timestamp":22079251}', '[{"touchActive":false,"startPageX":321.55340576171875,"startPageY":325.2271728515625,"startTimeStamp":22079180,"currentPageX":322.0527038574219,"currentPageY":346.2295227050781,"currentTimeStamp":22079251,"previousPageX":322.0527038574219,"previousPageY":346.2295227050781,"previousTimeStamp":22079251},{"touchActive":false,"startPageX":235.17337036132812,"startPageY":257.2802429199219,"startTimeStamp":22079203,"currentPageX":234.674072265625,"currentPageY":281.2802429199219,"currentTimeStamp":22079251,"previousPageX":234.674072265625,"previousPageY":281.2802429199219,"previousTimeStamp":22079251}]'
04-16 17:18:18.572 7065 7102 E ReactNativeJS: 'Cannot record touch end without a touch start.\nTouch End: %s\n', 'Touch Bank: %s', '{"identifier":2,"pageX":144.79888916015625,"pageY":327.2443542480469,"timestamp":22079251}', '[{"touchActive":false,"startPageX":321.55340576171875,"startPageY":325.2271728515625,"startTimeStamp":22079180,"currentPageX":322.0527038574219,"currentPageY":346.2295227050781,"currentTimeStamp":22079251,"previousPageX":322.0527038574219,"previousPageY":346.2295227050781,"previousTimeStamp":22079251},{"touchActive":false,"startPageX":235.17337036132812,"startPageY":257.2802429199219,"startTimeStamp":22079203,"currentPageX":234.674072265625,"currentPageY":281.2802429199219,"currentTimeStamp":22079251,"previousPageX":234.674072265625,"previousPageY":281.2802429199219,"previousTimeStamp":22079251}]'
04-16 17:18:18.614 7065 7102 I ReactNativeJS: 'ws onclose', ''
所以我的部分问题是;除了Chrome调试器和Perf Monitor之外,我该如何调试性能?
另一部分是;为什么异步代码会阻止应用程序,我该如何阻止它?
任何其他可能有用的评论也值得赞赏
顺便说一句,我花了很多时间来优化以前很慢的所有内容,所以当它没有落后时,一切都很快。