未启用“调试 JS"时,Android 的 React Native 运行速度非常慢; [英] React native for android run very slow when not enable "Debug JS"

查看:74
本文介绍了未启用“调试 JS"时,Android 的 React Native 运行速度非常慢;的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 react native 开发一个应用,我使用了一些 ios 和 android 的代码库,ios 版本运行流畅.

I am developing an app using react native, I use some code base for ios and android, the ios version run smoothly.

但是安卓版本运行很慢.奇怪的是:

But the android version run very slowly. the weird thing is:

当我摇晃手机,然后单击Debug JS"以启用 chrome 功能中的调试时,它运行得更快,有人知道原因吗?

When I shake the phone, and click "Debug JS" to enable debug in chrome feature, it run faster, anyone have a clue about the reason?

推荐答案

有时,一个或多个活动的 console.log() 行会导致此问题.如果存在 console.log 行,则应搜索并删除它们.

Sometimes, one or more than one active console.log() lines cause this issue. console.log lines should be searched and deleted if they exist.

也在生产中,babel-plugin-transform-remove-console 可用于自动清除所有 console.* 方法.

Also in production, babel-plugin-transform-remove-console can be used to clear all console.* methods automatically.

这篇关于未启用“调试 JS"时,Android 的 React Native 运行速度非常慢;的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆